From 1c6f3f8f0dd834642668acdd5a1307984db5fb57 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Feb 2022 22:53:00 +0000 Subject: [PATCH] Drop a knee between tracks to a single item when dragging. This prevents the disambiguation menu from coming up when we don't really care which element we start the drag on. Fixes https://gitlab.com/kicad/code/kicad/issues/10745 (cherry picked from commit ae85f575772dad1460e93c323713cb76428aec5c) --- pcbnew/tools/edit_tool.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 4789e85000..6dcd26fb1d 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -289,6 +289,22 @@ 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 + if( aCollector.GetCount() == 2 && dynamic_cast( aCollector[0] ) ) + { + static KICAD_T types[] = { PCB_VIA_T, PCB_TRACE_T, PCB_ARC_T, EOT }; + + PCB_TRACK* a = static_cast( aCollector[0] ); + PCB_TRACK* b = static_cast( aCollector[1] ); + const auto& c = aCollector[0]->GetBoard()->GetConnectivity(); + + int dist = a->GetWidth() / 2; + auto connectedItems = c->GetConnectedItemsAtAnchor( a, aPt, types, dist ); + + if( alg::contains( connectedItems, b ) ) + aCollector.Remove( b ); + } }, true /* prompt user regarding locked items */ ); @@ -1213,8 +1229,8 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent ) auto processFilletOp = [&]( bool aStartPoint ) { + std::shared_ptr connectivity = board()->GetConnectivity(); wxPoint anchor = ( aStartPoint ) ? track->GetStart() : track->GetEnd(); - auto connectivity = board()->GetConnectivity(); auto itemsOnAnchor = connectivity->GetConnectedItemsAtAnchor( track, anchor, track_types );