Merge pull request #94904 from bruvzg/tile_poly_gestures
[GenericTilePolygonEditor] Add support for Pan and Magnify gestures.
This commit is contained in:
commit
8f6116d3f4
|
@ -523,6 +523,21 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event)
|
||||||
xform.set_origin(base_control->get_size() / 2 + panning);
|
xform.set_origin(base_control->get_size() / 2 + panning);
|
||||||
xform.set_scale(Vector2(editor_zoom_widget->get_zoom(), editor_zoom_widget->get_zoom()));
|
xform.set_scale(Vector2(editor_zoom_widget->get_zoom(), editor_zoom_widget->get_zoom()));
|
||||||
|
|
||||||
|
Ref<InputEventPanGesture> pan_gesture = p_event;
|
||||||
|
if (pan_gesture.is_valid()) {
|
||||||
|
panning += pan_gesture->get_delta() * 8;
|
||||||
|
drag_last_pos = Vector2();
|
||||||
|
button_center_view->set_disabled(panning.is_zero_approx());
|
||||||
|
accept_event();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
|
||||||
|
if (magnify_gesture.is_valid()) {
|
||||||
|
editor_zoom_widget->set_zoom(editor_zoom_widget->get_zoom() * magnify_gesture->get_factor());
|
||||||
|
_zoom_changed();
|
||||||
|
accept_event();
|
||||||
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if (drag_type == DRAG_TYPE_DRAG_POINT) {
|
if (drag_type == DRAG_TYPE_DRAG_POINT) {
|
||||||
|
|
Loading…
Reference in New Issue