From fc06192643cc52b4bf77fd5a73f418b264bd32c3 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 8 Sep 2022 23:42:18 +0100 Subject: [PATCH] More improvements to drag tool selection disambiguation. Fixes https://gitlab.com/kicad/code/kicad/issues/10745 (cherry picked from commit 2743fd583ff5e159aebaf3d9bb5723131b9cc080) --- pcbnew/tools/edit_tool.cpp | 7 +++++-- pcbnew/tools/pcb_selection_tool.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index ef9e5000dd..2788ae2383 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -290,8 +290,11 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent ) sTool->FilterCollectorForFreePads( aCollector ); sTool->FilterCollectorForHierarchy( aCollector, true ); - // drop a knee between two segments to a single segment, or a via with two - // segments attached to the via + if( aCollector.GetCount() > 1 ) + sTool->GuessSelectionCandidates( aCollector, aPt ); + + // If we have a knee between two segments, or a via attached to two segments, + // then drop the selection to a single item. static KICAD_T trackTypes[] = { PCB_VIA_T, PCB_TRACE_T, PCB_ARC_T, EOT }; std::vector tracks; std::vector vias; diff --git a/pcbnew/tools/pcb_selection_tool.h b/pcbnew/tools/pcb_selection_tool.h index 9d0611f6cd..4bb6af0bfd 100644 --- a/pcbnew/tools/pcb_selection_tool.h +++ b/pcbnew/tools/pcb_selection_tool.h @@ -197,6 +197,8 @@ public: PCB_GROUP* GetEnteredGroup() { return m_enteredGroup; } + PCB_LAYER_ID GetActiveLayer() { return m_frame->GetActiveLayer(); } + /** * In general we don't want to select both a parent and any of it's children. This includes * both footprints and their items, and groups and their members.