Get hit test in group members

Fixes https://gitlab.com/kicad/code/kicad/issues/12957
This commit is contained in:
Seth Hillbrand 2022-11-21 09:28:36 -08:00
parent e2fd67d434
commit 3b31955d98
1 changed files with 19 additions and 2 deletions

View File

@ -2707,8 +2707,25 @@ bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
BOX2I itemBox = item->ViewBBox();
itemBox.Inflate( margin ); // Give some margin for gripping an item
if( itemBox.Contains( aPoint ) && item->HitTest( aPoint, margin ) )
return true;
if( itemBox.Contains( aPoint ) )
{
if( item->HitTest( aPoint, margin ) )
return true;
if( PCB_GROUP* group = dyn_cast<PCB_GROUP*>( item ) )
{
bool found = false;
group->RunOnChildren( [&] ( BOARD_ITEM* aItem )
{
if( aItem->HitTest( aPoint, margin ) )
found = true;
} );
if( found )
return true;
}
}
}
return false;