Ignore hidden text fields when cross-probing
Zoom-to-selection should only show the elements that we can see, so avoiding hidden fields in footprints keeps the zoom window appropriately sized Fixes https://gitlab.com/kicad/code/kicad/-/issues/15245
This commit is contained in:
parent
1882445b40
commit
416033e8e5
|
@ -130,7 +130,7 @@ VECTOR2I SELECTION::GetCenter() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOX2I SELECTION::GetBoundingBox() const
|
BOX2I SELECTION::GetBoundingBox( bool aOnlyVisible ) const
|
||||||
{
|
{
|
||||||
BOX2I bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOX2I EE_SELECTION::GetBoundingBox() const
|
BOX2I EE_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
|
||||||
{
|
{
|
||||||
BOX2I bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
|
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
|
||||||
|
|
||||||
BOX2I GetBoundingBox() const override;
|
BOX2I GetBoundingBox( bool aOnlyVisible = false ) const override;
|
||||||
|
|
||||||
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
|
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
|
||||||
SCH_SCREEN* GetScreen() { return m_screen; }
|
SCH_SCREEN* GetScreen() { return m_screen; }
|
||||||
|
|
|
@ -154,7 +154,7 @@ public:
|
||||||
return GetBoundingBox().GetPosition();
|
return GetBoundingBox().GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual BOX2I GetBoundingBox() const;
|
virtual BOX2I GetBoundingBox( bool aOnlyVisible = false ) const;
|
||||||
|
|
||||||
virtual EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const
|
virtual EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,3 +105,25 @@ const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOX2I PCB_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
|
||||||
|
{
|
||||||
|
BOX2I bbox;
|
||||||
|
|
||||||
|
for( EDA_ITEM* item : m_items )
|
||||||
|
{
|
||||||
|
if( item->Type() == PCB_FOOTPRINT_T )
|
||||||
|
{
|
||||||
|
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
|
||||||
|
|
||||||
|
bbox.Merge( footprint->GetBoundingBox( true, !aOnlyVisible ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bbox.Merge( item->GetBoundingBox() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bbox;
|
||||||
|
}
|
|
@ -32,7 +32,9 @@ class PCB_SELECTION : public SELECTION
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
|
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
|
||||||
|
|
||||||
|
BOX2I GetBoundingBox( bool aOnlyVisible = false ) const override;
|
||||||
|
|
||||||
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
|
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2109,7 +2109,7 @@ void PCB_SELECTION_TOOL::doSyncSelection( const std::vector<BOARD_ITEM*>& aItems
|
||||||
if( aWithNets )
|
if( aWithNets )
|
||||||
selectConnections( aItems );
|
selectConnections( aItems );
|
||||||
|
|
||||||
BOX2I bbox = m_selection.GetBoundingBox();
|
BOX2I bbox = m_selection.GetBoundingBox( true );
|
||||||
|
|
||||||
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue