From cbcc8fab739fb9be51fc4662924603f584a4b938 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:41:15 +0300 Subject: [PATCH] [GenericTilePolygonEditor] Add support for Pan and Magnify gestures. --- editor/plugins/tiles/tile_data_editors.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index f985bbc6290..51c9f29fa92 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -523,6 +523,21 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref p_event) xform.set_origin(base_control->get_size() / 2 + panning); xform.set_scale(Vector2(editor_zoom_widget->get_zoom(), editor_zoom_widget->get_zoom())); + Ref pan_gesture = p_event; + if (pan_gesture.is_valid()) { + panning += pan_gesture->get_delta() * 8; + drag_last_pos = Vector2(); + button_center_view->set_disabled(panning.is_zero_approx()); + accept_event(); + } + + Ref magnify_gesture = p_event; + if (magnify_gesture.is_valid()) { + editor_zoom_widget->set_zoom(editor_zoom_widget->get_zoom() * magnify_gesture->get_factor()); + _zoom_changed(); + accept_event(); + } + Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_DRAG_POINT) {