diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-28 21:51:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-28 21:51:44 +0200 |
commit | becbb7b525e1cc9bf1520a0ac94b9e9f799f6169 (patch) | |
tree | 1fdb531335ffd3b1c8fa14683e1a6975afbd43ab /editor | |
parent | d8e7e344bccb1ad31e987e775a502eb284f627c8 (diff) | |
parent | 68b5f101c7274d9e57dde4f779e71d927e6664b2 (diff) |
Merge pull request #30891 from bojidar-bg/30875-tilemap-rightclick-pan
Make it so that 2D viewport does not pan while editing tilemaps
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 19199f37ef..92dc3e7f0d 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1058,9 +1058,9 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve return false; } -bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) { +bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bool p_already_accepted) { Ref<InputEventMouseButton> b = p_event; - if (b.is_valid()) { + if (b.is_valid() && !p_already_accepted) { bool pan_on_scroll = bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan")) && !b->get_control(); if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) { @@ -1162,14 +1162,14 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) { } Ref<InputEventMagnifyGesture> magnify_gesture = p_event; - if (magnify_gesture.is_valid()) { + if (magnify_gesture.is_valid() && !p_already_accepted) { // Zoom gesture _zoom_on_position(zoom * magnify_gesture->get_factor(), magnify_gesture->get_position()); return true; } Ref<InputEventPanGesture> pan_gesture = p_event; - if (pan_gesture.is_valid()) { + if (pan_gesture.is_valid() && !p_already_accepted) { // Pan gesture const Vector2 delta = (int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom) * pan_gesture->get_delta(); view_offset.x += delta.x; @@ -2268,7 +2268,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { } } - accepted = (_gui_input_zoom_or_pan(p_event) || accepted); + accepted = (_gui_input_zoom_or_pan(p_event, accepted) || accepted); if (accepted) accept_event(); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 2a85b20424..553ded6b14 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -466,7 +466,7 @@ private: bool _gui_input_resize(const Ref<InputEvent> &p_event); bool _gui_input_rotate(const Ref<InputEvent> &p_event); bool _gui_input_select(const Ref<InputEvent> &p_event); - bool _gui_input_zoom_or_pan(const Ref<InputEvent> &p_event); + bool _gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bool p_already_accepted); bool _gui_input_rulers_and_guides(const Ref<InputEvent> &p_event); bool _gui_input_hover(const Ref<InputEvent> &p_event); |