Skip to content

Commit

Permalink
notargets option to allow/fix ability to remove targets
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebakerio committed Aug 25, 2021
1 parent 37e912f commit fce0072
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vr-super-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ AFRAME.registerComponent("vr-super-stats", {
stringify: JSON.stringify
},


notargets: { type: "boolean", default: false },
// thrown in are some sane defaults. This library is written/expects all stats to be given in lowercase everywhere, they will be uppercased as needed.
// note that you can only have one or the other defined for a given property; for performance, only one will be checked per property. to maximize performance, set no targets.
targetmax: {
Expand Down Expand Up @@ -144,7 +146,7 @@ AFRAME.registerComponent("vr-super-stats", {
console.warn("init vr-super-stats")
}

this.haveTargets = !!(Object.keys(this.data.targetmax).length + Object.keys(this.data.targetmin).length)
this.haveTargets = !this.data.notargets && !!(Object.keys(this.data.targetmax).length + Object.keys(this.data.targetmin).length)
this.canvasParent = document.createElement('div');
this.canvasParent.setAttribute('id','vr-super-stats-canvas-parent')
this.sceneEl = AFRAME.scenes[0]
Expand All @@ -156,6 +158,8 @@ AFRAME.registerComponent("vr-super-stats", {
this.data.show2dstats = false
this.data.color = "white"
this.data.targets = {}
this.data.notargets = true
this.haveTargets = false
}

AFRAME.scenes[0].addEventListener('enter-vr', async () => {
Expand Down

0 comments on commit fce0072

Please sign in to comment.