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
558B

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