diff options
| author | dam <dam@gudinoff> | 2022-02-22 00:10:01 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-02-22 00:10:01 +0000 |
| commit | 0de881ffb462b32e4c6e59134868a1adaafc9873 (patch) | |
| tree | cc93f7cf35034464d9ee1cac7af1e6fc728397b6 | |
| parent | ffcc5bf2cabd03518ad4606914b011c286a8e0bc (diff) | |
| download | surgery-log-0de881ffb462b32e4c6e59134868a1adaafc9873.tar.zst surgery-log-0de881ffb462b32e4c6e59134868a1adaafc9873.zip | |
Improve feedback when releasing touch scroll.
| -rw-r--r-- | touch_item_list/touch_item_list.gd | 3 | ||||
| -rw-r--r-- | touch_vertical_container/touch_vertical_container.gd | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/touch_item_list/touch_item_list.gd b/touch_item_list/touch_item_list.gd index 2b18eae..5a1279c 100644 --- a/touch_item_list/touch_item_list.gd +++ b/touch_item_list/touch_item_list.gd @@ -2,6 +2,7 @@ extends ItemList class_name TouchItemList const POINTER_VELOCITY_DECAYING_FACTOR: float = 2.5 +const POINTER_VELOCITY_BOOST_FACTOR: float = 1.5 const EXACT_SELECTION: bool = false var is_pointer_dragging := false @@ -33,7 +34,7 @@ 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_drag_velocity = pointer.velocity.y * POINTER_VELOCITY_BOOST_FACTOR v_scroll_bar.value -= pointer.relative_position.y diff --git a/touch_vertical_container/touch_vertical_container.gd b/touch_vertical_container/touch_vertical_container.gd index df89e7f..2a1a92a 100644 --- a/touch_vertical_container/touch_vertical_container.gd +++ b/touch_vertical_container/touch_vertical_container.gd @@ -2,6 +2,7 @@ extends ScrollContainer class_name TouchVerticalContainer const POINTER_VELOCITY_DECAYING_FACTOR: float = 2.5 +const POINTER_VELOCITY_BOOST_FACTOR: float = 1.5 var is_pointer_dragging := false var pointer_drag_velocity := 0.0 @@ -49,7 +50,7 @@ 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_drag_velocity = pointer.velocity.y * POINTER_VELOCITY_BOOST_FACTOR self.scroll_vertical -= pointer.relative_position.y |
