aboutsummaryrefslogtreecommitdiff
path: root/touch_vertical_container
diff options
context:
space:
mode:
Diffstat (limited to 'touch_vertical_container')
-rw-r--r--touch_vertical_container/touch_vertical_container.gd6
1 files changed, 5 insertions, 1 deletions
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