Merge pull request #35731 from timothyqiu/texture-region-gestures

Adds pan and zoom gestures to TextureRegion editor
This commit is contained in:
Rémi Verschelde 2020-02-06 11:12:34 +01:00 committed by GitHub
commit 6aaff5dc68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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