From e2a841b7a64947d9ff0612f1a22ccc3ba23df0dd Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Fri, 12 Oct 2018 16:19:50 -0700 Subject: [PATCH] fix cursor mesh toggling --- src/components/cursor-mesh.js | 7 +++++++ src/index.html | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/cursor-mesh.js b/src/components/cursor-mesh.js index c610385..9edbaa7 100644 --- a/src/components/cursor-mesh.js +++ b/src/components/cursor-mesh.js @@ -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; } diff --git a/src/index.html b/src/index.html index 08fad05..9a8b344 100644 --- a/src/index.html +++ b/src/index.html @@ -204,8 +204,8 @@ {% endmacro %} @@ -217,7 +217,8 @@ {% if not IS_PRODUCTION %} - + {% endif %}