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
This commit is contained in:
Maciej Suminski 2017-12-20 16:16:46 +01:00
parent a061fe1f99
commit 69ceae0ccf
1 changed files with 10 additions and 4 deletions

View File

@ -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 )