summaryrefslogtreecommitdiff
path: root/plugingui/knob.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-07-19 17:54:51 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-07-19 17:54:51 +0200
commitc80a459faf3abcbe67969664663a3b9ed82966f7 (patch)
treeb14ee2c30ef916c5126dc791e20af26fc8cd85ef /plugingui/knob.cc
parent966e57b6865c1fa3826c68fc54668ca102b29512 (diff)
Use range when assigning default knob value.
Diffstat (limited to 'plugingui/knob.cc')
-rw-r--r--plugingui/knob.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugingui/knob.cc b/plugingui/knob.cc
index aaf9735..3d09d51 100644
--- a/plugingui/knob.cc
+++ b/plugingui/knob.cc
@@ -150,8 +150,12 @@ void Knob::buttonEvent(ButtonEvent* buttonEvent)
return;
}
- if (buttonEvent->doubleClick) {
- internalSetValue(default_value);
+ if(buttonEvent->doubleClick)
+ {
+ float value = default_value;
+ value -= minimum;
+ value /= (maximum - minimum);
+ internalSetValue(value);
return;
}