optimise
This commit is contained in:
parent
a9dcb4b850
commit
87542751e4
@ -13,7 +13,7 @@ func _input(event):
|
|||||||
last_mouse_position = get_global_mouse_position()
|
last_mouse_position = get_global_mouse_position()
|
||||||
elif event.button_index == MOUSE_BUTTON_RIGHT 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:
|
elif 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))
|
||||||
@ -31,7 +31,6 @@ func _input(event):
|
|||||||
elif event is InputEventMagnifyGesture:
|
elif event is InputEventMagnifyGesture:
|
||||||
zoom_towards_mouse(Vector2(event.factor,event.factor))
|
zoom_towards_mouse(Vector2(event.factor,event.factor))
|
||||||
|
|
||||||
|
|
||||||
func zoom_towards_mouse(zoom_factor):
|
func zoom_towards_mouse(zoom_factor):
|
||||||
var previous_mouse_position := get_local_mouse_position()
|
var previous_mouse_position := get_local_mouse_position()
|
||||||
zoom *= zoom_factor
|
zoom *= zoom_factor
|
||||||
|
Loading…
Reference in New Issue
Block a user