diff options
| author | dam <dam@gudinoff> | 2022-02-22 02:17:00 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-02-22 02:17:00 +0000 |
| commit | 9296ffd6ef1f8fcc1bbb12332fdc9480ff18c68b (patch) | |
| tree | 47f13d200bada167aa66db44f243dfb84dc52309 /touch_vertical_container/touch_vertical_container.gd | |
| parent | fd49e7c53a20728b3c6328141fdb8d63da1dff65 (diff) | |
| download | surgery-log-9296ffd6ef1f8fcc1bbb12332fdc9480ff18c68b.tar.zst surgery-log-9296ffd6ef1f8fcc1bbb12332fdc9480ff18c68b.zip | |
Improve touch scroll for quick-small-touches.
Diffstat (limited to 'touch_vertical_container/touch_vertical_container.gd')
| -rw-r--r-- | touch_vertical_container/touch_vertical_container.gd | 6 |
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 |
