diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 0906c7be82..7ceb96ab8e 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -883,7 +883,8 @@ void LIB_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const } -const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins ) const +const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins, + bool aIncludePrivateItems ) const { EDA_RECT bbox; @@ -895,6 +896,9 @@ const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIn if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert ) continue; + if( item.IsPrivate() && !aIncludePrivateItems ) + continue; + if( item.Type() == LIB_FIELD_T ) continue; diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index 21ca5c2965..294eb7c3d7 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -219,7 +219,8 @@ public: * if aConvert == 0 Convert is non used * Fields are not taken in account **/ - const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins ) const; + const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins, + bool aIncludePrivateItems ) const; const EDA_RECT GetBoundingBox() const override { diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index b425cab2b2..3d8fd87894 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1315,9 +1315,9 @@ EDA_RECT SCH_SYMBOL::doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) EDA_RECT bBox; if( m_part ) - bBox = m_part->GetBodyBoundingBox( m_unit, m_convert, aIncludePins ); + bBox = m_part->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false ); else - bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert, aIncludePins ); + bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false ); int x0 = bBox.GetX(); int xm = bBox.GetRight();