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.

Knob.hpp 690B

12345678910111213141516171819202122232425262728
  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. bool smooth = true;
  12. /** Enable snapping at integer values */
  13. bool snap = false;
  14. float snapValue = NAN;
  15. void onHover(const event::Hover &e) override;
  16. void onButton(const event::Button &e) override;
  17. void onDragStart(const event::DragStart &e) override;
  18. void onDragEnd(const event::DragEnd &e) override;
  19. void onDragMove(const event::DragMove &e) override;
  20. };
  21. } // namespace rack