Don't use ViewBBox for zoom-to-fit.

The ViewBBox can include the largest document clearance so that pad
clearance lines get included.  But the largest clearance can be, well,
large.

Fixes https://gitlab.com/kicad/code/kicad/issues/14276
This commit is contained in:
Jeff Young 2023-03-13 22:44:31 +00:00
parent 1058d36315
commit 725834b554
2 changed files with 3 additions and 8 deletions

View File

@ -1513,11 +1513,8 @@ const BOX2I FOOTPRINT::ViewBBox() const
{ {
BOX2I area = GetBoundingBox( true, true ); BOX2I area = GetBoundingBox( true, true );
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not // Inflate in case clearance lines are drawn around pads, etc.
// optimized, but the draw cost is small (perhaps smaller than optimization). if( const BOARD* board = GetBoard() )
const BOARD* board = GetBoard();
if( board )
{ {
int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue(); int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
area.Inflate( biggest_clearance ); area.Inflate( biggest_clearance );

View File

@ -129,9 +129,7 @@ void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<FOOTPRINT> aFootp
void FOOTPRINT_PREVIEW_PANEL::fitToCurrentFootprint() void FOOTPRINT_PREVIEW_PANEL::fitToCurrentFootprint()
{ {
BOX2I bbox = m_currentFootprint->ViewBBox(); BOX2I bbox = m_currentFootprint->GetBoundingBox( true, false );
bbox.Merge( m_currentFootprint->Value().ViewBBox() );
bbox.Merge( m_currentFootprint->Reference().ViewBBox() );
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 ) if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{ {