#include "app.hpp" namespace rack { SVGSlider::SVGSlider() { background = new SVGWidget(); addChild(background); handle = new SVGWidget(); addChild(handle); speed = 2.0; } void SVGSlider::setSVGs(std::shared_ptr backgroundSVG, std::shared_ptr handleSVG) { background->setSVG(backgroundSVG); box.size = background->box.size; if (handleSVG) { handle->setSVG(handleSVG); } } void SVGSlider::step() { if (dirty) { // Interpolate handle position handle->box.pos = math::Vec(math::rescale(value, minValue, maxValue, minHandlePos.x, maxHandlePos.x), math::rescale(value, minValue, maxValue, minHandlePos.y, maxHandlePos.y)); } FramebufferWidget::step(); } void SVGSlider::onChange(EventChange &e) { dirty = true; Knob::onChange(e); } } // namespace rack