Don't walk text/labels when mirroring

We have a fixed bottom-align for the text and labels in eeschema.
Therefore, mirroring vertically needs to account for the text's offset
from the bounding box center.

Fixes https://gitlab.com/kicad/code/kicad/issues/9208
This commit is contained in:
Seth Hillbrand 2021-09-22 09:23:00 -07:00
parent 16ec6fbec4
commit 3b04b602d9
1 changed files with 15 additions and 0 deletions

View File

@ -792,6 +792,21 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
pin->MirrorHorizontally( sheet->GetBoundingBox().GetCenter().x );
}
}
else if( item->Type() == SCH_TEXT_T || item->Type() == SCH_LABEL_T )
{
/// Text and Labels are aligned to their bottom right corners and we don't flip the
/// alignment corner, so we need to offset this in the vertical direction
wxPoint textMirrorPoint = mirrorPoint;
textMirrorPoint.y += item->GetBoundingBox().GetHeight() / 2;
textMirrorPoint = m_frame->GetNearestHalfGridPosition( textMirrorPoint );
if( vertical )
item->MirrorVertically( textMirrorPoint.y );
else
item->MirrorHorizontally( textMirrorPoint.x );
}
else
{
if( vertical )