Pcbnew: Snap to the closest point on graphic polygon border

Fixes https://gitlab.com/kicad/code/kicad/issues/8164
This commit is contained in:
Mikolaj Wielgus 2021-04-09 22:23:34 +02:00 committed by Jon Evans
parent 58dfb6539f
commit 43d8145304
1 changed files with 11 additions and 2 deletions

View File

@ -568,10 +568,19 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
break;
case S_POLYGON:
for( const wxPoint& p : shape->BuildPolyPointsList() )
addAnchor( p, CORNER | SNAPPABLE, shape );
{
SHAPE_LINE_CHAIN lc;
lc.SetClosed( true );
for( const wxPoint& p : shape->BuildPolyPointsList() )
{
addAnchor( p, CORNER | SNAPPABLE, shape );
lc.Append( p );
}
addAnchor( lc.NearestPoint( aRefPos ), OUTLINE, aItem );
break;
}
case S_CURVE:
addAnchor( start, CORNER | SNAPPABLE, shape );