From 5a0db6802a0fd3e20ca7f8c5ebb972177ec5bbbb Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 24 Aug 2020 20:18:33 +0100 Subject: [PATCH] Use IsOnLayer(); GetViewLayers() now returns synthetic ZONE layers. Also uses IsPadOnLayer() for pads so that it will drop layers which have had their pads removed. Fixes https://gitlab.com/kicad/code/kicad/issues/5349 --- pcbnew/tools/selection_tool.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 7742bb8580..96c6046108 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1765,26 +1765,26 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn if( settings->GetHighContrast() ) { - int itemLayers[KIGFX::VIEW::VIEW_MAX_LAYERS], layers_count; std::set activeLayers = settings->GetActiveLayers(); + bool onActiveLayer = false; - aItem->ViewGetLayers( itemLayers, layers_count ); - - bool onActive = false; // Is the item on any of active layers? - - for( int i = 0; i < layers_count; ++i ) + for( unsigned int layer : activeLayers ) { - if( activeLayers.count( itemLayers[i] ) > 0 ) // Item is on at least one of the active layers + if( aItem->Type() == PCB_PAD_T + && static_cast( aItem )->IsPadOnLayer( layer ) ) { - onActive = true; + onActiveLayer = true; + break; + } + else if( aItem->IsOnLayer( ToLAYER_ID( layer ) ) ) + { + onActiveLayer = true; break; } } - if( !onActive ) // We do not want to select items that are in the background - { + if( !onActiveLayer ) // We do not want to select items that are in the background return false; - } } switch( aItem->Type() )