Skip to content

Commit

Permalink
Send event info on touched event
Browse files Browse the repository at this point in the history
  • Loading branch information
arturitu committed Feb 27, 2018
1 parent 676555a commit 50326e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dist/aframe-xr.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ AFRAME.registerSystem('xr', {
}
}

this.el.emit('xrInitialized');

var options = {
// Flag to start AR if is the unique display available.
AR_AUTOSTART: this.data.arAutostart // Default: true
Expand All @@ -185,6 +183,8 @@ AFRAME.registerSystem('xr', {
this.addEnterButtons(displays);
}
}

this.el.emit('xrInitialized');
},

// NOW it only supports one VR and one AR display
Expand Down Expand Up @@ -550,7 +550,7 @@ AFRAME.registerComponent('reticle', {
return;
}
this.tapData = [ev.touches[0].clientX / window.innerWidth, ev.touches[0].clientY / window.innerHeight];
this.el.emit('touched');
this.el.emit('touched', ev);
},

updateFrame: function updateFrame(data) {
Expand All @@ -563,6 +563,7 @@ AFRAME.registerComponent('reticle', {
if (hit && hit.length > 0) {
if (this.el.getAttribute('visible') === false) {
this.el.setAttribute('visible', true);
this.el.emit('planeDetected');
window.addEventListener('touchstart', this.onTouchStart);
}
model.fromArray(hit[0].modelMatrix);
Expand Down
3 changes: 2 additions & 1 deletion src/components/reticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AFRAME.registerComponent('reticle', {
ev.touches[0].clientX / window.innerWidth,
ev.touches[0].clientY / window.innerHeight
];
this.el.emit('touched');
this.el.emit('touched', ev);
},

updateFrame: function (data) {
Expand All @@ -35,6 +35,7 @@ AFRAME.registerComponent('reticle', {
if (hit && hit.length > 0) {
if (this.el.getAttribute('visible') === false) {
this.el.setAttribute('visible', true);
this.el.emit('planeDetected');
window.addEventListener('touchstart', this.onTouchStart);
}
model.fromArray(hit[0].modelMatrix);
Expand Down
4 changes: 2 additions & 2 deletions src/systems/xr.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ AFRAME.registerSystem('xr', {
}
}

this.el.emit('xrInitialized');

var options = {
// Flag to start AR if is the unique display available.
AR_AUTOSTART: this.data.arAutostart // Default: true
Expand All @@ -97,6 +95,8 @@ AFRAME.registerSystem('xr', {
this.addEnterButtons(displays);
}
}

this.el.emit('xrInitialized');
},

// NOW it only supports one VR and one AR display
Expand Down

0 comments on commit 50326e4

Please sign in to comment.