diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-13 15:24:23 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-13 15:24:23 +0200 |
commit | 2b9ba52376d65ddfaf5c464bfed56b293fd02a5e (patch) | |
tree | 3562d7c35c7bae51c3f43142e2a7ed602227d78d | |
parent | f12c4e8b9a2fcd159c8ee0aa2c76eb274d936883 (diff) | |
parent | 3550354fd3b7bbe76bcae0f1e8a3f9846a7ea70a (diff) |
Merge pull request #67312 from MladoniSzabi/fix_scroll_happening_twice
fixed holding alt while zooming zooms in by 2 increments.
-rw-r--r-- | scene/gui/view_panner.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp index 3b7f499a07..e8e3e3e556 100644 --- a/scene/gui/view_panner.cpp +++ b/scene/gui/view_panner.cpp @@ -38,7 +38,9 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { Vector2 scroll_vec = Vector2((mb->get_button_index() == MouseButton::WHEEL_RIGHT) - (mb->get_button_index() == MouseButton::WHEEL_LEFT), (mb->get_button_index() == MouseButton::WHEEL_DOWN) - (mb->get_button_index() == MouseButton::WHEEL_UP)); - if (scroll_vec != Vector2()) { + // Moving the scroll wheel sends two events: one with pressed as true, + // and one with pressed as false. Make sure we only process one of them. + if (scroll_vec != Vector2() && mb->is_pressed()) { if (control_scheme == SCROLL_PANS) { if (mb->is_ctrl_pressed()) { scroll_vec.y *= mb->get_factor(); |