diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-06 11:12:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 11:12:34 +0100 |
commit | 6aaff5dc68f94a6bb78276838ca40f264fadd505 (patch) | |
tree | 09035377b83f380421ad524fab79e0acfe6ec8b6 /editor/plugins/texture_region_editor_plugin.cpp | |
parent | 17ce184921b7d2a8d78f4411bd3b13e16637598f (diff) | |
parent | d1b1edba84a76614368fa9e7eb2459ed0dc95da5 (diff) |
Merge pull request #35731 from timothyqiu/texture-region-gestures
Adds pan and zoom gestures to TextureRegion editor
Diffstat (limited to 'editor/plugins/texture_region_editor_plugin.cpp')
-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) { |