summaryrefslogtreecommitdiff
path: root/plugingui/slider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/slider.cc')
-rw-r--r--plugingui/slider.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugingui/slider.cc b/plugingui/slider.cc
index b58bde9..953c8e6 100644
--- a/plugingui/slider.cc
+++ b/plugingui/slider.cc
@@ -66,6 +66,10 @@ void GUI::Slider::mouseMoveEvent(MouseMoveEvent *e)
{
if(state == down) {
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
if(handler) handler(ptr);
repaintEvent(NULL);
}
@@ -76,12 +80,20 @@ void GUI::Slider::buttonEvent(ButtonEvent *e)
if(e->direction == 1) {
state = down;
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
if(handler) handler(ptr);
repaintEvent(NULL);
}
if(e->direction == -1) {
state = up;
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
repaintEvent(NULL);
clicked();
if(handler) handler(ptr);
@@ -90,7 +102,7 @@ void GUI::Slider::buttonEvent(ButtonEvent *e)
void GUI::Slider::repaintEvent(GUI::RepaintEvent *e)
{
- DEBUG(slider, "Slider::repaintEvent (%f)\n", val);
+ //DEBUG(slider, "Slider::repaintEvent (%f)\n", val);
Painter p(this);