From e0b010867a678751330be7b64e5d39dc48563159 Mon Sep 17 00:00:00 2001 From: Laurenz Reinthaler <47503977+Schweini07@users.noreply.github.com> Date: Sat, 5 Dec 2020 02:41:16 +0100 Subject: [PATCH] Allow moving the canvas through panning and zooming through a zooming gesture (#391) --- src/UI/Canvas/CameraMovement.gd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/UI/Canvas/CameraMovement.gd b/src/UI/Canvas/CameraMovement.gd index 3d20fea47..a4d74ba47 100644 --- a/src/UI/Canvas/CameraMovement.gd +++ b/src/UI/Canvas/CameraMovement.gd @@ -126,6 +126,13 @@ func _input(event : InputEvent) -> void: zoom_camera(-1) elif event.is_action_pressed("zoom_out"): # Wheel Down Event zoom_camera(1) + elif event is InputEventMagnifyGesture: # Zoom Gesture on a Laptop touchpad + if event.factor < 1: + zoom_camera(1) + else: + zoom_camera(-1) + elif event is InputEventPanGesture: # Pan Gesture on a Latop touchpad + offset = offset + event.delta * zoom * 7 # for moving the canvas elif event is InputEventMouseMotion && drag: offset = offset - event.relative * zoom update_transparent_checker_offset()