Browse Source

Darken incompatible PortWidgets when creating cables, instead of making them translucent. Make darkness dependent on room brightness.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
4fd20a17f5
3 changed files with 5 additions and 4 deletions
  1. +1
    -1
      dep/nanovg
  2. +1
    -1
      src/app/CableWidget.cpp
  3. +3
    -2
      src/app/PortWidget.cpp

+ 1
- 1
dep/nanovg

@@ -1 +1 @@
Subproject commit 9b5c4109a04734bad6459422531272c3327afde4
Subproject commit ade6e6c060504002a4409fb0943432cf5c494872

+ 1
- 1
src/app/CableWidget.cpp View File

@@ -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;


+ 3
- 2
src/app/PortWidget.cpp View File

@@ -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);
}


Loading…
Cancel
Save