From 9296ffd6ef1f8fcc1bbb12332fdc9480ff18c68b Mon Sep 17 00:00:00 2001 From: dam Date: Tue, 22 Feb 2022 02:17:00 +0000 Subject: Improve touch scroll for quick-small-touches. --- touch_vertical_container/touch_vertical_container.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'touch_vertical_container') diff --git a/touch_vertical_container/touch_vertical_container.gd b/touch_vertical_container/touch_vertical_container.gd index 2a1a92a..07b8714 100644 --- a/touch_vertical_container/touch_vertical_container.gd +++ b/touch_vertical_container/touch_vertical_container.gd @@ -50,7 +50,11 @@ func pointer_input_on_press_handler(pointer: PointerInputSensor.PointerInputData func pointer_input_on_drag_handler(pointer: PointerInputSensor.PointerInputData): is_pointer_dragging = true - pointer_drag_velocity = pointer.velocity.y * POINTER_VELOCITY_BOOST_FACTOR + var reported_velocity_abs := abs(pointer.velocity.y) + var relative_velocity := pointer.relative_position.y * Engine.get_frames_per_second() + var relative_velocity_abs := abs(relative_velocity) + var max_velocity := pointer.velocity.y if reported_velocity_abs > relative_velocity_abs else relative_velocity + pointer_drag_velocity = max_velocity * POINTER_VELOCITY_BOOST_FACTOR self.scroll_vertical -= pointer.relative_position.y -- cgit v1.2.3