diff --git a/src/app/RackScrollWidget.cpp b/src/app/RackScrollWidget.cpp index aecc0cf4..c80dfee1 100644 --- a/src/app/RackScrollWidget.cpp +++ b/src/app/RackScrollWidget.cpp @@ -110,36 +110,6 @@ void RackScrollWidget::draw(const DrawArgs& args) { void RackScrollWidget::onHoverKey(const HoverKeyEvent& e) { ScrollWidget::onHoverKey(e); - if (e.isConsumed()) - return; - - // Scroll with arrow keys - float arrowSpeed = 32.f; - if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) - arrowSpeed /= 4.f; - if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) - arrowSpeed *= 4.f; - if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) - arrowSpeed /= 16.f; - - if (e.action == RACK_HELD) { - if (e.key == GLFW_KEY_LEFT) { - offset.x -= arrowSpeed; - e.consume(this); - } - if (e.key == GLFW_KEY_RIGHT) { - offset.x += arrowSpeed; - e.consume(this); - } - if (e.key == GLFW_KEY_UP) { - offset.y -= arrowSpeed; - e.consume(this); - } - if (e.key == GLFW_KEY_DOWN) { - offset.y += arrowSpeed; - e.consume(this); - } - } } diff --git a/src/app/Scene.cpp b/src/app/Scene.cpp index b5fb84b0..29220da0 100644 --- a/src/app/Scene.cpp +++ b/src/app/Scene.cpp @@ -238,6 +238,34 @@ void Scene::onHoverKey(const HoverKeyEvent& e) { e.consume(this); } } + + // Scroll RackScrollWidget with arrow keys + if (e.action == RACK_HELD) { + float arrowSpeed = 32.f; + if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) + arrowSpeed /= 4.f; + if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) + arrowSpeed *= 4.f; + if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) + arrowSpeed /= 16.f; + + if (e.key == GLFW_KEY_LEFT) { + rackScroll->offset.x -= arrowSpeed; + e.consume(this); + } + if (e.key == GLFW_KEY_RIGHT) { + rackScroll->offset.x += arrowSpeed; + e.consume(this); + } + if (e.key == GLFW_KEY_UP) { + rackScroll->offset.y -= arrowSpeed; + e.consume(this); + } + if (e.key == GLFW_KEY_DOWN) { + rackScroll->offset.y += arrowSpeed; + e.consume(this); + } + } } void Scene::onPathDrop(const PathDropEvent& e) {