Tighten up hittesting for symbols and other items.
Grid-based accuracy doesn't need to be any larger than 1/2 the diagonal as we'll snap to one side or the other. And symbols don't need as much slop as other items since there's plenty of "meat" on them. Fixes https://gitlab.com/kicad/code/kicad/issues/9805
This commit is contained in:
parent
71bfbfaa70
commit
80d6b9e76d
|
@ -1783,8 +1783,8 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
|
|||
|
||||
bool SCH_SYMBOL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
bBox.Inflate( aAccuracy );
|
||||
EDA_RECT bBox = GetBodyBoundingBox();
|
||||
bBox.Inflate( aAccuracy / 2 );
|
||||
|
||||
if( bBox.Contains( aPosition ) )
|
||||
return true;
|
||||
|
@ -1800,7 +1800,7 @@ bool SCH_SYMBOL::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
|
|||
|
||||
EDA_RECT rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
rect.Inflate( aAccuracy / 2 );
|
||||
|
||||
if( aContained )
|
||||
return rect.Contains( GetBodyBoundingBox() );
|
||||
|
|
|
@ -785,7 +785,7 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a
|
|||
const KICAD_T* aFilterList )
|
||||
{
|
||||
int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
||||
int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() );
|
||||
int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 );
|
||||
aCollector.m_Threshold = std::max( pixelThreshold, gridThreshold );
|
||||
|
||||
if( m_isSymbolEditor )
|
||||
|
|
Loading…
Reference in New Issue