Touchstart, touchmove, touchend and touchcancel on an list item event listener
The constructor
| Name | Type | Description |
|---|---|---|
| dropFunction | Function | The function to call when an item is droped |
Event listener method
| Name | Type | Description |
|---|---|---|
| touchEvent | Event | The event to handle |
The Y position in pixels where the bottom scroll will start
A clone of the html element selected for dragging
The X distance betwwen the touch point and the top left corner of the moved item
The Y distance betwwen the touch point and the top left corner of the moved item
The function to call when an item is droped
A boolean - true when the drop point is on top of the target and false when at bottom
The drop target
A boolean to store if the event was generated with a double click or not
The timestamp of the last scroll action
The timestamp of the last touchstart event
The container with the scroll bars
The container of the displayed list
The Y position in pixels where the top scroll will start
The Y position in pixels of the current touch event
A constant giving the distance in pixel betwwen the bottom of the container and the place where the scroll will start
A constant giving the max delay in ms between 2 clicks to consider it's a double click
A constant giving the delay in ms betwwen two scroll actions for the requestAnimationFrame ( ) method See also https://developer.mozilla.org/fr/docs/Web/API/Document/scroll_event
A constant giving the number of pixels to scroll
A constant giving the distance in pixel betwwen the top of the container and the place where the scroll will start
Handle the touchend event
| Name | Type | Description |
|---|---|---|
| touchEvent | Event | The event to handle |
Handle the touchmove event
| Name | Type | Description |
|---|---|---|
| touchEvent | Event | The event to handle |
Handle the touchstart event
| Name | Type | Description |
|---|---|---|
| touchEvent | Event | The event to handle |
Reset some variables after a touchend or touchcancel event
Scroll the list container to the bottom
| Name | Type | Description |
|---|---|---|
| scrollTimeStamp | Number | The time stamp of the call to the method. See window.requestAnimationFrame ( ) |
Scroll the list container to the top
| Name | Type | Description |
|---|---|---|
| scrollTimeStamp | Number | The time stamp of the call to the method. See window.requestAnimationFrame ( ) |
Set the drop target and the drop position from the touch of the dragend event
| Name | Type | Description |
|---|---|---|
| touch | Touch | The dragend event touch |