@@ -16,6 +16,8 @@ struct Knob : ParamWidget { | |||||
/** Enable snapping at integer values */ | /** Enable snapping at integer values */ | ||||
bool snap = false; | bool snap = false; | ||||
float snapValue = NAN; | float snapValue = NAN; | ||||
/** Drag horizontally instead of vertically */ | |||||
bool horizontal = false; | |||||
void onHover(const event::Hover &e) override; | void onHover(const event::Hover &e) override; | ||||
void onButton(const event::Button &e) override; | void onButton(const event::Button &e) override; | ||||
@@ -7,6 +7,7 @@ namespace rack { | |||||
struct SliderKnob : Knob { | struct SliderKnob : Knob { | ||||
// Bypass Knob's circular hitbox detection | |||||
void onHover(const event::Hover &e) override { | void onHover(const event::Hover &e) override { | ||||
ParamWidget::onHover(e); | ParamWidget::onHover(e); | ||||
} | } | ||||
@@ -64,7 +64,10 @@ void Knob::onDragMove(const event::DragMove &e) { | |||||
// Continuous encoders scale as if their limits are +/-1 | // Continuous encoders scale as if their limits are +/-1 | ||||
range = 2.f; | range = 2.f; | ||||
} | } | ||||
float delta = KNOB_SENSITIVITY * -e.mouseDelta.y * speed * range; | |||||
float delta = (horizontal ? e.mouseDelta.x : -e.mouseDelta.y); | |||||
delta *= KNOB_SENSITIVITY; | |||||
delta *= speed; | |||||
delta *= range; | |||||
// Drag slower if mod is held | // Drag slower if mod is held | ||||
int mods = app()->window->getMods(); | int mods = app()->window->getMods(); | ||||