Make sure pin hittest regions don't get too hard to hit.

Fixes https://gitlab.com/kicad/code/kicad/issues/8616
This commit is contained in:
Jeff Young 2021-07-01 14:28:01 +01:00
parent 201c34345f
commit 24e54178db
2 changed files with 6 additions and 2 deletions

View File

@ -317,6 +317,10 @@ const EDA_RECT SCH_PIN::GetBoundingBox() const
bool SCH_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
// When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has
// no pin number or name. Give it a floor.
aAccuracy = std::max( aAccuracy, GetPenWidth() );
EDA_RECT rect = GetBoundingBox();
return rect.Inflate( aAccuracy ).Contains( aPosition );
}

View File

@ -399,8 +399,8 @@ void ZONE::BuildHashValue( PCB_LAYER_ID aLayer )
bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
// Normally accuracy is zoom-relative, but at high zooms zones can be too hard to select
// so we provide a minimum.
// When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
// lines. Give it a floor.
int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );