Gerbview: Fit to page: use the page size when nothing is loaded.
Previously, due to a minor bug, a very small default size was used (therefore a high zoom value), that was not a good choice.
This commit is contained in:
parent
7c49bcd3a6
commit
fc71fc6474
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2012-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -89,7 +89,6 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
|
|||
}
|
||||
}
|
||||
|
||||
bbox.Inflate( ( bbox.GetWidth() / 10 ) + 100 );
|
||||
bbox.Normalize();
|
||||
|
||||
m_BoundingBox = bbox;
|
||||
|
|
|
@ -360,22 +360,22 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
|
||||
double GERBVIEW_FRAME::BestZoom()
|
||||
{
|
||||
double defaultGerberZoom = 1.0;
|
||||
EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox();
|
||||
|
||||
// Reserve a margin around the bounding box, for a better display.
|
||||
double margin_scale_factor = 1.05;
|
||||
|
||||
// If there is not item loaded, use the current page size
|
||||
if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
|
||||
{
|
||||
SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
||||
return defaultGerberZoom;
|
||||
bbox.SetSize( GetPageSizeIU() );
|
||||
bbox.SetOrigin( 0, 0 );
|
||||
}
|
||||
|
||||
double sizeX = (double) bbox.GetWidth();
|
||||
double sizeY = (double) bbox.GetHeight();
|
||||
wxPoint centre = bbox.Centre();
|
||||
|
||||
// Reserve no margin because GetGerberLayout()->ComputeBoundingBox() builds one in.
|
||||
double margin_scale_factor = 1.0;
|
||||
|
||||
return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue