Browse Source

Make mousewheel delta independent of window size, fixes #95

pull/249/head
Damien Zammit Filipe Coelho <falktx@falktx.com> 1 year ago
parent
commit
68ca91217d
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      dgl/src/ImageWidgets.cpp

+ 2
- 1
dgl/src/ImageWidgets.cpp View File

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


Loading…
Cancel
Save