Footprint editor: Graphic polygon don't follow footprint when moving reference anchor

Fixes: lp:1755042
https://bugs.launchpad.net/kicad/+bug/1755042
This commit is contained in:
jean-pierre charras 2018-03-12 13:17:22 +01:00
parent 243ce6979b
commit d64c89d964
1 changed files with 16 additions and 3 deletions

View File

@ -1184,9 +1184,22 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item ); EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->m_Start0 += moveVector;
edge->m_End0 += moveVector; // Polygonal shape coordinates are specific:
edge->SetDrawCoord(); // m_Start0 and m_End0 have no meaning. So we have to move corner positions
if( edge->GetShape() == S_POLYGON )
{
for( auto iter = edge->GetPolyShape().Iterate(); iter; iter++ )
{
(*iter) += VECTOR2I( moveVector );
}
}
else
{
edge->m_Start0 += moveVector;
edge->m_End0 += moveVector;
edge->SetDrawCoord();
}
break; break;
} }