summaryrefslogtreecommitdiff
path: root/src/gui/widgets/slider.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-02 12:17:20 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-02 12:17:20 +0300
commit35278ed7f80ed8a02785573d510c36b38998debe (patch)
treecb8a4358d39e90615d8dc9cb870393588e4edeb9 /src/gui/widgets/slider.cpp
parent8e182c09072b75d05c1dff89bd3337f08782a562 (diff)
downloadmanaverse-35278ed7f80ed8a02785573d510c36b38998debe.tar.gz
manaverse-35278ed7f80ed8a02785573d510c36b38998debe.tar.bz2
manaverse-35278ed7f80ed8a02785573d510c36b38998debe.tar.xz
manaverse-35278ed7f80ed8a02785573d510c36b38998debe.zip
Using minimal step in setting slider values.
Diffstat (limited to 'src/gui/widgets/slider.cpp')
-rw-r--r--src/gui/widgets/slider.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index e440631ad..66265a919 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -368,7 +368,6 @@ void Slider::mousePressed(MouseEvent &event)
setValue(markerPositionToValue(x - mMarkerLength / 2));
else
setValue(markerPositionToValue(height - y - mMarkerLength / 2));
-
distributeActionEvent();
}
}
@@ -450,18 +449,13 @@ void Slider::setValue(const double value)
{
mRedraw = true;
if (value > mScaleEnd)
- {
mValue = mScaleEnd;
- return;
- }
-
- if (value < mScaleStart)
- {
+ else if (value < mScaleStart)
mValue = mScaleStart;
- return;
- }
-
- mValue = value;
+ else
+ mValue = value;
+ mValue = static_cast<int>((mValue - mScaleStart) / mStepLength)
+ * mStepLength + mScaleStart;
}
double Slider::markerPositionToValue(const int v) const