Use parent's transform when moving SCH_FIELDs.

Fixes: lp:1827873
* https://bugs.launchpad.net/kicad/+bug/1827873
This commit is contained in:
Jeff Young 2019-05-06 16:58:53 +01:00
parent b97d65e791
commit a76bcc204f
2 changed files with 8 additions and 3 deletions

View File

@ -539,7 +539,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
wxPoint pos = ( (SCH_COMPONENT*) GetParent() )->GetPosition(); wxPoint pos = ( (SCH_COMPONENT*) GetParent() )->GetPosition();
// Actual positions are calculated by the rotation/mirror transform of the // Actual positions are calculated by the rotation/mirror transform of the
// parent component of the field. The inverse transfrom is used to calculate // parent component of the field. The inverse transform is used to calculate
// the position relative to the parent component. // the position relative to the parent component.
wxPoint pt = aPosition - pos; wxPoint pt = aPosition - pos;

View File

@ -579,9 +579,14 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta, bool isDrag )
case SCH_PIN_T: case SCH_PIN_T:
case SCH_FIELD_T: case SCH_FIELD_T:
static_cast<SCH_ITEM*>( aItem )->Move( wxPoint( aDelta.x, -aDelta.y ) ); {
break; SCH_COMPONENT* component = (SCH_COMPONENT*) aItem->GetParent();
TRANSFORM transform = component->GetTransform().InverseTransform();
wxPoint transformedDelta = transform.TransformCoordinate( (wxPoint) aDelta );
static_cast<SCH_ITEM*>( aItem )->Move( transformedDelta );
break;
}
default: default:
static_cast<SCH_ITEM*>( aItem )->Move( (wxPoint) aDelta ); static_cast<SCH_ITEM*>( aItem )->Move( (wxPoint) aDelta );
break; break;