Restore PointCloserThan() behaviour to really be "closer than".

Change calls which really want it to be "closer than or equal" to
distance + 1.

Fixes: lp:1843329
* https://bugs.launchpad.net/kicad/+bug/1843329

(cherry picked from commit 25fa2131d2)
This commit is contained in:
Jeff Young 2019-09-10 10:56:11 +01:00
parent cf968cb6b5
commit f1436cec9b
2 changed files with 3 additions and 3 deletions

View File

@ -40,9 +40,9 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
SEG::ecoord t = d.Dot( aP - A );
if( t <= 0 || !l_squared )
return ( aP - A ).SquaredEuclideanNorm() <= dist_sq;
return ( aP - A ).SquaredEuclideanNorm() < dist_sq;
else if( t >= l_squared )
return ( aP - B ).SquaredEuclideanNorm() <= dist_sq;
return ( aP - B ).SquaredEuclideanNorm() < dist_sq;
int dxdy = abs( d.x ) - abs( d.y );

View File

@ -153,7 +153,7 @@ bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int
return std::abs( delta.y ) <= aDist;
SEG segment( aStart, aEnd );
return segment.PointCloserThan( aRefPoint, aDist );
return segment.PointCloserThan( aRefPoint, aDist + 1 );
}