diff options
| author | Bernhard Liebl | 2017-11-01 21:49:39 +0100 |
|---|---|---|
| committer | Bernhard Liebl | 2017-11-21 09:11:39 +0100 |
| commit | 80ad8afc85a90e6fda1b136b13c1eb42e35c115e (patch) | |
| tree | bc145bc5c008a2abfa159f4d5437c8d0b8813aca /editor/plugins/polygon_2d_editor_plugin.cpp | |
| parent | 5ff84070ca3604b43e86562a3d000ed924a604a2 (diff) | |
| download | godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.tar.gz godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.tar.zst godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.zip | |
Native pan and zoom for macOS
Diffstat (limited to 'editor/plugins/polygon_2d_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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<InputEvent> &p_input) { uv_edit_draw->update(); } } + + Ref<InputEventMagnifyGesture> magnify_gesture = p_input; + if (magnify_gesture.is_valid()) { + + uv_zoom->set_value(uv_zoom->get_value() * magnify_gesture->get_factor()); + } + + Ref<InputEventPanGesture> 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) { |
