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
This commit is contained in:
Seth Hillbrand 2025-08-29 16:10:37 -07:00
parent 50274352b1
commit a811f61c39

View File

@ -1657,7 +1657,10 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vector<BOARD_CONNE
// Select any starting track items // Select any starting track items
if( startItem->IsType( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } ) ) if( startItem->IsType( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } ) )
select( startItem ); {
if( itemPassesFilter( startItem, true ) )
select( startItem );
}
} }
for( BOARD_CONNECTED_ITEM* startItem : aStartItems ) for( BOARD_CONNECTED_ITEM* startItem : aStartItems )
@ -1771,6 +1774,18 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vector<BOARD_CONNE
bool gotPad = padIt != padMap.end() && ( padIt->second->GetLayerSet() & layerSetCu ).any(); bool gotPad = padIt != padMap.end() && ( padIt->second->GetLayerSet() & layerSetCu ).any();
bool gotNonStartPad = gotPad && ( startPadSet.find( padIt->second ) == startPadSet.end() ); bool gotNonStartPad = gotPad && ( startPadSet.find( padIt->second ) == 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 ) if( aStopCondition == STOP_AT_JUNCTION )
{ {
size_t pt_count = 0; size_t pt_count = 0;
@ -1815,6 +1830,9 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vector<BOARD_CONNE
if( !layerSetCu.Contains( track->GetLayer() ) ) if( !layerSetCu.Contains( track->GetLayer() ) )
continue; continue;
if( !itemPassesFilter( track, true ) )
continue;
if( !track->IsSelected() ) if( !track->IsSelected() )
select( track ); select( track );
@ -1838,6 +1856,9 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vector<BOARD_CONNE
if( !layerSetCu.Contains( shape->GetLayer() ) ) if( !layerSetCu.Contains( shape->GetLayer() ) )
continue; continue;
if( !itemPassesFilter( shape, true ) )
continue;
if( !shape->IsSelected() ) if( !shape->IsSelected() )
select( shape ); select( shape );
@ -1863,6 +1884,12 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks( const std::vector<BOARD_CONNE
{ {
PCB_VIA* via = viaMap[pt]; PCB_VIA* via = viaMap[pt];
if( !itemPassesFilter( via, true ) )
{
activePts.erase( activePts.begin() + i );
continue;
}
if( !via->IsSelected() ) if( !via->IsSelected() )
select( via ); select( via );