From 1c22871d425ed96bcd59c7ae310532044cc35ae3 Mon Sep 17 00:00:00 2001 From: Devon Bradley Date: Sun, 12 Jan 2020 17:25:23 -0800 Subject: [PATCH] fix event handling to support webvr and webxr controller apis --- index.js | 6 ++++-- package.json | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 69eb352a..9d94582d 100644 --- a/index.js +++ b/index.js @@ -230,8 +230,10 @@ AFRAME.registerComponent('teleport-controls', { })(), handleAxis: function (evt) { - const axisX = parseInt(evt.detail.axis[2] * 10) - const axisY = parseInt(evt.detail.axis[3] * 10) + if (!evt.detail.axis || !evt.detail.axis.length) return + const xr = evt.detail.axis.length === 4 + const axisX = parseInt(evt.detail.axis[xr ? 2 : 0] * 10) + const axisY = parseInt(evt.detail.axis[xr ? 3 : 1] * 10) if (axisX === 0 && axisY === 0) { this.onButtonUp(evt) } else if (Math.abs(axisX) <= 1 && axisY === -9) { diff --git a/package.json b/package.json index 0d25d25f..566b676b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/dbradleyfl/aframe-teleport-controls.git" + "url": "git+https://github.com/fernandojsg/aframe-teleport-controls.git" }, "keywords": [ "aframe", @@ -31,9 +31,9 @@ "author": "Fernando Serrano ", "license": "MIT", "bugs": { - "url": "https://github.com/dbradleyfl/aframe-teleport-controls/issues" + "url": "https://github.com/fernandojsg/aframe-teleport-controls/issues" }, - "homepage": "https://github.com/dbradleyfl/aframe-teleport-controls#readme", + "homepage": "https://github.com/fernandojsg/aframe-teleport-controls#readme", "devDependencies": { "aframe": "*", "browserify": "^13.0.0",