summaryrefslogtreecommitdiff
path: root/plugingui/knob.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/knob.cc')
-rw-r--r--plugingui/knob.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugingui/knob.cc b/plugingui/knob.cc
index 4082aa3..8e60056 100644
--- a/plugingui/knob.cc
+++ b/plugingui/knob.cc
@@ -61,6 +61,11 @@ void Knob::setValue(float value)
internalSetValue(value);
}
+void Knob::setDefaultValue(float value)
+{
+ default_value = value;
+}
+
void Knob::setRange(float minimum, float maximum)
{
this->minimum = minimum;
@@ -145,10 +150,16 @@ void Knob::buttonEvent(ButtonEvent* buttonEvent)
return;
}
+ if (buttonEvent->doubleClick) {
+ internalSetValue(default_value);
+ return;
+ }
+
if(buttonEvent->direction == Direction::down)
{
state = down;
mouse_offset_x = buttonEvent->x + (-1 * buttonEvent->y);
+ return;
}
if(buttonEvent->direction == Direction::up)
@@ -156,6 +167,7 @@ void Knob::buttonEvent(ButtonEvent* buttonEvent)
state = up;
mouse_offset_x = buttonEvent->x + (-1 * buttonEvent->y);
clicked();
+ return;
}
}