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

Fixes https://gitlab.com/kicad/code/kicad/issues/2220
This commit is contained in:
Jeff Young 2020-05-11 00:15:01 +01:00
parent 0d654b3574
commit dea05336fc
1 changed files with 28 additions and 3 deletions

View File

@ -468,8 +468,33 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents() const
MODULE* module = GetBoard()->GetFirstModule();
if( module )
{
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 );
}