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
This commit is contained in:
Jeff Young 2021-11-27 14:18:01 +00:00
parent 4b226b8172
commit 9f7db24871
1 changed files with 9 additions and 7 deletions

View File

@ -47,6 +47,7 @@
#include <sch_junction.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <lib_shape.h>
#include <schematic.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
@ -58,7 +59,6 @@
#include <view/view_controls.h>
#include <wx/log.h>
SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
@ -988,13 +988,14 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
{
EDA_ITEM* item = collector[ i ];
SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( 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;