Keep pin positions stable when resizing sheet.

Fixes https://gitlab.com/kicad/code/kicad/issues/6196
This commit is contained in:
Jeff Young 2020-10-31 11:48:29 +00:00
parent bddc97df30
commit 92d6988f10
1 changed files with 6 additions and 0 deletions

View File

@ -572,6 +572,10 @@ void EE_POINT_EDITOR::updateParentItem() const
pinEditedCorner( getEditedPointIndex(), sheet->GetMinWidth(), sheet->GetMinHeight(), pinEditedCorner( getEditedPointIndex(), sheet->GetMinWidth(), sheet->GetMinHeight(),
topLeft, topRight, botLeft, botRight, grid_size ); 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->SetPosition( (wxPoint) topLeft );
sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) ); 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(); wxPoint pos = pin->GetPosition();
pos += originDelta;
switch( pin->GetEdge() ) switch( pin->GetEdge() )
{ {
case SHEET_LEFT_SIDE: pos.x = topLeft.x; break; case SHEET_LEFT_SIDE: pos.x = topLeft.x; break;