Adds pan and zoom gestures to TextureRegion editor
(cherry picked from commit d1b1edba84
)
This commit is contained in:
parent
58a940e5aa
commit
3c7a013d8d
|
@ -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 New Issue