From 1e41e2dbeb4d584cb3eba7ce504a6e8ae7443cb8 Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Thu, 6 Aug 2020 15:10:41 +0100 Subject: [PATCH 1/2] lint --- src/xr/xr-hand.js | 1 + src/xr/xr-joint.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xr/xr-hand.js b/src/xr/xr-hand.js index 9f58bf94104..4e2559379ce 100644 --- a/src/xr/xr-hand.js +++ b/src/xr/xr-hand.js @@ -14,6 +14,7 @@ var vecB = new Vec3(); var vecC = new Vec3(); if (window.XRHand) { + var XRHand = window.XRHand; fingerJointIds = [ [XRHand.THUMB_METACARPAL, XRHand.THUMB_PHALANX_PROXIMAL, XRHand.THUMB_PHALANX_DISTAL, XRHand.THUMB_PHALANX_TIP], [XRHand.INDEX_METACARPAL, XRHand.INDEX_PHALANX_PROXIMAL, XRHand.INDEX_PHALANX_INTERMEDIATE, XRHand.INDEX_PHALANX_DISTAL, XRHand.INDEX_PHALANX_TIP], diff --git a/src/xr/xr-joint.js b/src/xr/xr-joint.js index a8989368745..b986634b65d 100644 --- a/src/xr/xr-joint.js +++ b/src/xr/xr-joint.js @@ -3,11 +3,11 @@ import { Quat } from '../math/quat.js'; import { Vec3 } from '../math/vec3.js'; var tipJointIds = window.XRHand ? [ - XRHand.THUMB_PHALANX_TIP, - XRHand.INDEX_PHALANX_TIP, - XRHand.MIDDLE_PHALANX_TIP, - XRHand.RING_PHALANX_TIP, - XRHand.LITTLE_PHALANX_TIP + window.XRHand.THUMB_PHALANX_TIP, + window.XRHand.INDEX_PHALANX_TIP, + window.XRHand.MIDDLE_PHALANX_TIP, + window.XRHand.RING_PHALANX_TIP, + window.XRHand.LITTLE_PHALANX_TIP ] : []; var tipJointIdsIndex = {}; @@ -43,7 +43,7 @@ function XrJoint(index, id, hand, finger) { this._finger = finger || null; if (this._finger) this._finger._joints.push(this); - this._wrist = id === XRHand.WRIST; + this._wrist = id === window.XRHand.WRIST; if (this._wrist) this._hand._wrist = this; this._tip = this._finger && !! tipJointIdsIndex[id]; From 7c85f63d8b50679b1a5fc62835d6a613634cfa2a Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Thu, 6 Aug 2020 15:21:00 +0100 Subject: [PATCH 2/2] add XRHand to externs --- externs.js | 1 + src/xr/xr-hand.js | 1 - src/xr/xr-joint.js | 12 ++++++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/externs.js b/externs.js index 961c9d6e6c0..8da42a7128b 100644 --- a/externs.js +++ b/externs.js @@ -15,6 +15,7 @@ var WebAssembly = {}; // WebXR var XRWebGLLayer = {}; var XRRay = {}; +var XRHand = {}; var DOMPoint = {}; // extras requires this diff --git a/src/xr/xr-hand.js b/src/xr/xr-hand.js index 4e2559379ce..9f58bf94104 100644 --- a/src/xr/xr-hand.js +++ b/src/xr/xr-hand.js @@ -14,7 +14,6 @@ var vecB = new Vec3(); var vecC = new Vec3(); if (window.XRHand) { - var XRHand = window.XRHand; fingerJointIds = [ [XRHand.THUMB_METACARPAL, XRHand.THUMB_PHALANX_PROXIMAL, XRHand.THUMB_PHALANX_DISTAL, XRHand.THUMB_PHALANX_TIP], [XRHand.INDEX_METACARPAL, XRHand.INDEX_PHALANX_PROXIMAL, XRHand.INDEX_PHALANX_INTERMEDIATE, XRHand.INDEX_PHALANX_DISTAL, XRHand.INDEX_PHALANX_TIP], diff --git a/src/xr/xr-joint.js b/src/xr/xr-joint.js index b986634b65d..a8989368745 100644 --- a/src/xr/xr-joint.js +++ b/src/xr/xr-joint.js @@ -3,11 +3,11 @@ import { Quat } from '../math/quat.js'; import { Vec3 } from '../math/vec3.js'; var tipJointIds = window.XRHand ? [ - window.XRHand.THUMB_PHALANX_TIP, - window.XRHand.INDEX_PHALANX_TIP, - window.XRHand.MIDDLE_PHALANX_TIP, - window.XRHand.RING_PHALANX_TIP, - window.XRHand.LITTLE_PHALANX_TIP + XRHand.THUMB_PHALANX_TIP, + XRHand.INDEX_PHALANX_TIP, + XRHand.MIDDLE_PHALANX_TIP, + XRHand.RING_PHALANX_TIP, + XRHand.LITTLE_PHALANX_TIP ] : []; var tipJointIdsIndex = {}; @@ -43,7 +43,7 @@ function XrJoint(index, id, hand, finger) { this._finger = finger || null; if (this._finger) this._finger._joints.push(this); - this._wrist = id === window.XRHand.WRIST; + this._wrist = id === XRHand.WRIST; if (this._wrist) this._hand._wrist = this; this._tip = this._finger && !! tipJointIdsIndex[id];