diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/menu/scroll_container_custom.gd | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/client/menu/scroll_container_custom.gd b/client/menu/scroll_container_custom.gd index 4908299e..b3ce4e46 100644 --- a/client/menu/scroll_container_custom.gd +++ b/client/menu/scroll_container_custom.gd @@ -19,11 +19,15 @@ class_name ScrollContainerCustom # Adds support for scrolling with joypad and touch const SCROLL_SPEED := 1000. +var velocity := 0. func _process(delta): + velocity = G.interpolate(velocity, 0., delta * 5.) + velocity = 0 if abs(velocity) < .001 else velocity if Input.get_axis("scroll_up", "scroll_down") != 0.: - set_deferred("scroll_vertical", scroll_vertical + Input.get_axis("scroll_up", "scroll_down") * delta * SCROLL_SPEED) + velocity = Input.get_axis("scroll_up", "scroll_down") + set_deferred("scroll_vertical", scroll_vertical + velocity * delta * SCROLL_SPEED) func _input(event): if event is InputEventScreenDrag: - set_deferred("scroll_vertical", scroll_vertical - event.relative.y) + velocity = -(scroll_vertical - (scroll_vertical - event.relative.y)) * .1 |