Adds pan and zoom gestures to TextureRegion editor

(cherry picked from commit d1b1edba84)
This commit is contained in:
Haoyu Qiu 2020-01-30 11:39:13 +08:00 committed by Rémi Verschelde
parent 58a940e5aa
commit 3c7a013d8d
1 changed files with 11 additions and 0 deletions

View File

@ -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) {