From e03a91c9c7b51a15aa46f75d9b367252470d1db5 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 7 Dec 2022 21:01:49 +0300 Subject: [PATCH] Reduce static ratsnest opacity when moving items; tweak colors. --- common/settings/builtin_color_themes.h | 2 +- pcbnew/ratsnest/ratsnest_view_item.cpp | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/settings/builtin_color_themes.h b/common/settings/builtin_color_themes.h index 97c581c135..0dfe77a62c 100644 --- a/common/settings/builtin_color_themes.h +++ b/common/settings/builtin_color_themes.h @@ -158,7 +158,7 @@ static const std::map s_defaultTheme = { LAYER_PAD_PLATEDHOLES, CSS_COLOR( 194, 194, 0, 1 ) }, { LAYER_PADS_TH, CSS_COLOR( 227, 183, 46, 1 ) }, { LAYER_NON_PLATEDHOLES, CSS_COLOR( 26, 196, 210, 1 ) }, - { LAYER_RATSNEST, CSS_COLOR( 245, 255, 213, 0.6 ) }, + { LAYER_RATSNEST, CSS_COLOR( 0, 248, 255, 0.35 ) }, { LAYER_SELECT_OVERLAY, CSS_COLOR( 4, 255, 67, 1 ) }, { LAYER_VIA_THROUGH, CSS_COLOR( 236, 236, 236, 1 ) }, { LAYER_VIA_BBLIND, CSS_COLOR( 187, 151, 38, 1 ) }, diff --git a/pcbnew/ratsnest/ratsnest_view_item.cpp b/pcbnew/ratsnest/ratsnest_view_item.cpp index 2aef68c0ab..b3db037d18 100644 --- a/pcbnew/ratsnest/ratsnest_view_item.cpp +++ b/pcbnew/ratsnest/ratsnest_view_item.cpp @@ -78,13 +78,14 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const auto rs = static_cast( aView->GetPainter()->GetSettings() ); - COLOR4D defaultColor = rs->GetColor( nullptr, LAYER_RATSNEST ); - COLOR4D color = defaultColor; - const bool colorByNet = rs->GetNetColorMode() != NET_COLOR_MODE::OFF; - std::set highlightedNets = rs->GetHighlightNetCodes(); const std::set& hiddenNets = rs->GetHiddenNets(); + COLOR4D defaultColor = rs->GetColor( nullptr, LAYER_RATSNEST ); + COLOR4D color = defaultColor; + const bool colorByNet = rs->GetNetColorMode() != NET_COLOR_MODE::OFF; + const bool dimStatic = m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0; + std::map& netColors = rs->GetNetColorMap(); std::map& ncColors = rs->GetNetclassColorMap(); const std::map& ncMap = m_data->GetNetclassMap(); @@ -124,7 +125,7 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const if( color == COLOR4D::UNSPECIFIED ) color = defaultColor; - gal->SetStrokeColor( color.Brightened( 0.5 ).WithAlpha( std::min( 1.0, color.a + 0.4 ) ) ); + gal->SetStrokeColor( color.Brightened( 0.5 ).WithAlpha( std::min( 1.0, color.a + 0.3 ) ) ); if( l.a == l.b ) { @@ -170,9 +171,13 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const if( color == COLOR4D::UNSPECIFIED ) color = defaultColor; + if( dimStatic ) + color = color.WithAlpha( std::max( 0.0, color.a / 2 ) ); + // Draw the "static" ratsnest if( highlightedNets.count( i ) ) - gal->SetStrokeColor( color.Brightened( 0.8 ) ); + gal->SetStrokeColor( + color.Brightened( 0.8 ).WithAlpha( std::min( 1.0, color.a + 0.4 ) ) ); else gal->SetStrokeColor( color ); // using the default ratsnest color for not highlighted