From 85beaf6fed59792046811231ce76ee08c593adf5 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 27 Dec 2012 10:13:48 +0100 Subject: GUI: Change value by one on mouse wheel, not by one pixel On file-grained sliders, changing the value by one pixel was unpredictable because it wouldn't change by the same amount every time. (And of course, some values were not possible to set.) On course-grained sliders, changing the value by one pixel would sometimes not change it at all, causing the slider to seem stuck. Now the slider can be set to any value. --- gui/widget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/widget.cpp b/gui/widget.cpp index 4ffb63e945..c3f10a861f 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -593,8 +593,8 @@ void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount) { void SliderWidget::handleMouseWheel(int x, int y, int direction) { if (isEnabled() && !_isDragging) { - // Increment or decrement one position - int newValue = posToValue(valueToPos(_value) - 1 * direction); + // Increment or decrement by one + int newValue = _value - direction; if (newValue < _valueMin) newValue = _valueMin; -- cgit v1.2.3