From ed7a1a590479eb9d10afe4d2b45ebd51f0084cf2 Mon Sep 17 00:00:00 2001 From: joni <johnfshaughnessy@gmail.com> Date: Wed, 9 May 2018 13:44:24 -0700 Subject: [PATCH] Fix bug where activeTouch.identifier is accessed but activeTouch is null. --- src/components/cursor-controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/cursor-controller.js b/src/components/cursor-controller.js index f50a67e21..a66fd059b 100644 --- a/src/components/cursor-controller.js +++ b/src/components/cursor-controller.js @@ -38,6 +38,7 @@ AFRAME.registerComponent("cursor-controller", { this.origin = new THREE.Vector3(); this.direction = new THREE.Vector3(); this.controllerQuaternion = new THREE.Quaternion(); + this.activeTouch = null; this.data.cursor.setAttribute("material", { color: this.data.cursorColorUnhovered }); @@ -298,7 +299,7 @@ AFRAME.registerComponent("cursor-controller", { const touch = e.touches[i]; if ( (!this.activeTouch && touch.clientY / window.innerHeight < 0.8) || - touch.identifier === this.activeTouch.identifier + (this.activeTouch && touch.identifier === this.activeTouch.identifier) ) { this.mousePos.set(touch.clientX / window.innerWidth * 2 - 1, -(touch.clientY / window.innerHeight) * 2 + 1); return; -- GitLab