@@ -24,6 +24,8 @@ struct ParamQuantity : Quantity { | |||||
float getDefaultValue() override; | float getDefaultValue() override; | ||||
float getDisplayValue() override; | float getDisplayValue() override; | ||||
void setDisplayValue(float displayValue) override; | void setDisplayValue(float displayValue) override; | ||||
std::string getDisplayValueString() override; | |||||
void setDisplayValueString(std::string s) override; | |||||
int getDisplayPrecision() override; | int getDisplayPrecision() override; | ||||
std::string getLabel() override; | std::string getLabel() override; | ||||
std::string getUnit() override; | std::string getUnit() override; | ||||
@@ -101,6 +101,14 @@ int ParamQuantity::getDisplayPrecision() { | |||||
return (int) std::ceil(math::clamp(-log + 3.f, 0.f, 6.f)); | return (int) std::ceil(math::clamp(-log + 3.f, 0.f, 6.f)); | ||||
} | } | ||||
std::string ParamQuantity::getDisplayValueString() { | |||||
return Quantity::getDisplayValueString(); | |||||
} | |||||
void ParamQuantity::setDisplayValueString(std::string s) { | |||||
Quantity::setDisplayValueString(s); | |||||
} | |||||
std::string ParamQuantity::getLabel() { | std::string ParamQuantity::getLabel() { | ||||
if (!module) | if (!module) | ||||
return Quantity::getLabel(); | return Quantity::getLabel(); | ||||
@@ -104,7 +104,7 @@ void ParamWidget::fromJson(json_t *rootJ) { | |||||
void ParamWidget::onButton(const event::Button &e) { | void ParamWidget::onButton(const event::Button &e) { | ||||
// Right click to reset | // Right click to reset | ||||
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT && !(e.mods & WINDOW_MOD) && !(e.mods & GLFW_MOD_SHIFT)) { | if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT && !(e.mods & WINDOW_MOD) && !(e.mods & GLFW_MOD_SHIFT)) { | ||||
if (paramQuantity) { | |||||
if (paramQuantity && paramQuantity->isBounded()) { | |||||
float oldValue = paramQuantity->getValue(); | float oldValue = paramQuantity->getValue(); | ||||
paramQuantity->reset(); | paramQuantity->reset(); | ||||
float newValue = paramQuantity->getValue(); | float newValue = paramQuantity->getValue(); | ||||
@@ -36,11 +36,11 @@ void SVGKnob::onChange(const event::Change &e) { | |||||
float angle; | float angle; | ||||
if (paramQuantity->isBounded()) { | if (paramQuantity->isBounded()) { | ||||
angle = math::rescale(paramQuantity->getScaledValue(), 0.f, 1.f, minAngle, maxAngle); | angle = math::rescale(paramQuantity->getScaledValue(), 0.f, 1.f, minAngle, maxAngle); | ||||
angle = std::fmod(angle, 2*M_PI); | |||||
} | } | ||||
else { | else { | ||||
angle = math::rescale(paramQuantity->getValue(), 0.f, 1.f, minAngle, maxAngle); | |||||
angle = math::rescale(paramQuantity->getValue(), -1.f, 1.f, minAngle, maxAngle); | |||||
} | } | ||||
angle = std::fmod(angle, 2*M_PI); | |||||
tw->identity(); | tw->identity(); | ||||
// Rotate SVG | // Rotate SVG | ||||
math::Vec center = sw->box.getCenter(); | math::Vec center = sw->box.getCenter(); | ||||