Don't snap a footprint (or group) to its children.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15535

(cherry picked from commit d161602e92)
This commit is contained in:
Jeff Young 2023-08-29 13:04:53 +01:00
parent f33120c540
commit 09490e1f46
1 changed files with 26 additions and 2 deletions

View File

@ -408,8 +408,32 @@ std::set<BOARD_ITEM*> PCB_GRID_HELPER::queryVisible( const BOX2I& aArea,
}
}
for( BOARD_ITEM* skipItem : aSkip )
items.erase( skipItem );
std::function<void( BOARD_ITEM* )> skipItem =
[&]( BOARD_ITEM* aItem )
{
items.erase( aItem );
if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( aItem ) )
{
footprint->RunOnChildren(
[&]( BOARD_ITEM* aChild )
{
skipItem( aChild );
} );
}
if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( aItem ) )
{
group->RunOnChildren(
[&]( BOARD_ITEM* aChild )
{
skipItem( aChild );
} );
}
};
for( BOARD_ITEM* item : aSkip )
skipItem( item );
return items;
}