1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

fix "TouchEvent is not defined"

This commit is contained in:
Kevin Levron 2021-04-29 21:41:51 +02:00
parent 80c9ab4bd3
commit 2699ce8dfe

View File

@ -100,7 +100,8 @@ export default function usePointer(options: PointerConfigInterface): PointerInte
function updatePosition(event: TouchEvent | MouseEvent) { function updatePosition(event: TouchEvent | MouseEvent) {
let x, y let x, y
if (event instanceof TouchEvent && event.touches && event.touches.length > 0) { // @ts-ignore
if (event.touches && event.touches.length > 0) {
x = (<TouchEvent>event).touches[0].clientX x = (<TouchEvent>event).touches[0].clientX
y = (<TouchEvent>event).touches[0].clientY y = (<TouchEvent>event).touches[0].clientY
} else { } else {