From 19c643b29ac629c3d4fe0ac74faa862423d98b16 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 5 Nov 2019 06:20:50 -0800 Subject: [PATCH] pcbnew: Prevent extra selection We want to avoid selecting items that are disabled in the item list. Our standard method is in the GetViewLOD() that performs both size and visibility. This extends the check to module text and via. Fixes: lp:1851133 * https://bugs.launchpad.net/kicad/+bug/1851133 --- pcbnew/class_track.cpp | 29 ++++++++++++++++++++++++++++- pcbnew/tools/selection_tool.cpp | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 09c82a2d09..8b82142ae7 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -738,8 +738,35 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const BOARD* board = GetBoard(); // Only draw the via if at least one of the layers it crosses is being displayed - if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any() ) + if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any() + && aView->IsLayerVisible( LAYER_VIAS ) ) + { + switch( m_ViaType ) + { + case VIA_THROUGH: + if( !aView->IsLayerVisible( LAYER_VIA_THROUGH ) ) + return HIDE; + + break; + + case VIA_BLIND_BURIED: + if( !aView->IsLayerVisible( LAYER_VIA_BBLIND ) ) + return HIDE; + + break; + + case VIA_MICROVIA: + if( !aView->IsLayerVisible( LAYER_VIA_MICROVIA ) ) + return HIDE; + + break; + + default: + break; + } + return 0; + } return HIDE; } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 3abb01b89c..800e11850a 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1666,7 +1666,8 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn } // All other items are selected only if the layer on which they exist is visible - return board()->IsLayerVisible( aItem->GetLayer() ); + return board()->IsLayerVisible( aItem->GetLayer() ) + && aItem->ViewGetLOD( aItem->GetLayer(), view() ) < view()->GetScale(); }