From 17066134f402f9af9bd0779a49c373b917432142 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 18 Aug 2020 20:55:12 -0400 Subject: [PATCH] Fix brightness factor application for selected items Fixes https://gitlab.com/kicad/code/kicad/-/issues/5236 --- pcbnew/pcb_painter.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 01dc59a5c3..057d27726a 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -280,7 +280,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons && m_activeLayers.count( aLayer ) == 0 ) color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor ); } - else + else if( !item->IsSelected() ) { // Single net highlight mode if( m_highlightEnabled ) @@ -288,12 +288,13 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons : m_layerColorsDark[aLayer]; // Return grayish color for non-highlighted layers in the dimmed high contrast mode - if( m_contrastModeDisplay == HIGH_CONTRAST_MODE::DIMMED && m_activeLayers.count( aLayer ) == 0 ) + if( m_contrastModeDisplay == HIGH_CONTRAST_MODE::DIMMED + && m_activeLayers.count( aLayer ) == 0 ) color = m_hiContrastColor[aLayer]; } // For vias, some layers depend on other layers in high contrast mode - if( m_hiContrastEnabled && item->Type() == PCB_VIA_T && + if( m_hiContrastEnabled && !item->IsSelected() && item->Type() == PCB_VIA_T && ( aLayer == LAYER_VIAS_HOLES || aLayer == LAYER_VIA_THROUGH || aLayer == LAYER_VIA_MICROVIA || @@ -309,10 +310,8 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons viaActiveLayer |= via->IsOnLayer( lay_id ) && pcb->IsLayerVisible( lay_id ); } - if( viaActiveLayer ) - color = m_layerColors[aLayer]; - else - color = m_hiContrastColor[aLayer]; + if( !viaActiveLayer ) + color.Darken( 1.0 - m_highlightFactor ); } // Apply per-type opacity overrides