pcbnew: Check all layers for routing snaps
Flipped footprint pads may report their "primary" layer as not the front
layer in high contrast. We need to check whether the board item for
snaps is visible on the active layers.
Fixes: lp:1847877
* https://bugs.launchpad.net/kicad/+bug/1847877
(cherry picked from commit 07c8596084
)
This commit is contained in:
parent
3bc3193805
commit
17c0b3e460
|
@ -1008,15 +1008,33 @@ bool PNS_KICAD_IFACE::IsAnyLayerVisible( const LAYER_RANGE& aLayer )
|
|||
|
||||
bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem )
|
||||
{
|
||||
if( !m_view )
|
||||
if( !m_view || !aItem->Parent() )
|
||||
return false;
|
||||
|
||||
auto item = aItem->Parent();
|
||||
auto activeLayers = m_view->GetPainter()->GetSettings()->GetActiveLayers();
|
||||
bool isHighContrast = m_view->GetPainter()->GetSettings()->GetHighContrast();
|
||||
bool isOnVisibleLayer = true;
|
||||
|
||||
if( item && m_view->IsVisible( item )
|
||||
&& ( !isHighContrast || activeLayers.count( item->GetLayer() ) )
|
||||
if( m_view->GetPainter()->GetSettings()->GetHighContrast() )
|
||||
{
|
||||
int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
|
||||
int layers_count;
|
||||
auto activeLayers = m_view->GetPainter()->GetSettings()->GetActiveLayers();
|
||||
|
||||
isOnVisibleLayer = false;
|
||||
item->ViewGetLayers( layers, layers_count );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
{
|
||||
// Item is on at least one of the active layers
|
||||
if( activeLayers.count( layers[i] ) > 0 )
|
||||
{
|
||||
isOnVisibleLayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_view->IsVisible( item ) && isOnVisibleLayer
|
||||
&& item->ViewGetLOD( item->GetLayer(), m_view ) < m_view->GetScale() )
|
||||
return true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue