From e830709cda02b92e49ac0572eb6fe89e3b245a8a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 29 Aug 2025 16:10:37 -0700 Subject: [PATCH] Make Expand Connection respect the filter Prevents expansion that would require traversing elements that are disabled in the selection filter Fixes https://gitlab.com/kicad/code/kicad/-/issues/21581 (cherry picked from commit a811f61c39e49fe48f79edb0d1f4ce3db65398e3) --- pcbnew/tools/pcb_selection_tool.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 0b439607c1..0bced0cd63 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -1510,7 +1510,10 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vectorIsType( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } ) ) - select( startItem ); + { + if( itemPassesFilter( startItem, true ) ) + select( startItem ); + } } for( BOARD_CONNECTED_ITEM* startItem : aStartItems ) @@ -1624,6 +1627,18 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vectorsecond ) == startPadSet.end() ); + if( gotPad && !itemPassesFilter( padIt->second, true ) ) + { + activePts.erase( activePts.begin() + i ); + continue; + } + + if( gotVia && !itemPassesFilter( viaIt->second, true ) ) + { + activePts.erase( activePts.begin() + i ); + continue; + } + if( aStopCondition == STOP_AT_JUNCTION ) { size_t pt_count = 0; @@ -1671,6 +1686,9 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vectorGetLayer() ) ) continue; + if( !itemPassesFilter( track, true ) ) + continue; + if( !track->IsSelected() ) select( track ); @@ -1693,6 +1711,9 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vectorGetLayer() ) ) continue; + if( !itemPassesFilter( shape, true ) ) + continue; + if( !shape->IsSelected() ) select( shape ); @@ -1717,6 +1738,12 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vectorIsSelected() ) select( via );