@@ -102,6 +102,7 @@ void Knob::onDragMove(const widget::DragMoveEvent &e) { | |||||
void Knob::reset() { | void Knob::reset() { | ||||
if (paramQuantity && paramQuantity->isBounded()) { | if (paramQuantity && paramQuantity->isBounded()) { | ||||
paramQuantity->reset(); | paramQuantity->reset(); | ||||
oldValue = snapValue = paramQuantity->getValue(); | |||||
} | } | ||||
} | } | ||||
@@ -111,6 +112,7 @@ void Knob::randomize() { | |||||
if (snap) | if (snap) | ||||
value = std::round(value); | value = std::round(value); | ||||
paramQuantity->setValue(value); | paramQuantity->setValue(value); | ||||
oldValue = snapValue = paramQuantity->getValue(); | |||||
} | } | ||||
} | } | ||||
@@ -29,7 +29,7 @@ void ParamQuantity::setValue(float value) { | |||||
if (!std::isfinite(value)) | if (!std::isfinite(value)) | ||||
return; | return; | ||||
// This setter clamps the value | // This setter clamps the value | ||||
getParam()->setValue(value); | |||||
APP->engine->setParam(module, paramId, value); | |||||
} | } | ||||
float ParamQuantity::getValue() { | float ParamQuantity::getValue() { | ||||
@@ -135,7 +135,7 @@ void EventState::handleButton(math::Vec pos, int button, int action, int mods) { | |||||
} | } | ||||
if (action == GLFW_PRESS) { | if (action == GLFW_PRESS) { | ||||
const double doubleClickDuration = 0.5; | |||||
const double doubleClickDuration = 0.3; | |||||
double clickTime = glfwGetTime(); | double clickTime = glfwGetTime(); | ||||
if (clickedWidget | if (clickedWidget | ||||
&& clickTime - lastClickTime <= doubleClickDuration | && clickTime - lastClickTime <= doubleClickDuration | ||||
@@ -143,9 +143,14 @@ void EventState::handleButton(math::Vec pos, int button, int action, int mods) { | |||||
// DoubleClickEvent | // DoubleClickEvent | ||||
DoubleClickEvent eDoubleClick; | DoubleClickEvent eDoubleClick; | ||||
clickedWidget->onDoubleClick(eDoubleClick); | clickedWidget->onDoubleClick(eDoubleClick); | ||||
// Reset double click | |||||
lastClickTime = -INFINITY; | |||||
lastClickedWidget = NULL; | |||||
} | |||||
else { | |||||
lastClickTime = clickTime; | |||||
lastClickedWidget = clickedWidget; | |||||
} | } | ||||
lastClickTime = clickTime; | |||||
lastClickedWidget = clickedWidget; | |||||
} | } | ||||
} | } | ||||
} | } | ||||