From 48858c30c4ccc67bcf5556ebafdc5ff0f19b3e91 Mon Sep 17 00:00:00 2001 From: diemer Date: Thu, 3 Apr 2008 18:45:49 +0000 Subject: [PATCH] Fixed Bug 1829931: calculation of zoom level in Window_Zoom(), so we show more rather than less for a box-zoom. --- share/zoom.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/share/zoom.cpp b/share/zoom.cpp index 53d82c13ad..896b44713a 100644 --- a/share/zoom.cpp +++ b/share/zoom.cpp @@ -130,15 +130,16 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) /* Compute the best zoom */ Rect.Normalize(); size = DrawPanel->GetClientSize(); - ii = Rect.GetSize().x / size.x; - jj = Rect.GetSize().y / size.y; + // Overestimate zoom level, i. e. show more than selected rather than less. + ii = static_cast( ceil(1.0 * Rect.GetSize().x / size.x) ); + jj = static_cast( ceil(1.0 * Rect.GetSize().y / size.y) ); bestzoom = MAX( ii, jj ); if( bestzoom <= 0 ) bestzoom = 1; - GetScreen()->SetZoom( bestzoom ); + GetScreen()->SetZoom( bestzoom ); - GetScreen()->m_Curseur = Rect.Centre(); + GetScreen()->m_Curseur = Rect.Centre(); Recadre_Trace( TRUE ); }