From ae0588a164172c55273627511834810a4f13d269 Mon Sep 17 00:00:00 2001 From: nabsei Date: Thu, 16 Jul 2026 02:32:56 +0200 Subject: [PATCH] Fix KnobEventHandler motion drag with log scale motionEvent() added the linear mouse delta directly to valueTmp and then applied logscale() once, but valueTmp is stored in log-scaled space when usingLog is set. This double-transforms the value instead of converting it back to linear space first, so dragging a log-scale knob stayed stuck near the minimum. Convert valueTmp through invlogscale() before adding the delta, same as the already-correct scrollEvent() a few lines below. Fixes #388 --- dgl/src/EventHandlers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dgl/src/EventHandlers.cpp b/dgl/src/EventHandlers.cpp index 30456b0c4..423bd92c5 100644 --- a/dgl/src/EventHandlers.cpp +++ b/dgl/src/EventHandlers.cpp @@ -492,7 +492,8 @@ struct KnobEventHandler::PrivateData { return true; const float divisor = (ev.mod & kModifierControl) ? accel * 10.f : accel; - valueTmp += (maximum - minimum) / divisor * static_cast(movDiff); + valueTmp = (usingLog ? invlogscale(valueTmp) : valueTmp) + + (maximum - minimum) / divisor * static_cast(movDiff); if (usingLog) valueTmp = logscale(valueTmp);