Browse Source

Resize mouse spotlight based on RackWidget zoom level.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
79036513c4
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/app/RackWidget.cpp

+ 7
- 2
src/app/RackWidget.cpp View File

@@ -125,10 +125,15 @@ void RackWidget::draw(const DrawArgs& args) {

// Draw translucent dark rectangle
if (b < 1.f) {
// Get zoom level
float t[6];
nvgCurrentTransform(args.vg, t);
float zoom = t[3];
float radius = 300.0 / zoom;
float brightness = 0.2f;
// Draw mouse spotlight
nvgBeginPath(args.vg);
nvgRect(args.vg, 0.0, 0.0, VEC_ARGS(box.size));
const float radius = 300.0;
const float brightness = 0.2f;
nvgFillPaint(args.vg, nvgRadialGradient(args.vg, VEC_ARGS(internal->mousePos), 0.0, radius, nvgRGBAf(0, 0, 0, 1.f - b - brightness), nvgRGBAf(0, 0, 0, 1.f - b)));
nvgFill(args.vg);
}


Loading…
Cancel
Save