Fixed Bug 1829931: calculation of zoom level in Window_Zoom(), so we show more rather than less for a box-zoom.

This commit is contained in:
diemer 2008-04-03 18:45:49 +00:00
parent 9039a0a579
commit 48858c30c4
1 changed files with 5 additions and 4 deletions

View File

@ -130,15 +130,16 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
/* Compute the best zoom */ /* Compute the best zoom */
Rect.Normalize(); Rect.Normalize();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = Rect.GetSize().x / size.x; // Overestimate zoom level, i. e. show more than selected rather than less.
jj = Rect.GetSize().y / size.y; ii = static_cast<int>( ceil(1.0 * Rect.GetSize().x / size.x) );
jj = static_cast<int>( ceil(1.0 * Rect.GetSize().y / size.y) );
bestzoom = MAX( ii, jj ); bestzoom = MAX( ii, jj );
if( bestzoom <= 0 ) if( bestzoom <= 0 )
bestzoom = 1; bestzoom = 1;
GetScreen()->SetZoom( bestzoom ); GetScreen()->SetZoom( bestzoom );
GetScreen()->m_Curseur = Rect.Centre(); GetScreen()->m_Curseur = Rect.Centre();
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
} }