Reduce static ratsnest opacity when moving items; tweak colors.

This commit is contained in:
Alex 2022-12-07 21:01:49 +03:00
parent ce8fa2ad00
commit e03a91c9c7
2 changed files with 12 additions and 7 deletions

View File

@ -158,7 +158,7 @@ static const std::map<int, COLOR4D> 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 ) },

View File

@ -78,12 +78,13 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
std::set<int> highlightedNets = rs->GetHighlightNetCodes();
const std::set<int>& hiddenNets = rs->GetHiddenNets();
COLOR4D defaultColor = rs->GetColor( nullptr, LAYER_RATSNEST );
COLOR4D color = defaultColor;
const bool colorByNet = rs->GetNetColorMode() != NET_COLOR_MODE::OFF;
std::set<int> highlightedNets = rs->GetHighlightNetCodes();
const std::set<int>& hiddenNets = rs->GetHiddenNets();
const bool dimStatic = m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0;
std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
std::map<wxString, KIGFX::COLOR4D>& ncColors = rs->GetNetclassColorMap();
@ -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