From 4fd20a17f53f0270758cb65e806bd09f497fd56f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 1 Aug 2021 17:36:27 -0400 Subject: [PATCH] Darken incompatible PortWidgets when creating cables, instead of making them translucent. Make darkness dependent on room brightness. --- dep/nanovg | 2 +- src/app/CableWidget.cpp | 2 +- src/app/PortWidget.cpp | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dep/nanovg b/dep/nanovg index 9b5c4109..ade6e6c0 160000 --- a/dep/nanovg +++ b/dep/nanovg @@ -1 +1 @@ -Subproject commit 9b5c4109a04734bad6459422531272c3327afde4 +Subproject commit ade6e6c060504002a4409fb0943432cf5c494872 diff --git a/src/app/CableWidget.cpp b/src/app/CableWidget.cpp index 1e5e62ef..147bf142 100644 --- a/src/app/CableWidget.cpp +++ b/src/app/CableWidget.cpp @@ -160,7 +160,7 @@ static void CableWidget_drawCable(CableWidget* that, const widget::Widget::DrawA if (opacity > 0.0) { nvgSave(args.vg); // This power scaling looks more linear than actual linear scaling - nvgGlobalAlpha(args.vg, std::pow(opacity, 1.5)); + nvgAlpha(args.vg, std::pow(opacity, 1.5)); float dist = pos1.minus(pos2).norm(); math::Vec slump; diff --git a/src/app/PortWidget.cpp b/src/app/PortWidget.cpp index 12a4b3ea..752a195f 100644 --- a/src/app/PortWidget.cpp +++ b/src/app/PortWidget.cpp @@ -158,8 +158,9 @@ void PortWidget::draw(const DrawArgs& args) { CableWidget* cw = APP->scene->rack->incompleteCable; if (cw) { // Dim the PortWidget if the active cable cannot plug into this PortWidget - if (type == engine::Port::OUTPUT ? cw->outputPort : cw->inputPort) - nvgGlobalAlpha(args.vg, 0.5); + if (type == engine::Port::OUTPUT ? cw->outputPort : cw->inputPort) { + nvgTint(args.vg, nvgRGBf(0.33, 0.33, 0.33)); + } } Widget::draw(args); }