From 9ea96ee64ef987ae187009d435204351beca494f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 7 Sep 2020 21:14:37 +0100 Subject: [PATCH] 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). --- pcbnew/tools/selection_tool.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 4aad6e8649..d6000a5393 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -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( pad_layers[i] ) ) ) ) - { - draw_layer_visible = true; - } - } - - return draw_layer_visible; + return ( pad->GetLayerSet() & board()->GetVisibleLayers() ).any(); } break;