Pcbnew: fix Swap command that improperly rotates footprints when flipping.

Fixes #16025
https://gitlab.com/kicad/code/kicad/-/issues/16025
This commit is contained in:
jean-pierre charras 2023-11-05 15:09:48 +01:00
parent 2deee01592
commit 3195ba646f
1 changed files with 4 additions and 1 deletions

View File

@ -154,6 +154,10 @@ int EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
FOOTPRINT* aFP = static_cast<FOOTPRINT*>( a );
FOOTPRINT* bFP = static_cast<FOOTPRINT*>( b );
// Store initial orientation of footprints, before flipping them.
EDA_ANGLE aAngle = aFP->GetOrientation();
EDA_ANGLE bAngle = bFP->GetOrientation();
// Flip both if needed
if( aFP->IsFlipped() != bFP->IsFlipped() )
{
@ -162,7 +166,6 @@ int EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
}
// Set orientation
EDA_ANGLE aAngle = aFP->GetOrientation(), bAngle = bFP->GetOrientation();
std::swap( aAngle, bAngle );
aFP->SetOrientation( aAngle );
bFP->SetOrientation( bAngle );