pcbnew: Fix polygon hittest

Previous version had minimum width to account for it being difficult to
click on small lines.  This should not be used for filled polygons

Fixes: lp:1808141
* https://bugs.launchpad.net/kicad/+bug/1808141
This commit is contained in:
Seth Hillbrand 2018-12-12 17:23:40 -08:00
parent 4ff9d2f5e4
commit 5c5979dfc6
1 changed files with 3 additions and 5 deletions

View File

@ -640,17 +640,15 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
case S_POLYGON:
{
#define MAX_DIST_IN_MM 0.25
int distmax = std::max( m_Width, Millimeter2iu( MAX_DIST_IN_MM ) );
if( !IsPolygonFilled() )
{
SHAPE_POLY_SET::VERTEX_INDEX i;
auto poly = m_Poly; //todo: Fix CollideEdge to be const
return poly.CollideEdge(VECTOR2I( aPosition ), i, distmax );
return poly.CollideEdge(VECTOR2I( aPosition ), i,
std::max( m_Width / 2, Millimeter2iu( 0.25 ) ) );
}
else
return m_Poly.Collide( VECTOR2I( aPosition ), distmax );
return m_Poly.Collide( VECTOR2I( aPosition ), m_Width / 2 );
}
break;