Browse Source

Don't zoom all the way in on a new footprint.

Fixes https://gitlab.com/kicad/code/kicad/issues/2220
pull/16/head
Jeff Young 5 years ago
parent
commit
dea05336fc
  1. 31
      pcbnew/footprint_edit_frame.cpp

31
pcbnew/footprint_edit_frame.cpp

@ -468,9 +468,34 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents() const
MODULE* module = GetBoard()->GetFirstModule();
if( module )
return module->GetFootprintRect();
else
return GetBoardBoundingBox( false );
{
bool hasGraphicalItem = module->Pads().size() || module->Zones().size();
if( !hasGraphicalItem )
{
for( const BOARD_ITEM* item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_TEXT_T )
continue;
hasGraphicalItem = true;
break;
}
}
if( hasGraphicalItem )
{
return module->GetFootprintRect();
}
else
{
BOX2I newModuleBB( { 0, 0 }, { 0, 0 } );
newModuleBB.Inflate( Millimeter2iu( 12 ) );
return newModuleBB;
}
}
return GetBoardBoundingBox( false );
}

Loading…
Cancel
Save