Fix pad clearance bounding box and initial display

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7673
This commit is contained in:
Jon Evans 2021-02-23 22:15:39 -05:00
parent 887ad1c30d
commit 3d7c202192
2 changed files with 11 additions and 2 deletions

View File

@ -1310,9 +1310,15 @@ const BOX2I PAD::ViewBBox() const
VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
EDA_RECT bbox = GetBoundingBox();
// get the biggest possible clearance
int clearance = 0;
for( PCB_LAYER_ID layer : GetLayerSet().Seq() )
clearance = std::max( clearance, GetOwnClearance( layer ) );
// Look for the biggest possible bounding box
int xMargin = std::max( solderMaskMargin, solderPasteMargin.x );
int yMargin = std::max( solderMaskMargin, solderPasteMargin.y );
int xMargin = std::max( solderMaskMargin, solderPasteMargin.x ) + clearance;
int yMargin = std::max( solderMaskMargin, solderPasteMargin.y ) + clearance;
return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ),
VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) );

View File

@ -1081,6 +1081,9 @@ void PCB_EDIT_FRAME::onBoardLoaded()
// Display the loaded board:
Zoom_Automatique( false );
// Invalidate painting as loading the DRC engine will cause clearances to become valid
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
Refresh();
SetMsgPanel( GetBoard() );