BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit b2bc0d552d39c047d36eaaf34c382f608b73ab2b
parent aee63f67723ad59006101bb11a62a27770dc099b
Author: Matt Demanett <matt@demanett.net>
Date:   Mon, 20 May 2019 22:55:57 -0400

v1: fix zoom.

Diffstat:
Msrc/Walk2.cpp | 12+++++++-----
Msrc/analyzer_base.cpp | 2+-
Msrc/rack_overrides.hpp | 4++++
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/Walk2.cpp b/src/Walk2.cpp @@ -5,6 +5,8 @@ #define GRID_KEY "grid" #define COLOR_KEY "color" +extern float zoom; + void Walk2::onReset() { _jumpTrigger.reset(); _modulationStep = modulationSteps; @@ -165,7 +167,7 @@ struct Walk2Display : TransparentWidget { } void draw(const DrawArgs& args) override { - float strokeWidth = 2.0f; // FIXME.v1 std::max(1.0f, 3 - gRackScene->zoomWidget->zoom); + float strokeWidth = std::max(1.0f, 3.0f - getZoom()); drawBackground(args); nvgSave(args.vg); @@ -360,8 +362,8 @@ struct Walk2Display : TransparentWidget { // nvgGlobalCompositeOperation(args.vg, NVG_LIGHTER); // int n = _module->historyPoints; - // float beginRadius = std::max(1.0f, 2.0f - gRackScene->zoomWidget->zoom); - // float endRadius = std::max(0.01f, 0.8f - gRackScene->zoomWidget->zoom); + // float beginRadius = std::max(1.0f, 2.0f - getZoom()); + // float endRadius = std::max(0.01f, 0.8f - getZoom()); // float radiusStep = (beginRadius - endRadius) / (float)n; // float radius = beginRadius; // float alphaStep = (color.a - 0.1f) / (float)n; @@ -377,8 +379,8 @@ struct Walk2Display : TransparentWidget { // } int n = _module->historyPoints; - float beginWidth = 2.0f; // FIXME.v1 std::max(1.0f, 4.0f - gRackScene->zoomWidget->zoom); - float endWidth = 1.0f; // FIXME.v1 std::max(0.5f, 2.0f - gRackScene->zoomWidget->zoom); + float beginWidth = std::max(1.0f, 4.0f - getZoom()); + float endWidth = std::max(0.5f, 2.0f - getZoom()); if (_module->_zoomOut) { beginWidth *= 2.0f; endWidth *= 2.0f; diff --git a/src/analyzer_base.cpp b/src/analyzer_base.cpp @@ -221,7 +221,7 @@ void AnalyzerDisplay::draw(const DrawArgs& args) { drawBackground(args); - float strokeWidth = 2.0f; // FIXME.v1 std::max(1.0f, 3 - gRackScene->zoomWidget->zoom); + float strokeWidth = std::max(1.0f, 3.0f - getZoom()); _xAxisLogFactor = (rangeMaxHz - rangeMinHz) / rangeMaxHz; _xAxisLogFactor *= 1.0f - baseXAxisLogFactor; _xAxisLogFactor = 1.0f - _xAxisLogFactor; diff --git a/src/rack_overrides.hpp b/src/rack_overrides.hpp @@ -31,4 +31,8 @@ struct Trigger : rack::dsp::SchmittTrigger { } }; +inline float getZoom() { + return rack::APP->scene->rackScroll->zoomWidget->zoom; +} + } // namespace bogaudio