How to set scroll container's drag speed manually.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pixistone

the default speed of scroll containers scrolling is too speedy and sensitive,
how can I set scroll speed manually…?

:bust_in_silhouette: Reply From: Ertain

It looks like a ScrollContainer uses a ScrollBar (VScrollBar and HScrollBar) when needing to move the contents of the container vertically and horizontally. It looks like the custom_step property is used when moving the scroll bars. Maybe that will help you with controlling the speed of scrolling?

:bust_in_silhouette: Reply From: pixistone

i found the answer my self… here help yourself…

extends ScrollContainer

var end_point: int
var start_point: int
var relative: int
onready var tween = get_node(“Tween”)

func _input(event):
if event is InputEventScreenTouch:
if event.pressed == true:
pass
elif event.pressed == false:
end_point = self.get_v_scroll()
if relative <0 and relative <= -10:
start_point = end_point + relative * -10
elif relative > 0 and relative >= 10:
start_point = end_point - relative * 10
else:
start_point = end_point
self.set_v_scroll(end_point)
tween.interpolate_property(self,“scroll_vertical”,end_point,start_point,.3,Tween.TRANS_CUBIC,Tween.EASE_OUT)
tween.start()
if event is InputEventScreenDrag:
relative = event.get_relative().y