fix cursor mesh toggling

This commit is contained in:
Kevin Ngo
2018-10-12 16:19:50 -07:00
parent b2f77d7f70
commit e2a841b7a6
2 changed files with 11 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
*/
AFRAME.registerComponent('cursor-mesh', {
schema: {
active: {default: true},
cursorEl: {type: 'selector'}
},
@@ -10,6 +11,10 @@ AFRAME.registerComponent('cursor-mesh', {
this.scenePivotEl = document.getElementById('scenePivot');
},
update: function () {
this.el.object3D.visible = this.data.active;
},
tick: function () {
var cursor;
var cursorEl = this.data.cursorEl;
@@ -21,6 +26,8 @@ AFRAME.registerComponent('cursor-mesh', {
var object3D = this.el.object3D;
var scenePivotEl = this.scenePivotEl;
if (!this.data.active) { return; }
cursor = cursorEl.components.cursor;
if (!cursor) { return; }