Allow taking hidden fields into account for symbol unit bounding box
Even the GUI export of svg wasn't taking fields into account which rendered the fields regardless of status
This commit is contained in:
parent
f1f5fff072
commit
6eedbe4a14
|
@ -362,7 +362,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
|
|||
}
|
||||
|
||||
// Get the symbol bounding box to fit the plot page to it
|
||||
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, convert );
|
||||
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, convert, false );
|
||||
PAGE_INFO pageInfo( PAGE_INFO::Custom );
|
||||
pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
|
||||
pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
|
||||
|
|
|
@ -971,7 +971,8 @@ bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums,
|
|||
}
|
||||
|
||||
|
||||
const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||
const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert,
|
||||
bool aIgnoreHiddenFields ) const
|
||||
{
|
||||
BOX2I bBox; // Start with a fresh BOX2I so the Merge algorithm works
|
||||
|
||||
|
@ -988,7 +989,8 @@ const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
|||
if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
|
||||
continue;
|
||||
|
||||
if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
|
||||
if( aIgnoreHiddenFields && ( item.Type() == LIB_FIELD_T )
|
||||
&& !( (LIB_FIELD&) item ).IsVisible() )
|
||||
continue;
|
||||
|
||||
bBox.Merge( item.GetBoundingBox() );
|
||||
|
|
|
@ -214,9 +214,9 @@ public:
|
|||
* @param aConvert = 0, 1 or 2
|
||||
* If aUnit == 0, unit is not used
|
||||
* if aConvert == 0 Convert is non used
|
||||
* Invisible fields are not taken in account
|
||||
* @param aIgnoreHiddenFields default true, ignores any hidden fields
|
||||
**/
|
||||
const BOX2I GetUnitBoundingBox( int aUnit, int aConvert ) const;
|
||||
const BOX2I GetUnitBoundingBox( int aUnit, int aConvert, bool aIgnoreHiddenFields = true ) const;
|
||||
|
||||
/**
|
||||
* Get the symbol bounding box excluding fields.
|
||||
|
|
|
@ -583,7 +583,7 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
|
|||
PAGE_INFO pageTemp = pageSave;
|
||||
|
||||
VECTOR2I symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
|
||||
editFrame->GetConvert() ).GetSize();
|
||||
editFrame->GetConvert(), false ).GetSize();
|
||||
|
||||
// Add a small margin to the plot bounding box
|
||||
pageTemp.SetWidthMils( schIUScale.IUToMils( symbolSize.x * 1.2 ) );
|
||||
|
|
Loading…
Reference in New Issue