@@ -110,36 +110,6 @@ void RackScrollWidget::draw(const DrawArgs& args) { | |||||
void RackScrollWidget::onHoverKey(const HoverKeyEvent& e) { | void RackScrollWidget::onHoverKey(const HoverKeyEvent& e) { | ||||
ScrollWidget::onHoverKey(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); | |||||
} | |||||
} | |||||
} | } | ||||
@@ -238,6 +238,34 @@ void Scene::onHoverKey(const HoverKeyEvent& e) { | |||||
e.consume(this); | 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) { | void Scene::onPathDrop(const PathDropEvent& e) { | ||||