Rework high contrast for pads/vias slightly

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6923
This commit is contained in:
Jon Evans 2021-01-26 21:01:48 -05:00
parent df62adf901
commit 30f3a7d124
1 changed files with 16 additions and 10 deletions

View File

@ -346,22 +346,28 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
// m_highContrastLayers, but it's not sufficiently fine-grained as it can't differentiate // m_highContrastLayers, but it's not sufficiently fine-grained as it can't differentiate
// between (for instance) a via which is flashed on the primary layer and one that is not. // between (for instance) a via which is flashed on the primary layer and one that is not.
// So we need to refine isActive to be more discriminating for some items. // So we need to refine isActive to be more discriminating for some items.
if( primary != UNDEFINED_LAYER ) if( primary != UNDEFINED_LAYER && IsCopperLayer( primary ) )
{ {
if( item->Type() == PCB_VIA_T ) if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
{
isActive = static_cast<const VIA*>( item )->FlashLayer( primary, true );
}
else if( item->Type() == PCB_PAD_T )
{
isActive = static_cast<const PAD*>( item )->FlashLayer( primary, true );
}
else if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
{ {
// Track itself isn't on a synthetic layer, but its netname annotations are, and // Track itself isn't on a synthetic layer, but its netname annotations are, and
// we want to dim them based on whether or not the track is on the primary layer. // we want to dim them based on whether or not the track is on the primary layer.
isActive = static_cast<const TRACK*>( item )->IsOnLayer( primary ); isActive = static_cast<const TRACK*>( item )->IsOnLayer( primary );
} }
else
{
bool flashed = true;
if( item->Type() == PCB_VIA_T )
flashed = static_cast<const VIA*>( item )->FlashLayer( primary, true );
else if( item->Type() == PCB_PAD_T )
flashed = static_cast<const PAD*>( item )->FlashLayer( primary, true );
// For pads and vias, we only want to override the active state for copper layers
// (this includes synthetic layers)
if( !IsNonCopperLayer( aLayer ) )
isActive = flashed;
}
} }
if( !isActive ) if( !isActive )