diff options
author | kobewi <kobewi4e@gmail.com> | 2022-01-23 13:49:53 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-01-23 13:49:53 +0100 |
commit | 98692d68c3e7f3cc2a4697edfc827703b5018c36 (patch) | |
tree | 9a02bccbae4ef082325801a6a4264e94f93fa7a6 /scene/gui | |
parent | c3d28ffa742298d7e00d0a08251ae97870e3ad88 (diff) |
Minor tweaks and fixes to panning
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/graph_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/graph_edit.h | 2 | ||||
-rw-r--r-- | scene/gui/view_panner.cpp | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 2d58733d8f..2be76473b0 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1356,7 +1356,7 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) { } } -void GraphEdit::_scroll_callback(Vector2 p_scroll_vec) { +void GraphEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { if (p_scroll_vec.x != 0) { h_scroll->set_value(h_scroll->get_value() + (h_scroll->get_page() * Math::abs(p_scroll_vec.x) / 8) * SIGN(p_scroll_vec.x)); } else { diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index e0827a99a4..da973b46f0 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -131,7 +131,7 @@ private: Ref<ViewPanner> panner; bool warped_panning = true; - void _scroll_callback(Vector2 p_scroll_vec); + void _scroll_callback(Vector2 p_scroll_vec, bool p_alt); void _pan_callback(Vector2 p_scroll_vec); void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt); diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp index 0fbc4485ab..7476887877 100644 --- a/scene/gui/view_panner.cpp +++ b/scene/gui/view_panner.cpp @@ -53,7 +53,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) panning.y += mb->get_factor() * scroll_vec.y; panning.x += mb->get_factor() * scroll_vec.x; } - callback_helper(scroll_callback, varray(panning)); + callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed())); return true; } } else { @@ -66,7 +66,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) panning.y += mb->get_factor() * scroll_vec.y; panning.x += mb->get_factor() * scroll_vec.x; } - callback_helper(scroll_callback, varray(panning)); + callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed())); return true; } else if (!mb->is_shift_pressed()) { scroll_vec.y *= mb->get_factor(); @@ -76,7 +76,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) } } - // Use Alt only for scrolling. + // Alt is not used for button presses, so ignore it. if (mb->is_alt_pressed()) { return false; } |