Skip to content

Commit

Permalink
fix event handling to support webvr and webxr controller apis
Browse files Browse the repository at this point in the history
  • Loading branch information
dbradleyfl committed Jan 28, 2020
1 parent 671fc34 commit 1c22871
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -31,9 +31,9 @@
"author": "Fernando Serrano <[email protected]>",
"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",
Expand Down

0 comments on commit 1c22871

Please sign in to comment.