From 72c27b2e33f7b274c2b55c65cef47dd3ea255316 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 1 Jan 2021 09:30:36 -0800 Subject: [PATCH] Make expand selection stop at vias During the first expansion, we are supposed to stop at vias and branches (where three track ends connect). This needs to account for the number of vias and tracks not just tracks --- pcbnew/tools/pcb_selection_tool.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index e7d766082e..ed71426deb 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -1143,8 +1143,9 @@ void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem for( int i = activePts.size() - 1; i >= 0; --i ) { wxPoint pt = activePts[i]; + size_t pt_count = trackMap[ pt ].size() + viaMap.count( pt ); - if( trackMap[ pt ].size() > 2 && aStopCondition == STOP_AT_JUNCTION ) + if( pt_count > 2 && aStopCondition == STOP_AT_JUNCTION ) { activePts.erase( activePts.begin() + i ); continue; @@ -1172,7 +1173,7 @@ void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem expand = true; } - if( viaMap.count( pt ) && !viaMap[ pt ]->IsSelected() ) + if( viaMap.count( pt ) && !viaMap[ pt ]->IsSelected() && aStopCondition != STOP_AT_JUNCTION ) select( viaMap[ pt ] ); activePts.erase( activePts.begin() + i );