Be smarter about determining if there are modules in the selection list.

The old algorithm would delete modules if another module was in the
list, which was not the intention.

Fixes https://gitlab.com/kicad/code/kicad/issues/4175
This commit is contained in:
Jeff Young 2020-04-09 00:05:25 +01:00
parent 317e98b344
commit e016b629d3
1 changed files with 12 additions and 1 deletions

View File

@ -2119,6 +2119,17 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
}
}
bool hasNonModules = false;
for( int i = 0; i < aCollector.GetCount(); ++i )
{
if( aCollector[i]->Type() != PCB_MODULE_T )
{
hasNonModules = true;
break;
}
}
if( aCollector.CountType( PCB_MODULE_T ) > 0 )
{
double maxArea = calcMaxArea( aCollector, PCB_MODULE_T );
@ -2148,7 +2159,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
continue;
// reject ALL OTHER footprints if there's still something else left
// to select
else if( (int)( rejected.size() + 1 ) < aCollector.GetCount() )
else if( hasNonModules )
rejected.insert( mod );
}
}