From d64c89d964c4574ca079437494ed121d52074300 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 12 Mar 2018 13:17:22 +0100 Subject: [PATCH] Footprint editor: Graphic polygon don't follow footprint when moving reference anchor Fixes: lp:1755042 https://bugs.launchpad.net/kicad/+bug/1755042 --- pcbnew/class_module.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 4de37d7641..515dceefeb 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1184,9 +1184,22 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) case PCB_MODULE_EDGE_T: { EDGE_MODULE* edge = static_cast( item ); - edge->m_Start0 += moveVector; - edge->m_End0 += moveVector; - edge->SetDrawCoord(); + + // Polygonal shape coordinates are specific: + // 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; }