Mirror sheet fields when mirroring sheet.

Fixes https://gitlab.com/kicad/code/kicad/issues/9479
This commit is contained in:
Jeff Young 2021-10-28 21:44:58 +01:00
parent 0cdffa16d4
commit fe6cb7dbb4
2 changed files with 21 additions and 1 deletions

View File

@ -781,21 +781,41 @@ void SCH_SHEET::Rotate( const wxPoint& aCenter )
void SCH_SHEET::MirrorVertically( int aCenter )
{
int dy = m_pos.y;
MIRROR( m_pos.y, aCenter );
m_pos.y -= m_size.y;
dy -= m_pos.y; // 0,dy is the move vector for this transform
for( SCH_SHEET_PIN* sheetPin : m_pins )
sheetPin->MirrorVertically( aCenter );
for( SCH_FIELD& field : m_fields )
{
wxPoint pos = field.GetTextPos();
pos.y -= dy;
field.SetTextPos( pos );
}
}
void SCH_SHEET::MirrorHorizontally( int aCenter )
{
int dx = m_pos.x;
MIRROR( m_pos.x, aCenter );
m_pos.x -= m_size.x;
dx -= m_pos.x; // dx,0 is the move vector for this transform
for( SCH_SHEET_PIN* sheetPin : m_pins )
sheetPin->MirrorHorizontally( aCenter );
for( SCH_FIELD& field : m_fields )
{
wxPoint pos = field.GetTextPos();
pos.x -= dx;
field.SetTextPos( pos );
}
}

View File

@ -1467,7 +1467,7 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
SetOrientation( SYM_MIRROR_X );
MIRROR( m_pos.y, aCenter );
dy -= m_pos.y; // dy,0 is the move vector for this transform
dy -= m_pos.y; // 0,dy is the move vector for this transform
for( SCH_FIELD& field : m_fields )
{