From 8e2ca37edcd6de361cd322a38aed44b4230f52a9 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 68c8551a5e..41b47ed416 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1038,8 +1038,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 dddf5dd1ca..e82d1c2a3b 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1779,7 +1779,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(); }