From 98692d68c3e7f3cc2a4697edfc827703b5018c36 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 23 Jan 2022 13:49:53 +0100 Subject: [PATCH] Minor tweaks and fixes to panning --- editor/animation_bezier_editor.cpp | 4 +- editor/animation_bezier_editor.h | 2 +- editor/animation_track_editor.cpp | 42 +++++++++---------- editor/animation_track_editor.h | 6 +-- editor/editor_settings.cpp | 2 +- .../animation_blend_tree_editor_plugin.cpp | 2 +- editor/plugins/canvas_item_editor_plugin.cpp | 4 +- editor/plugins/canvas_item_editor_plugin.h | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 4 +- editor/plugins/polygon_2d_editor_plugin.h | 2 +- .../plugins/texture_region_editor_plugin.cpp | 4 +- editor/plugins/texture_region_editor_plugin.h | 2 +- editor/plugins/tiles/tile_atlas_view.cpp | 4 +- editor/plugins/tiles/tile_atlas_view.h | 2 +- .../plugins/visual_shader_editor_plugin.cpp | 2 +- .../editor/visual_script_editor.cpp | 2 +- scene/gui/graph_edit.cpp | 2 +- scene/gui/graph_edit.h | 2 +- scene/gui/view_panner.cpp | 6 +-- 19 files changed, 47 insertions(+), 49 deletions(-) diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 2cf3b1c2192..da376c588e5 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -218,7 +218,7 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V void AnimationBezierTrackEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); } if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); @@ -994,7 +994,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref &p_event) { } } -void AnimationBezierTrackEdit::_scroll_callback(Vector2 p_scroll_vec) { +void AnimationBezierTrackEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { _pan_callback(-p_scroll_vec * 32); } diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h index 8af493adcbd..cf719a0355b 100644 --- a/editor/animation_bezier_editor.h +++ b/editor/animation_bezier_editor.h @@ -126,7 +126,7 @@ class AnimationBezierTrackEdit : public Control { Set selection; Ref panner; - 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/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 48282120f35..dbbdd857060 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1459,7 +1459,7 @@ int AnimationTimelineEdit::get_name_limit() const { void AnimationTimelineEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); } if (p_what == NOTIFICATION_ENTER_TREE) { @@ -1799,7 +1799,7 @@ void AnimationTimelineEdit::gui_input(const Ref &p_event) { int x = mb->get_position().x - get_name_limit(); float ofs = x / get_zoom_scale() + get_value(); - emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(Key::ALT)); + emit_signal(SNAME("timeline_changed"), ofs, false, mb->is_alt_pressed()); dragging_timeline = true; } } @@ -1833,7 +1833,7 @@ void AnimationTimelineEdit::gui_input(const Ref &p_event) { } } -void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec) { +void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { // Timeline has no vertical scroll, so we change it to horizontal. p_scroll_vec.x += p_scroll_vec.y; _pan_callback(-p_scroll_vec * 32); @@ -1872,7 +1872,7 @@ void AnimationTimelineEdit::_track_added(int p_track) { void AnimationTimelineEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("zoom_changed")); ADD_SIGNAL(MethodInfo("name_limit_changed")); - ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"))); + ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only"))); ADD_SIGNAL(MethodInfo("track_added", PropertyInfo(Variant::INT, "track"))); ADD_SIGNAL(MethodInfo("length_changed", PropertyInfo(Variant::FLOAT, "size"))); } @@ -3121,7 +3121,7 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselect } void AnimationTrackEdit::_bind_methods() { - ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"))); + ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only"))); ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track"))); ADD_SIGNAL(MethodInfo("dropped", PropertyInfo(Variant::INT, "from_track"), PropertyInfo(Variant::INT, "to_track"))); ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::FLOAT, "ofs"))); @@ -3648,7 +3648,7 @@ void AnimationTrackEditor::_insert_track(bool p_create_reset, bool p_create_bezi pos = animation->get_length(); } set_anim_pos(pos); - emit_signal(SNAME("timeline_changed"), pos, true); + emit_signal(SNAME("timeline_changed"), pos, true, false); } } @@ -4510,7 +4510,7 @@ MenuButton *AnimationTrackEditor::get_edit_menu() { void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); } if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { @@ -5230,16 +5230,6 @@ void AnimationTrackEditor::_scroll_input(const Ref &p_event) { Ref mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) { - goto_prev_step(true); - scroll->accept_event(); - } - - if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) { - goto_next_step(true); - scroll->accept_event(); - } - if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) { if (mb->is_pressed()) { box_selecting = true; @@ -5304,8 +5294,16 @@ void AnimationTrackEditor::_scroll_input(const Ref &p_event) { } } -void AnimationTrackEditor::_scroll_callback(Vector2 p_scroll_vec) { - _pan_callback(-p_scroll_vec * 32); +void AnimationTrackEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { + if (p_alt) { + if (p_scroll_vec.x < 0 || p_scroll_vec.y < 0) { + goto_prev_step(true); + } else { + goto_next_step(true); + } + } else { + _pan_callback(-p_scroll_vec * 32); + } } void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec) { @@ -5447,7 +5445,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) { pos = 0; } set_anim_pos(pos); - emit_signal(SNAME("timeline_changed"), pos, true); + emit_signal(SNAME("timeline_changed"), pos, true, false); } void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) { @@ -5474,7 +5472,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) { } set_anim_pos(pos); - emit_signal(SNAME("timeline_changed"), pos, true); + emit_signal(SNAME("timeline_changed"), pos, true, false); } void AnimationTrackEditor::_edit_menu_pressed(int p_option) { @@ -5998,7 +5996,7 @@ void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_key_deselected", &AnimationTrackEditor::_key_deselected); // Still used by some connect_compat. ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection); // Still used by some connect_compat. - ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"))); + ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only"))); ADD_SIGNAL(MethodInfo("keying_changed")); ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::FLOAT, "len"))); ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::FLOAT, "step"))); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index c33cabb9c0f..50c5c692c03 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -82,7 +82,7 @@ class AnimationTimelineEdit : public Range { bool use_fps; Ref panner; - 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); @@ -316,7 +316,7 @@ class AnimationTrackEditor : public VBoxContainer { void _update_tracks(); void _name_limit_changed(); - void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only = false); + void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only); void _track_remove_request(int p_track); void _track_grab_focus(int p_track); @@ -377,7 +377,7 @@ class AnimationTrackEditor : public VBoxContainer { PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr); Ref panner; - 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/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0a0ebec5e09..07ebd249b3f 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -647,7 +647,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { // Panning // Enum should be in sync with ControlScheme in ViewPanner. EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/2d_editor_panning_scheme", 0, "Scroll Zooms,Scroll Pans"); - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/sub_editor_panning_scheme", 0, "Scroll Zooms,Scroll Pans"); + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/sub_editors_panning_scheme", 0, "Scroll Zooms,Scroll Pans"); EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/animation_editors_panning_scheme", 1, "Scroll Zooms,Scroll Pans"); _initial_set("editors/panning/simple_panning", false); _initial_set("editors/panning/warped_mouse_panning", true); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 8df1729ae10..b889742b19f 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -734,7 +734,7 @@ void AnimationNodeBlendTreeEditor::_removed_from_graph() { void AnimationNodeBlendTreeEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 9a81d5f0b3b..4093c70c473 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1187,7 +1187,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref &p_event, bo return false; } -void CanvasItemEditor::_scroll_callback(Vector2 p_scroll_vec) { +void CanvasItemEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { _pan_callback(-p_scroll_vec * pan_speed); } @@ -3858,7 +3858,7 @@ void CanvasItemEditor::_notification(int p_what) { anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons"))); - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed")); warped_panning = bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")); } diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index fbdbf1351a6..1e8fc0670d3 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -406,7 +406,7 @@ private: Ref panner; bool warped_panning = true; int pan_speed = 20; - 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/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 2cdbcd1b0c4..7a96e6ecedf 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -66,7 +66,7 @@ void Polygon2DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); } break; case NOTIFICATION_READY: { button_uv->set_icon(get_theme_icon(SNAME("Uv"), SNAME("EditorIcons"))); @@ -926,7 +926,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { } } -void Polygon2DEditor::_uv_scroll_callback(Vector2 p_scroll_vec) { +void Polygon2DEditor::_uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { _uv_pan_callback(-p_scroll_vec * 32); } diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index 425d51a4913..0f10b6b6457 100644 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -81,7 +81,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { TextureRect *uv_icon_zoom; Ref uv_panner; - void _uv_scroll_callback(Vector2 p_scroll_vec); + void _uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt); void _uv_pan_callback(Vector2 p_scroll_vec); void _uv_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index d0c9767a1d3..662c0126eca 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -602,7 +602,7 @@ void TextureRegionEditor::_region_input(const Ref &p_input) { } } -void TextureRegionEditor::_scroll_callback(Vector2 p_scroll_vec) { +void TextureRegionEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { _pan_callback(-p_scroll_vec * 32); } @@ -820,7 +820,7 @@ void TextureRegionEditor::_notification(int p_what) { [[fallthrough]]; } case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) { diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h index 434607c2f48..d78ad3891c9 100644 --- a/editor/plugins/texture_region_editor_plugin.h +++ b/editor/plugins/texture_region_editor_plugin.h @@ -101,7 +101,7 @@ class TextureRegionEditor : public VBoxContainer { int drag_index; Ref panner; - 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/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 4d3b0908e09..3b9bde6b0dc 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -48,7 +48,7 @@ void TileAtlasView::gui_input(const Ref &p_event) { } } -void TileAtlasView::_scroll_callback(Vector2 p_scroll_vec) { +void TileAtlasView::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) { _pan_callback(-p_scroll_vec * 32); } @@ -524,7 +524,7 @@ void TileAtlasView::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); break; case NOTIFICATION_READY: diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h index 6832ad32382..37ef7d6a2a0 100644 --- a/editor/plugins/tiles/tile_atlas_view.h +++ b/editor/plugins/tiles/tile_atlas_view.h @@ -67,7 +67,7 @@ private: virtual void gui_input(const Ref &p_event) override; Ref panner; - 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/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 3fc46c001a5..2d0ca11b6a8 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -3224,7 +3224,7 @@ void VisualShaderEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); } diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 683248cb5a2..b00b5a2ddd9 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -3913,7 +3913,7 @@ void VisualScriptEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); + graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); } break; diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 2d58733d8fb..2be76473b04 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1356,7 +1356,7 @@ void GraphEdit::gui_input(const Ref &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 e0827a99a4e..da973b46f0a 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -131,7 +131,7 @@ private: Ref 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 0fbc4485ab8..7476887877c 100644 --- a/scene/gui/view_panner.cpp +++ b/scene/gui/view_panner.cpp @@ -53,7 +53,7 @@ bool ViewPanner::gui_input(const Ref &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 &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 &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; }