Handle justification for vertical text when mirroring.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15036
This commit is contained in:
parent
afb050a67f
commit
f098405218
|
@ -526,19 +526,8 @@ void SCH_LABEL_BASE::MirrorHorizontally( int aCenter )
|
||||||
|
|
||||||
for( SCH_FIELD& field : m_fields )
|
for( SCH_FIELD& field : m_fields )
|
||||||
{
|
{
|
||||||
switch( field.GetHorizJustify() )
|
if( field.GetTextAngle() == ANGLE_HORIZONTAL )
|
||||||
{
|
field.FlipHJustify();
|
||||||
case GR_TEXT_H_ALIGN_LEFT:
|
|
||||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GR_TEXT_H_ALIGN_CENTER:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GR_TEXT_H_ALIGN_RIGHT:
|
|
||||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
VECTOR2I pos = field.GetTextPos();
|
VECTOR2I pos = field.GetTextPos();
|
||||||
VECTOR2I delta = old_pos - pos;
|
VECTOR2I delta = old_pos - pos;
|
||||||
|
@ -556,6 +545,9 @@ void SCH_LABEL_BASE::MirrorVertically( int aCenter )
|
||||||
|
|
||||||
for( SCH_FIELD& field : m_fields )
|
for( SCH_FIELD& field : m_fields )
|
||||||
{
|
{
|
||||||
|
if( field.GetTextAngle() == ANGLE_VERTICAL )
|
||||||
|
field.FlipHJustify();
|
||||||
|
|
||||||
VECTOR2I pos = field.GetTextPos();
|
VECTOR2I pos = field.GetTextPos();
|
||||||
VECTOR2I delta = old_pos - pos;
|
VECTOR2I delta = old_pos - pos;
|
||||||
pos.y = GetPosition().y + delta.y;
|
pos.y = GetPosition().y + delta.y;
|
||||||
|
|
|
@ -76,15 +76,6 @@ VECTOR2I SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_TEXT::FlipHJustify()
|
|
||||||
{
|
|
||||||
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
|
||||||
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
|
||||||
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
|
|
||||||
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_TEXT::MirrorHorizontally( int aCenter )
|
void SCH_TEXT::MirrorHorizontally( int aCenter )
|
||||||
{
|
{
|
||||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||||
|
|
|
@ -106,7 +106,6 @@ public:
|
||||||
EDA_TEXT::Offset( aMoveVector );
|
EDA_TEXT::Offset( aMoveVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlipHJustify();
|
|
||||||
void MirrorHorizontally( int aCenter ) override;
|
void MirrorHorizontally( int aCenter ) override;
|
||||||
void MirrorVertically( int aCenter ) override;
|
void MirrorVertically( int aCenter ) override;
|
||||||
void Rotate( const VECTOR2I& aCenter ) override;
|
void Rotate( const VECTOR2I& aCenter ) override;
|
||||||
|
|
|
@ -165,6 +165,14 @@ public:
|
||||||
void SetKeepUpright( bool aKeepUpright );
|
void SetKeepUpright( bool aKeepUpright );
|
||||||
bool IsKeepUpright() const { return m_attributes.m_KeepUpright; }
|
bool IsKeepUpright() const { return m_attributes.m_KeepUpright; }
|
||||||
|
|
||||||
|
void FlipHJustify()
|
||||||
|
{
|
||||||
|
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||||
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||||
|
else if( GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
|
||||||
|
SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the text attributes from another instance.
|
* Set the text attributes from another instance.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue