Make it easy to select small things overlapping symbols

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7487
This commit is contained in:
Jon Evans 2021-02-11 12:13:38 -05:00
parent 20ec1fa354
commit 1bec10b6fa
1 changed files with 12 additions and 2 deletions

View File

@ -932,13 +932,23 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
} }
} }
// Prefer a field to a symbol // Prefer things that are generally smaller than a symbol to a symbol
const std::set<KICAD_T> preferred =
{
SCH_FIELD_T,
SCH_LINE_T,
SCH_BUS_WIRE_ENTRY_T,
SCH_NO_CONNECT_T,
SCH_JUNCTION_T,
SCH_MARKER_T
};
for( int i = 0; collector.GetCount() == 2 && i < 2; ++i ) for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
{ {
EDA_ITEM* item = collector[ i ]; EDA_ITEM* item = collector[ i ];
EDA_ITEM* other = collector[ ( i + 1 ) % 2 ]; EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
if( item->Type() == SCH_FIELD_T && other->Type() == SCH_COMPONENT_T ) if( preferred.count( item->Type() ) && other->Type() == SCH_COMPONENT_T )
collector.Transfer( other ); collector.Transfer( other );
} }