From 9f7db2487104719e07125df72c70ac18fe71b6ad Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 27 Nov 2021 14:18:01 +0000 Subject: [PATCH] Selection bug fixes for Symbol Editor. 1) Make sure the y-coord is correctly inverted before calling collision routines. 2) Give LIB_SHAPE poly lines the same extra slop as SCH_LINEs. Fixes https://gitlab.com/kicad/code/kicad/issues/9791 --- eeschema/tools/ee_selection_tool.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 408216ed38..1ec5ef756d 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ #include #include - SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel ) { if( aSel.GetSize() == 1 ) @@ -986,15 +986,16 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const for( int i = collector.GetCount() - 1; i >= 0; --i ) { - EDA_ITEM* item = collector[ i ]; - SCH_LINE* line = dynamic_cast( item ); + EDA_ITEM* item = collector[ i ]; + SCH_LINE* line = dynamic_cast( item ); + LIB_SHAPE* shape = dynamic_cast( item ); // Lines are hard to hit. Give them a bit more slop to still be considered "exact". - if( line ) + if( line || ( shape && shape->GetShape() == SHAPE_T::POLY ) ) { - if( line->HitTest( (wxPoint) aPos, Mils2iu( DANGLING_SYMBOL_SIZE ) ) ) - exactHits.insert( line ); + if( item->HitTest( (wxPoint) aPos, Mils2iu( DANGLING_SYMBOL_SIZE ) ) ) + exactHits.insert( item ); } else { @@ -1016,7 +1017,8 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const // Find the closest item. (Note that at this point all hits are either exact or non-exact.) wxPoint pos( aPos ); - SEG poss( aPos, aPos ); + SEG poss( m_isSymbolEditor ? mapCoords( pos ) : pos, + m_isSymbolEditor ? mapCoords( pos ) : pos ); EDA_ITEM* closest = nullptr; int closestDist = INT_MAX / 2;