1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Allow moving the canvas through panning and zooming through a zooming gesture (#391)

This commit is contained in:
Laurenz Reinthaler 2020-12-05 02:41:16 +01:00 committed by GitHub
parent 5c200bf290
commit e0b010867a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()