Give selection preference to pins over wires.

Fixes https://gitlab.com/kicad/code/kicad/issues/9063
This commit is contained in:
Jeff Young 2021-09-23 23:58:46 +01:00
parent 9ea6b44ee8
commit 42687f5d9d
1 changed files with 9 additions and 6 deletions

View File

@ -1023,13 +1023,16 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
if( exactHits.count( item ) ) if( exactHits.count( item ) )
{ {
wxPoint pos( aPos ); if( item->Type() == SCH_PIN_T || item->Type() == SCH_JUNCTION_T )
SCH_LINE* line = dynamic_cast<SCH_LINE*>( item ); {
SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( item ); closest = item;
break;
}
if( junction ) wxPoint pos( aPos );
dist = 0; // Hits *inside* a junction dot should select the dot SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
else if( line )
if( line )
dist = DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos ); dist = DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos );
else else
dist = EuclideanNorm( bbox.GetCenter() - pos ) * 2; dist = EuclideanNorm( bbox.GetCenter() - pos ) * 2;