One more attempt to fix flipping geometry.

Fixes https://gitlab.com/kicad/code/kicad/issues/4480
This commit is contained in:
Jeff Young 2021-01-18 14:29:55 +00:00
parent 50e22de3ba
commit 4f399d4304
1 changed files with 11 additions and 9 deletions

View File

@ -179,20 +179,22 @@ void PCB_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
std::swap( top, bottom ); std::swap( top, bottom );
} }
// Now put the text back in it (these look backwards but remember that out text will // Now put the text back in its bounding box
// be mirrored when all is said and done)
switch( GetHorizJustify() ) switch( GetHorizJustify() )
{ {
case GR_TEXT_HJUSTIFY_LEFT: SetTextX( right ); break; case GR_TEXT_HJUSTIFY_LEFT: SetTextX( IsMirrored() ? left : right ); break;
case GR_TEXT_HJUSTIFY_CENTER: SetTextX( ( left + right ) / 2 ); break; case GR_TEXT_HJUSTIFY_CENTER: SetTextX( ( left + right ) / 2 ); break;
case GR_TEXT_HJUSTIFY_RIGHT: SetTextX( left ); break; case GR_TEXT_HJUSTIFY_RIGHT: SetTextX( IsMirrored() ? right : left ); break;
} }
switch( GetVertJustify() ) if( !aFlipLeftRight )
{ {
case GR_TEXT_VJUSTIFY_TOP: SetTextY( bottom ); break; switch( GetVertJustify() )
case GR_TEXT_VJUSTIFY_CENTER: SetTextY( ( top + bottom ) / 2 ); break; {
case GR_TEXT_VJUSTIFY_BOTTOM: SetTextY( top ); break; case GR_TEXT_VJUSTIFY_TOP: SetTextY( bottom ); break;
case GR_TEXT_VJUSTIFY_CENTER: SetTextY( ( top + bottom ) / 2 ); break;
case GR_TEXT_VJUSTIFY_BOTTOM: SetTextY( top ); break;
}
} }
// And restore orientation // And restore orientation