(ev: any)
| 299 | }; |
| 300 | |
| 301 | export const pointerCoord = (ev: any): { x: number; y: number } => { |
| 302 | // get X coordinates for either a mouse click |
| 303 | // or a touch depending on the given event |
| 304 | if (ev) { |
| 305 | const changedTouches = ev.changedTouches; |
| 306 | if (changedTouches && changedTouches.length > 0) { |
| 307 | const touch = changedTouches[0]; |
| 308 | return { x: touch.clientX, y: touch.clientY }; |
| 309 | } |
| 310 | if (ev.pageX !== undefined) { |
| 311 | return { x: ev.pageX, y: ev.pageY }; |
| 312 | } |
| 313 | } |
| 314 | return { x: 0, y: 0 }; |
| 315 | }; |
| 316 | |
| 317 | /** |
| 318 | * @hidden |
no outgoing calls
no test coverage detected