* Simulate a mouse event based on a corresponding touch event * @param {Object} e A touch event * @param {String} simulatedType The corresponding mouse event
(e: TouchEvent, simulatedType: string)
| 46 | * @param {String} simulatedType The corresponding mouse event |
| 47 | */ |
| 48 | function simulateMouseEvent(e: TouchEvent, simulatedType: string) { |
| 49 | |
| 50 | // Ignore multi-touch events |
| 51 | if (e.touches.length > 1) return; |
| 52 | |
| 53 | // Prevent "Ignored attempt to cancel a touchmove event with cancelable=false" errors |
| 54 | if (e.cancelable) e.preventDefault(); |
| 55 | |
| 56 | // Dispatch the simulated event to the target element |
| 57 | Utils.simulateMouseEvent(e.changedTouches[0], simulatedType); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Simulate a mouse event based on a corresponding Pointer event |
no test coverage detected