Browse Source

CADSTAR Sch: Fix positioning of symbol fields when the symbol is mirrored

The text aligment needs to be rotated and/or mirrored depending on whether
the text field is vertical or horizontal.
6.0.7
Roberto Fernandez Bautista 4 years ago
parent
commit
b6c12b6b55
  1. 21
      eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp

21
eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp

@ -1827,20 +1827,15 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(
if( aIsMirrored )
{
// In KiCad, the angle of the symbol instance affects the position of the symbol
// fields because there is a distinction on x-axis and y-axis mirroring
double angleDeciDeg = NormalizeAnglePos( aComponentOrientationDeciDeg );
int quadrant = KiROUND( angleDeciDeg / 900.0 );
quadrant %= 4;
// We need to change the aligment when the symbol is mirrored based on the text orientation
// To ensure the anchor point is the same in KiCad.
switch( quadrant )
{
case 1:
case 3: alignment = rotate180( alignment ); KI_FALLTHROUGH;
case 0:
case 2: alignment = mirrorX( alignment ); break;
default: wxFAIL_MSG( "unknown quadrant" ); break;
}
int textIsVertical = KiROUND( textAngle / 900.0 ) % 2;
if( textIsVertical )
alignment = rotate180( alignment );
alignment = mirrorX( alignment );
}
applyTextSettings( aKiCadField,

Loading…
Cancel
Save