PCB Fields: fix v7 imported board hidden description field pos
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17684
This commit is contained in:
parent
1aa59b806c
commit
e2f1da60d9
|
@ -3224,6 +3224,7 @@ void PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText )
|
||||||
FOOTPRINT* parentFP = dynamic_cast<FOOTPRINT*>( aText->GetParent() );
|
FOOTPRINT* parentFP = dynamic_cast<FOOTPRINT*>( aText->GetParent() );
|
||||||
bool hasAngle = false; // Old files do not have a angle specified.
|
bool hasAngle = false; // Old files do not have a angle specified.
|
||||||
// in this case it is 0 expected to be 0
|
// in this case it is 0 expected to be 0
|
||||||
|
bool hasPos = false;
|
||||||
|
|
||||||
// By default, texts in footprints have a locked rotation (i.e. rot = -90 ... 90 deg)
|
// By default, texts in footprints have a locked rotation (i.e. rot = -90 ... 90 deg)
|
||||||
if( parentFP )
|
if( parentFP )
|
||||||
|
@ -3240,6 +3241,7 @@ void PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText )
|
||||||
{
|
{
|
||||||
VECTOR2I pt;
|
VECTOR2I pt;
|
||||||
|
|
||||||
|
hasPos = true;
|
||||||
pt.x = parseBoardUnits( "X coordinate" );
|
pt.x = parseBoardUnits( "X coordinate" );
|
||||||
pt.y = parseBoardUnits( "Y coordinate" );
|
pt.y = parseBoardUnits( "Y coordinate" );
|
||||||
aText->SetTextPos( pt );
|
aText->SetTextPos( pt );
|
||||||
|
@ -3346,7 +3348,12 @@ void PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText )
|
||||||
|
|
||||||
// Move and rotate the text to its board coordinates
|
// Move and rotate the text to its board coordinates
|
||||||
aText->Rotate( { 0, 0 }, parentFP->GetOrientation() );
|
aText->Rotate( { 0, 0 }, parentFP->GetOrientation() );
|
||||||
aText->Move( parentFP->GetPosition() );
|
|
||||||
|
// Only move offset from parent position if we read a position from the file.
|
||||||
|
// These positions are relative to the parent footprint. If we don't have a position
|
||||||
|
// then the text defaults to the parent position and moving again will double it.
|
||||||
|
if (hasPos)
|
||||||
|
aText->Move( parentFP->GetPosition() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ PCB_TEXT::PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PCB_TEXT::PCB_TEXT( FOOTPRINT* aParent ) :
|
PCB_TEXT::PCB_TEXT( FOOTPRINT* aParent, KICAD_T idtype) :
|
||||||
BOARD_ITEM( aParent, PCB_TEXT_T ),
|
BOARD_ITEM( aParent, idtype ),
|
||||||
EDA_TEXT( pcbIUScale )
|
EDA_TEXT( pcbIUScale )
|
||||||
{
|
{
|
||||||
SetKeepUpright( true );
|
SetKeepUpright( true );
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PCB_TEXT : public BOARD_ITEM, public EDA_TEXT
|
||||||
public:
|
public:
|
||||||
PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype = PCB_TEXT_T );
|
PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype = PCB_TEXT_T );
|
||||||
|
|
||||||
PCB_TEXT( FOOTPRINT* aParent );
|
PCB_TEXT( FOOTPRINT* aParent, KICAD_T idtype = PCB_TEXT_T );
|
||||||
|
|
||||||
// Do not create a copy constructor & operator=.
|
// Do not create a copy constructor & operator=.
|
||||||
// The ones generated by the compiler are adequate.
|
// The ones generated by the compiler are adequate.
|
||||||
|
|
Loading…
Reference in New Issue