diff --git a/src/events.ts b/src/events.ts index 146a75dd..4a2f446a 100644 --- a/src/events.ts +++ b/src/events.ts @@ -680,8 +680,8 @@ export class Events { private getEventClientYX(ev, name) { const targetTouch = ev.type === name && ev.targetTouches && (ev.targetTouches[0] || ev.changedTouches[0]); - const clientY: number = ev.type === name ? targetTouch.clientY : ev.clientY; - const clientX: number = ev.type === name ? targetTouch.clientX : ev.clientX; + const clientY: number = (ev.type === name && targetTouch) ? targetTouch.clientY : ev.clientY; + const clientX: number = (ev.type === name && targetTouch) ? targetTouch.clientX : ev.clientX; const timeDiff: number = (Date.now()) - (this.steps[this.steps.length - 1]?.time || 0); const distanceY: number = Math.abs(clientY - (this.steps[this.steps.length - 1]?.posY || 0)); const velocityY: number = distanceY / timeDiff;