From 92d6988f10cde88a7b2b3efec2f4e2f3659653ff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 31 Oct 2020 11:48:29 +0000 Subject: [PATCH] Keep pin positions stable when resizing sheet. Fixes https://gitlab.com/kicad/code/kicad/issues/6196 --- eeschema/tools/ee_point_editor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 4855313cbb..3df446b6de 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -572,6 +572,10 @@ void EE_POINT_EDITOR::updateParentItem() const pinEditedCorner( getEditedPointIndex(), sheet->GetMinWidth(), sheet->GetMinHeight(), topLeft, topRight, botLeft, botRight, grid_size ); + // Pin positions are relative to origin. Attempt to leave them where they + // are if the origin moves. + wxPoint originDelta = sheet->GetPosition() - (wxPoint) topLeft; + sheet->SetPosition( (wxPoint) topLeft ); sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) ); @@ -584,6 +588,8 @@ void EE_POINT_EDITOR::updateParentItem() const { wxPoint pos = pin->GetPosition(); + pos += originDelta; + switch( pin->GetEdge() ) { case SHEET_LEFT_SIDE: pos.x = topLeft.x; break;