macbook
This commit is contained in:
parent
b86369c359
commit
a9dcb4b850
13
Camera2D.gd
13
Camera2D.gd
@ -17,11 +17,7 @@ func _input(event):
|
||||
zoom_towards_mouse(Vector2(0.9, 0.9))
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed:
|
||||
zoom_towards_mouse(Vector2(1.1, 1.1))
|
||||
|
||||
elif event is InputEventPanGesture:
|
||||
print("SHITOFF:",event.delta)
|
||||
zoom_towards_mouse(event.delta[1])
|
||||
|
||||
|
||||
elif event is InputEventMouseMotion:
|
||||
if last_mouse_position != Vector2.ZERO:
|
||||
var mouse_motion = event.relative
|
||||
@ -29,6 +25,13 @@ func _input(event):
|
||||
position -= drag_offset
|
||||
last_mouse_position = get_global_mouse_position()
|
||||
|
||||
# Macbook touchpad
|
||||
elif event is InputEventPanGesture:
|
||||
position+=event.delta
|
||||
elif event is InputEventMagnifyGesture:
|
||||
zoom_towards_mouse(Vector2(event.factor,event.factor))
|
||||
|
||||
|
||||
func zoom_towards_mouse(zoom_factor):
|
||||
var previous_mouse_position := get_local_mouse_position()
|
||||
zoom *= zoom_factor
|
||||
|
Loading…
Reference in New Issue
Block a user