From 80ad8afc85a90e6fda1b136b13c1eb42e35c115e Mon Sep 17 00:00:00 2001 From: Bernhard Liebl Date: Wed, 1 Nov 2017 21:49:39 +0100 Subject: Native pan and zoom for macOS --- editor/plugins/polygon_2d_editor_plugin.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'editor/plugins/polygon_2d_editor_plugin.cpp') diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index a525983c7..ebb5f57e9 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -339,6 +339,19 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { uv_edit_draw->update(); } } + + Ref magnify_gesture = p_input; + if (magnify_gesture.is_valid()) { + + uv_zoom->set_value(uv_zoom->get_value() * magnify_gesture->get_factor()); + } + + Ref pan_gesture = p_input; + if (pan_gesture.is_valid()) { + + uv_hscroll->set_value(uv_hscroll->get_value() + uv_hscroll->get_page() * pan_gesture->get_delta().x / 8); + uv_vscroll->set_value(uv_vscroll->get_value() + uv_vscroll->get_page() * pan_gesture->get_delta().y / 8); + } } void Polygon2DEditor::_uv_scroll_changed(float) { -- cgit v1.2.3-70-g09d2