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.

28 lines
669B

  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "app/ParamWidget.hpp"
  4. #include "app.hpp"
  5. namespace rack {
  6. /** Implements vertical dragging behavior for ParamWidgets */
  7. struct Knob : ParamWidget {
  8. /** Multiplier for mouse movement to adjust knob value */
  9. float speed = 1.0;
  10. float oldValue = 0.f;
  11. /** Enable snapping at integer values */
  12. bool snap = false;
  13. float snapValue = NAN;
  14. void onHover(const event::Hover &e) override;
  15. void onButton(const event::Button &e) override;
  16. void onDragStart(const event::DragStart &e) override;
  17. void onDragEnd(const event::DragEnd &e) override;
  18. void onDragMove(const event::DragMove &e) override;
  19. };
  20. } // namespace rack