From 69ceae0ccf9d2c50a13db54b1942b9d2691a1935 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 20 Dec 2017 16:16:46 +0100 Subject: [PATCH] Selection tool: do not select relatively large modules To avoid situations when a large footprint covering most of the board area (e.g. shield connector) is always selected, even when user clicks in a seemingly empty spot, a simple filter has been added. In case the footprint area covers more than 90% of the view area, the large footprint is not selected. This way large footprints do not disturb editing when the zoom is high enough. Fixes: lp:1636214 * https://bugs.launchpad.net/kicad/+bug/1636214 --- pcbnew/tools/selection_tool.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index cd6ba3526d..fd53cb04cf 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -599,7 +599,6 @@ bool SELECTION_TOOL::selectMultiple() else select( item ); } - } } @@ -1496,13 +1495,19 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const break; case PCB_MODULE_T: - + { // In the module editor, we do not want to select the module itself // rather, the module sub-components should be selected individually if( m_editModules ) - { return false; - } + + float viewArea = getView()->GetViewport().GetArea(); + float modArea = aItem->ViewBBox().GetArea(); + + // Do not select modules that cover more than 90% of the view area + // (most likely footprints representing shield connectors) + if( viewArea > 0.0 && modArea / viewArea > 0.9 ) + return false; if( aItem->IsOnLayer( F_Cu ) && board()->IsElementVisible( LAYER_MOD_FR ) ) return !m_editModules; @@ -1513,6 +1518,7 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const return false; break; + } case PCB_MODULE_TEXT_T: if( m_multiple && !m_editModules )