Adds pan and zoom gestures to TextureRegion editor
This commit is contained in:
parent
6fcb58f40d
commit
d1b1edba84
1 changed files with 11 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue