diff --git a/src/EventTarget.js b/src/EventTarget.js index d6e5ca7..ea1254d 100644 --- a/src/EventTarget.js +++ b/src/EventTarget.js @@ -6,11 +6,14 @@ class Touch { // Touch{identifier, pageX, pageY, clientX, clientY, force} this.identifier = touch.identifier + const doubleQuestionFunc = (valueA, valueB) => + valueA !== null && valueA !== void 0 ? valueA : valueB; this.force = touch.force === undefined ? 1 : touch.force - this.pageX = touch.pageX || touch.x - this.pageY = touch.pageY || touch.y - this.clientX = touch.clientX || touch.x - this.clientY = touch.clientY || touch.y + + this.pageX = doubleQuestionFunc(touch.pageX, touch.x); + this.pageY = doubleQuestionFunc(touch.pageY, touch.y); + this.clientX = doubleQuestionFunc(touch.clientX, touch.x); + this.clientY = doubleQuestionFunc(touch.clientY, touch.y); this.screenX = this.pageX this.screenY = this.pageY diff --git a/src/index.js b/src/index.js index 6fd0b90..66acbbd 100644 --- a/src/index.js +++ b/src/index.js @@ -59,7 +59,7 @@ export function createScopedThreejs(canvas) { const exports = {}; // eslint-disable-next-line - const HTMLCanvasElement = undefined + const HTMLCanvasElement = undefined; // three.js source code will be injected here // eslint-disable-next-line