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
This commit is contained in:
Seth Hillbrand 2019-11-05 06:20:50 -08:00
parent 8fb6bcc8b1
commit 8e2ca37edc
2 changed files with 30 additions and 2 deletions

View File

@ -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;
}

View File

@ -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();
}