Only draw group boxes when selected.

Also ignore footprint groups when in board editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/6826
This commit is contained in:
Jeff Young 2020-12-23 21:42:55 +00:00
parent caefc9dc91
commit ffe7d2ea49
3 changed files with 16 additions and 18 deletions

View File

@ -232,23 +232,8 @@ bool PCB_GROUP::IsOnLayer( PCB_LAYER_ID aLayer ) const
void PCB_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const
{
// What layer to put bounding box on? change in class_pcb_group.cpp
std::unordered_set<int> layers = { LAYER_ANCHOR }; // for bounding box
for( BOARD_ITEM* item : m_items )
{
int member_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], member_layers_count;
item->ViewGetLayers( member_layers, member_layers_count );
for( int i = 0; i < member_layers_count; i++ )
layers.insert( member_layers[i] );
}
aCount = layers.size();
int i = 0;
for( int layer : layers )
aLayers[i++] = layer;
aCount = 1;
aLayers[0] = LAYER_ANCHOR;
}

View File

@ -1436,6 +1436,10 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
{
if( aLayer == LAYER_ANCHOR )
{
// Draw only when we're selected on our own
if( !aGroup->IsSelected() || ( aGroup->GetParent() && aGroup->GetParent()->IsSelected() ) )
return;
const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR );
EDA_RECT bbox = aGroup->GetBoundingBox();

View File

@ -2457,9 +2457,18 @@ void PCB_SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector
for( int j = 0; j < aCollector.GetCount(); )
{
BOARD_ITEM* item = aCollector[j];
BOARD_ITEM* parent = item->GetParent();
// Ignore footprint groups in board editor
if( !m_isFootprintEditor && parent && parent->Type() == PCB_FOOTPRINT_T )
{
++j;
continue;
}
PCB_GROUP* aTop = PCB_GROUP::TopLevelGroup( item, m_enteredGroup );
if( aTop != NULL )
if( aTop )
{
if( aTop != item )
{