From 014db6d4ef170b44653b1eb668686b624e4ae3f8 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 15 Jan 2021 11:38:19 +0000 Subject: [PATCH] Make mousewheel delta independent of window size --- dpf/dgl/src/ImageWidgets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dpf/dgl/src/ImageWidgets.cpp b/dpf/dgl/src/ImageWidgets.cpp index de94ca02..94bf58a1 100644 --- a/dpf/dgl/src/ImageWidgets.cpp +++ b/dpf/dgl/src/ImageWidgets.cpp @@ -612,8 +612,9 @@ bool ImageKnob::onScroll(const ScrollEvent& ev) if (! contains(ev.pos)) return false; + const float dir = (ev.delta.getY() > 0.f) ? 1.f : -1.f; const float d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f; - float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY()); + float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * dir); if (fUsingLog) value = _logscale(value);