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 0ba08f57f2
commit b31af4891d
1 changed files with 12 additions and 1 deletions

View File

@ -2146,6 +2146,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 ) if( aCollector.CountType( PCB_MODULE_T ) > 0 )
{ {
double maxArea = calcMaxArea( aCollector, PCB_MODULE_T ); double maxArea = calcMaxArea( aCollector, PCB_MODULE_T );
@ -2175,7 +2186,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
continue; continue;
// reject ALL OTHER footprints if there's still something else left // reject ALL OTHER footprints if there's still something else left
// to select // to select
else if( (int)( rejected.size() + 1 ) < aCollector.GetCount() ) else if( hasNonModules )
rejected.insert( mod ); rejected.insert( mod );
} }
} }