From 5275393a945502e8ed2c8e8a4b22f6a1c8e67cbd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 1 Nov 2021 16:08:16 +0000 Subject: [PATCH] Use highlight algo that works for both PCBNew and Eeschema. Fixes https://gitlab.com/kicad/code/kicad/issues/9500 --- common/tool/edit_points.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/common/tool/edit_points.cpp b/common/tool/edit_points.cpp index 92f0a49a3c..e75ebf58c9 100644 --- a/common/tool/edit_points.cpp +++ b/common/tool/edit_points.cpp @@ -254,20 +254,28 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // Linear darkening doesn't fit well with human color perception, and there's no guarantee // that there's enough room for contrast either. - KIGFX::COLOR4D bgColor; + KIGFX::COLOR4D borderColor; + KIGFX::COLOR4D highlightColor; double brightness = drawColor.GetBrightness(); if( brightness > 0.5 ) - bgColor = drawColor.Darkened( 0.3 ).WithAlpha( 0.8 ); + { + borderColor = drawColor.Darkened( 0.3 ).WithAlpha( 0.8 ); + highlightColor = drawColor.Brightened( 0.6 ).WithAlpha( 0.8 ); + } else if( brightness > 0.2 ) - bgColor = drawColor.Darkened( 0.6 ).WithAlpha( 0.8 ); + { + borderColor = drawColor.Darkened( 0.6 ).WithAlpha( 0.8 ); + highlightColor = drawColor.Brightened( 0.3 ).WithAlpha( 0.8 ); + } else - bgColor = drawColor.Brightened( 0.3 ).WithAlpha( 0.8 ); - - KIGFX::COLOR4D highlightColor = settings->GetLayerColor( LAYER_SELECT_OVERLAY ); + { + borderColor = drawColor.Brightened( 0.3 ).WithAlpha( 0.8 ); + highlightColor = drawColor.Brightened( 0.6 ).WithAlpha( 0.8 ); + } gal->SetFillColor( drawColor ); - gal->SetStrokeColor( bgColor ); + gal->SetStrokeColor( borderColor ); gal->SetIsFill( true ); gal->SetIsStroke( true ); gal->PushDepth(); @@ -287,11 +295,11 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const } else { - gal->SetStrokeColor( bgColor ); + gal->SetStrokeColor( borderColor ); gal->SetLineWidth( borderSize ); } - gal->SetFillColor( aPoint.IsActive() ? highlightColor : drawColor ); + gal->SetFillColor( drawColor ); if( aDrawCircle ) gal->DrawCircle( aPoint.GetPosition(), size );