Browse Source

Zoom in/out rack with extra mouse buttons

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
30c64c5e93
2 changed files with 20 additions and 0 deletions
  1. +1
    -0
      include/app/RackScrollWidget.hpp
  2. +19
    -0
      src/app/RackScrollWidget.cpp

+ 1
- 0
include/app/RackScrollWidget.hpp View File

@@ -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;
};




+ 19
- 0
src/app/RackScrollWidget.cpp View File

@@ -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

Loading…
Cancel
Save