|
|
@@ -122,27 +122,29 @@ void RackWidget::draw(const widget::DrawContext &ctx) { |
|
|
|
} |
|
|
|
|
|
|
|
void RackWidget::onHover(const event::Hover &e) { |
|
|
|
// Scroll with arrow keys |
|
|
|
float arrowSpeed = 30.0; |
|
|
|
if ((APP->window->getMods() & WINDOW_MOD_MASK) == (WINDOW_MOD_CTRL |GLFW_MOD_SHIFT)) |
|
|
|
arrowSpeed /= 16.0; |
|
|
|
else if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) |
|
|
|
arrowSpeed *= 4.0; |
|
|
|
else if ((APP->window->getMods() & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT) |
|
|
|
arrowSpeed /= 4.0; |
|
|
|
|
|
|
|
ui::ScrollWidget *scrollWidget = APP->scene->scrollWidget; |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.x -= arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.x += arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.y -= arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.y += arrowSpeed; |
|
|
|
if (!APP->event->selectedWidget) { |
|
|
|
// Scroll with arrow keys |
|
|
|
float arrowSpeed = 30.0; |
|
|
|
if ((APP->window->getMods() & WINDOW_MOD_MASK) == (WINDOW_MOD_CTRL |GLFW_MOD_SHIFT)) |
|
|
|
arrowSpeed /= 16.0; |
|
|
|
else if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) |
|
|
|
arrowSpeed *= 4.0; |
|
|
|
else if ((APP->window->getMods() & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT) |
|
|
|
arrowSpeed /= 4.0; |
|
|
|
|
|
|
|
ui::ScrollWidget *scrollWidget = APP->scene->scrollWidget; |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.x -= arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.x += arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.y -= arrowSpeed; |
|
|
|
} |
|
|
|
if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) { |
|
|
|
scrollWidget->offset.y += arrowSpeed; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
widget::OpaqueWidget::onHover(e); |
|
|
|