SCH_GLOBALLABEL: fix broken position of IREF, creating a broken bounding box.
Note also the bounding box is too large when the IREF is not shown, because IREF is always included, even if not shown. Fixes #7864 https://gitlab.com/kicad/code/kicad/issues/7864
This commit is contained in:
parent
068e85c567
commit
d295b5d6de
|
@ -165,7 +165,7 @@ bool SCH_TEXT::IncrementLabel( int aIncrement )
|
|||
{
|
||||
wxString text = GetText();
|
||||
bool ReturnVal = IncrementLabelMember( text, aIncrement );
|
||||
|
||||
|
||||
if( ReturnVal )
|
||||
SetText( text );
|
||||
|
||||
|
@ -1105,7 +1105,7 @@ void SCH_GLOBALLABEL::UpdateIntersheetRefProps()
|
|||
void SCH_GLOBALLABEL::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
||||
{
|
||||
int margin = GetTextOffset();
|
||||
int labelLen = GetBoundingBox().GetSizeMax();
|
||||
int labelLen = GetBoundingBoxBase().GetSizeMax();
|
||||
int penOffset = GetPenWidth() / 2;
|
||||
|
||||
// Set both axes to penOffset; we're going to overwrite the text axis below
|
||||
|
@ -1296,8 +1296,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
|
||||
const EDA_RECT SCH_GLOBALLABEL::GetBoundingBoxBase() const
|
||||
{
|
||||
// build the bounding box on the global label only, without taking in account
|
||||
// the intersheets references, just the bounding box of the graphic shape
|
||||
int x = GetTextPos().x;
|
||||
int y = GetTextPos().y;
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
@ -1339,6 +1341,18 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
|
|||
|
||||
EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) );
|
||||
|
||||
box.Normalize();
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
|
||||
{
|
||||
// build the bounding box on the global label only, including the intersheets references
|
||||
// full bounding box
|
||||
|
||||
EDA_RECT box( GetBoundingBoxBase() );
|
||||
|
||||
box.Merge( m_intersheetRefsField.GetBoundingBox() );
|
||||
|
||||
box.Normalize();
|
||||
|
|
|
@ -413,6 +413,15 @@ public:
|
|||
|
||||
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
|
||||
|
||||
/**
|
||||
* Returns the bounding box on the global label only, without taking in account
|
||||
* the intersheets references
|
||||
*/
|
||||
const EDA_RECT GetBoundingBoxBase() const;
|
||||
|
||||
/**
|
||||
* Returns the bounding box on the global label only, including the intersheets references
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
|
||||
|
|
Loading…
Reference in New Issue