Update pad layer testing for selectability.

My only guess is the old code predated the introduction of
GetLayerSet().  In any case it was long-winded and still didn't
catch the case of being on copper layers other than front or back
(which might be hidden).
This commit is contained in:
Jeff Young 2020-09-07 21:14:37 +01:00
parent e0f08338a8
commit 9ea96ee64e
1 changed files with 1 additions and 26 deletions

View File

@ -1921,32 +1921,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
}
// Otherwise, pads are selectable if any draw layer is visible
// Shortcut: check copper layer visibility
if( board()->IsLayerVisible( F_Cu ) && pad->IsOnLayer( F_Cu ) )
return true;
if( board()->IsLayerVisible( B_Cu ) && pad->IsOnLayer( B_Cu ) )
return true;
// Now check the non-copper layers
bool draw_layer_visible = false;
int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
pad->ViewGetLayers( pad_layers, pad_layers_count );
for( int i = 0; i < pad_layers_count; ++i )
{
// NOTE: Only checking the regular layers (not GAL meta-layers)
if( ( ( pad_layers[i] < PCB_LAYER_ID_COUNT ) &&
board()->IsLayerVisible( static_cast<PCB_LAYER_ID>( pad_layers[i] ) ) ) )
{
draw_layer_visible = true;
}
}
return draw_layer_visible;
return ( pad->GetLayerSet() & board()->GetVisibleLayers() ).any();
}
break;