Fix incorrect size of the displayed worksheet when starting eeschema or gerbview without file loaded.

It was due to not fully initialized VIEW parameters the first time COMMON_TOOLS::ZoomFitScreen() is called.
This commit is contained in:
jean-pierre charras 2019-07-20 11:53:53 +02:00
parent d746ba892d
commit b428d74281
1 changed files with 4 additions and 0 deletions

View File

@ -238,6 +238,10 @@ int COMMON_TOOLS::ZoomFitScreen( const TOOL_EVENT& aEvent )
BOX2I bBox = frame->GetDocumentExtents();
BOX2I defaultBox = canvas->GetDefaultViewBBox();
VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
view->SetScale( 1.0 ); // the best scale will be fixed later, from this initial value
// but this call ensure all view parameters are up to date
// especially at init time
VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )