Skip to content

Commit

Permalink
fix toggling on entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mattre committed Apr 3, 2019
1 parent eb3a67b commit a03570b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ AFRAME.registerComponent('toggle-controls', {

update: function (oldData) {
const data = this.data;
this.toggled =data.toggled;
this.toggled = data.toggled;
this.eventCond = data.eventCond && data.eventCond.split('=').length == 2 ? data.eventCond.split('=') : null;
},

Expand Down Expand Up @@ -80,11 +80,14 @@ AFRAME.registerComponent('toggle-controls', {
if (evt[this.eventCond[0]] !== this.eventCond[1]) return;
}

// HACK: listen only on events coming from the canvas
if (
evt.target.tagName === 'A-ENTITY'
|| evt.target.tagName === 'A-SCENE'
/*
evt.target.tagName === 'CANVAS'
|| evt.target.tagName === 'A-SCENE'
|| evt.target.tagName === 'BODY'
*/
) {
if (data.type === 'double') {
if (this.clickTimer == null) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aframe-toggle-controls-component",
"version": "1.1.1",
"version": "1.1.2",
"description": "A Toggle Controls component for A-Frame.",
"main": "index.js",
"unpkg": "dist/aframe-toggle-controls-component.min.js",
Expand Down

0 comments on commit a03570b

Please sign in to comment.