From fa0487ca0917d38c2bacb47fe0bfca585777a453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Awistak?= Date: Mon, 25 Jan 2021 13:23:01 +0800 Subject: [PATCH 1/2] Update EventTarget.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 当 pageX(Y) 或 clientX(Y) 为 0 时造成 this.pageX(Y) 和 this.clientX(Y) 的值为undefined 的问题。 --- src/EventTarget.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 From 85c6b886379c81a208140a2cb90ddd27e9739381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Awistak?= Date: Mon, 25 Jan 2021 14:08:31 +0800 Subject: [PATCH 2/2] fix TypeError: (void 0) is not a function fix TypeError: (void 0) is not a function --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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