From 3b31955d98912e76997df29c9e553cc916aa765a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 21 Nov 2022 09:28:36 -0800 Subject: [PATCH] Get hit test in group members Fixes https://gitlab.com/kicad/code/kicad/issues/12957 --- pcbnew/tools/pcb_selection_tool.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index cbd32f4408..2f8c5d5b50 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -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( item ) ) + { + bool found = false; + + group->RunOnChildren( [&] ( BOARD_ITEM* aItem ) + { + if( aItem->HitTest( aPoint, margin ) ) + found = true; + } ); + + if( found ) + return true; + } + } } return false;