PANEL_EESCHEMA_COLOR_SETTINGS: fix incorrect symbol drawing.

Graphics items were not modified when the LIB_SYMBOL Y axis orientation was
modified, making the symbol body not visible in panel canvas.
This commit is contained in:
jean-pierre charras 2024-05-25 17:49:46 +02:00
parent 808517dd74
commit 3065ae1f01
1 changed files with 7 additions and 6 deletions

View File

@ -353,22 +353,23 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
auto mapLibItemPosition = auto mapLibItemPosition =
[]( const VECTOR2I& aLibPosition ) -> VECTOR2I []( const VECTOR2I& aLibPosition ) -> VECTOR2I
{ {
return VECTOR2I( aLibPosition.x, -aLibPosition.y ); // Currently, the mapping is a no-op.
return VECTOR2I( aLibPosition.x, aLibPosition.y );
}; };
LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString ); LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
VECTOR2I p( 2625, -1600 ); VECTOR2I p( 2625, 1600 );
SCH_FIELD& ref = symbol->GetReferenceField(); SCH_FIELD& ref = symbol->GetReferenceField();
ref.SetText( wxT( "U1" ) ); ref.SetText( wxT( "U1" ) );
ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) ); ref.SetPosition( MILS_POINT( p.x + 30, p.y - 260 ) );
ref.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); ref.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
SCH_FIELD& value = symbol->GetValueField(); SCH_FIELD& value = symbol->GetValueField();
value.SetText( wxT( "OPA604" ) ); value.SetText( wxT( "OPA604" ) );
value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) ); value.SetPosition( MILS_POINT( p.x + 30, p.y - 180 ) );
value.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); value.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
symbol->SetShowPinNames( true ); symbol->SetShowPinNames( true );
@ -391,7 +392,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
SCH_PIN* pin = new SCH_PIN( symbol ); SCH_PIN* pin = new SCH_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 300, p.y + 100 ) ); pin->SetPosition( MILS_POINT( p.x - 300, p.y - 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) ); pin->SetLength( schIUScale.MilsToIU( 100 ) );
pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT ); pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT );
pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT ); pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
@ -405,7 +406,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin = new SCH_PIN( symbol ); pin = new SCH_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 300, p.y - 100 ) ); pin->SetPosition( MILS_POINT( p.x - 300, p.y + 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) ); pin->SetLength( schIUScale.MilsToIU( 100 ) );
pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT ); pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT );
pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT ); pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );