mac inputs

This commit is contained in:
James 2023-12-28 11:46:02 +00:00
parent 60ca7e6ca8
commit 0db01b0978

View File

@ -7,15 +7,18 @@ func _ready():
func _input(event): func _input(event):
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE and event.pressed: if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
last_mouse_position = get_global_mouse_position() last_mouse_position = get_global_mouse_position()
elif event.button_index == MOUSE_BUTTON_MIDDLE and not event.pressed: elif event.button_index == MOUSE_BUTTON_RIGHT and not event.pressed:
last_mouse_position = Vector2.ZERO last_mouse_position = Vector2.ZERO
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed: if event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed:
zoom_towards_mouse(Vector2(0.9, 0.9)) zoom_towards_mouse(Vector2(0.9, 0.9))
elif event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed: elif event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed:
zoom_towards_mouse(Vector2(1.1, 1.1)) zoom_towards_mouse(Vector2(1.1, 1.1))
elif event is InputEventPanGesture:
zoom_towards_mouse(event.delta[1])
elif event is InputEventMouseMotion: elif event is InputEventMouseMotion:
if last_mouse_position != Vector2.ZERO: if last_mouse_position != Vector2.ZERO:
var mouse_motion = event.relative var mouse_motion = event.relative