Eeschema: Make SCH_VIEW::GetItemsExtents() ignore invisible text
CHANGED: SCH_VIEW::GetItemsExtents() returns a bbox of all visible items but ignores the page and border. It was taking invisible strings into account when calculating the bbox, and now it doesn't. Makes "Fit to Objects" work correctly with all components that have hidden text. Fixes https://gitlab.com/kicad/code/kicad/issues/5726
This commit is contained in:
parent
8f01771138
commit
ca2252686a
|
@ -25,6 +25,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <core/typeinfo.h>
|
||||
#include <memory>
|
||||
#include <view/view.h>
|
||||
#include <view/view_group.h>
|
||||
|
@ -87,8 +88,17 @@ const BOX2I SCH_VIEW::GetItemsExtents() const
|
|||
|
||||
for( EDA_ITEM* item : m_frame->GetScreen()->Items() )
|
||||
{
|
||||
if( item != m_worksheet.get() )
|
||||
bBoxItems.Merge( item->GetBoundingBox() );
|
||||
if( item != m_worksheet.get() ) // Ignore the worksheet itself
|
||||
{
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
// For components we need to get the bounding box without invisible text
|
||||
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
|
||||
bBoxItems.Merge( comp->GetBoundingBox( false ) );
|
||||
}
|
||||
else
|
||||
bBoxItems.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
|
||||
return bBoxItems;
|
||||
|
|
Loading…
Reference in New Issue