Skip to content

Commit

Permalink
Make mousewheel delta independent of window size
Browse files Browse the repository at this point in the history
  • Loading branch information
falkTX committed Jan 15, 2021
1 parent bec7bef commit 014db6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dpf/dgl/src/ImageWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 014db6d

Please sign in to comment.