diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-30 11:39:13 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-30 11:39:13 +0800 |
commit | d1b1edba84a76614368fa9e7eb2459ed0dc95da5 (patch) | |
tree | f644ce9ac9fc2511498749838a7d8ebcf590b4be /editor | |
parent | 6fcb58f40dae8228074591e3262d5db97db3e2d7 (diff) |
Adds pan and zoom gestures to TextureRegion editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 507ea0b83d..94aef60f1f 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -546,6 +546,17 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { edit_draw->update(); } } + + Ref<InputEventMagnifyGesture> magnify_gesture = p_input; + if (magnify_gesture.is_valid()) { + _zoom_on_position(draw_zoom * magnify_gesture->get_factor(), magnify_gesture->get_position()); + } + + Ref<InputEventPanGesture> pan_gesture = p_input; + if (pan_gesture.is_valid()) { + hscroll->set_value(hscroll->get_value() + hscroll->get_page() * pan_gesture->get_delta().x / 8); + vscroll->set_value(vscroll->get_value() + vscroll->get_page() * pan_gesture->get_delta().y / 8); + } } void TextureRegionEditor::_scroll_changed(float) { |