You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
556B

  1. #include "app.hpp"
  2. namespace rack {
  3. SVGSlider::SVGSlider() {
  4. background = new SVGWidget();
  5. addChild(background);
  6. handle = new SVGWidget();
  7. addChild(handle);
  8. }
  9. void SVGSlider::step() {
  10. if (dirty) {
  11. // Update handle position
  12. Vec handlePos = Vec(rescalef(value, minValue, maxValue, minHandlePos.x, maxHandlePos.x), rescalef(value, minValue, maxValue, minHandlePos.y, maxHandlePos.y));
  13. handle->box.pos = handlePos;
  14. }
  15. FramebufferWidget::step();
  16. }
  17. void SVGSlider::onChange() {
  18. dirty = true;
  19. ParamWidget::onChange();
  20. }
  21. } // namespace rack