diff --git a/include/app/RackScrollWidget.hpp b/include/app/RackScrollWidget.hpp index 25cc095c..eb568b9d 100644 --- a/include/app/RackScrollWidget.hpp +++ b/include/app/RackScrollWidget.hpp @@ -23,6 +23,7 @@ struct RackScrollWidget : ui::ScrollWidget { void onHoverKey(const HoverKeyEvent& e) override; void onHoverScroll(const HoverScrollEvent& e) override; void onHover(const HoverEvent& e) override; + void onButton(const ButtonEvent& e) override; }; diff --git a/src/app/RackScrollWidget.cpp b/src/app/RackScrollWidget.cpp index e4a95c86..adc98ecf 100644 --- a/src/app/RackScrollWidget.cpp +++ b/src/app/RackScrollWidget.cpp @@ -153,5 +153,24 @@ void RackScrollWidget::onHover(const HoverEvent& e) { } +void RackScrollWidget::onButton(const ButtonEvent& e) { + ScrollWidget::onButton(e); + if (e.isConsumed()) + return; + + // Zoom in/out with extra mouse buttons + if (e.action == GLFW_PRESS) { + if (e.button == GLFW_MOUSE_BUTTON_4) { + settings::zoom -= 0.5f; + e.consume(this); + } + if (e.button == GLFW_MOUSE_BUTTON_5) { + settings::zoom += 0.5f; + e.consume(this); + } + } +} + + } // namespace app } // namespace rack