Handle orientation when pasting footprint items.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17518

(cherry picked from commit 94223ca794)
This commit is contained in:
Jeff Young 2024-05-03 21:30:46 +01:00
parent 1ef916086d
commit 48f14d6dea
1 changed files with 5 additions and 2 deletions

View File

@ -739,8 +739,8 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
aClipFootprint->Pads().clear(); aClipFootprint->Pads().clear();
// Not all graphic items can be added to the current footprint: // Not all items can be added to the current footprint: mandatory fields are already existing
// mandatory fields are already existing in the current footprint. // in the current footprint.
// //
for( PCB_FIELD* field : aClipFootprint->Fields() ) for( PCB_FIELD* field : aClipFootprint->Fields() )
{ {
@ -776,6 +776,9 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
text->SetTextAngle( text->GetTextAngle() + editorFootprint->GetOrientation() ); text->SetTextAngle( text->GetTextAngle() + editorFootprint->GetOrientation() );
} }
item->Rotate( item->GetPosition(), -aClipFootprint->GetOrientation() );
item->Rotate( item->GetPosition(), editorFootprint->GetOrientation() );
VECTOR2I pos = item->GetFPRelativePosition(); VECTOR2I pos = item->GetFPRelativePosition();
item->SetParent( editorFootprint ); item->SetParent( editorFootprint );
item->SetFPRelativePosition( pos ); item->SetFPRelativePosition( pos );