(ev: any)
| 23 | let lastTouchEvent = 0; |
| 24 | |
| 25 | const handleTouchStart = (ev: any) => { |
| 26 | lastTouchEvent = Date.now() + MOUSE_WAIT; |
| 27 | if (!pointerDown(ev)) { |
| 28 | return; |
| 29 | } |
| 30 | if (!rmTouchMove && pointerMove) { |
| 31 | rmTouchMove = addEventListener(el, 'touchmove', pointerMove, options); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Events are dispatched on the element that is tapped and bubble up to |
| 36 | * the reference element in the gesture. In the event that the element this |
| 37 | * event was first dispatched on is removed from the DOM, the event will no |
| 38 | * longer bubble up to our reference element. This leaves the gesture in an |
| 39 | * unusable state. To account for this, the touchend and touchcancel listeners |
| 40 | * should be added to the event target so that they still fire even if the target |
| 41 | * is removed from the DOM. |
| 42 | */ |
| 43 | if (!rmTouchEnd) { |
| 44 | rmTouchEnd = addEventListener(ev.target, 'touchend', handleTouchEnd, options); |
| 45 | } |
| 46 | if (!rmTouchCancel) { |
| 47 | rmTouchCancel = addEventListener(ev.target, 'touchcancel', handleTouchEnd, options); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | const handleMouseDown = (ev: any) => { |
| 52 | if (lastTouchEvent > Date.now()) { |
nothing calls this directly
no test coverage detected