From 12ca0ad616f5d7c5b7be4bb2347553275f8aab04 Mon Sep 17 00:00:00 2001 From: Filipe Dias Date: Thu, 3 Sep 2020 19:25:49 -0300 Subject: [PATCH 1/2] Implement text update on button component --- src/components/button.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/button.js b/src/components/button.js index 64a8cbe..e511430 100644 --- a/src/components/button.js +++ b/src/components/button.js @@ -104,6 +104,7 @@ AFRAME.registerComponent('gui-button', { }, update: function (oldData) { // console.log("In button update, toggle: "+this.data.toggleState); + this.setText(this.data.text); }, setActiveState: function (activeState) { // console.log("in setActiveState function, new state: " + activeState); From b7e33d1d31203f49f9c495cbbc7cc22e77b17176 Mon Sep 17 00:00:00 2001 From: Paul Cook Date: Sun, 24 Jan 2021 11:18:47 +0100 Subject: [PATCH 2/2] use animation component methods to work on oculus quest --- src/components/cursor.js | 66 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/components/cursor.js b/src/components/cursor.js index 6a2b208..73b6e01 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -286,70 +286,70 @@ AFRAME.registerComponent('gui-cursor', { }); el.addEventListener('mouseleave', function () { - console.log("in gui-cursor mouseleave, el: "+el); + console.log("in gui-cursor mouseleave, el: " + el); el.emit('leavegui'); if (data.design == 'dot' || data.design == 'ring') { cursorShadow.emit('leavegui'); - }else if (data.design == 'cross') { + } else if (data.design == 'cross') { cursorVerticalTop.emit('leavegui'); cursorVerticalBottom.emit('leavegui'); cursorHorizontalLeft.emit('leavegui'); cursorHorizontalRight.emit('leavegui'); - }else if (data.design == 'reticle') { + } else if (data.design == 'reticle') { centerHoverAniOpacity.emit('leavegui'); cursorHoverAniColor.emit('leavegui'); cursorHoverAniOpacity.emit('leavegui'); } - if(fuse){ - fuseLoader.object3D.el.components.animation.animation.pause(); - fuseLoader.object3D.el.components.animation.animation.seek(0); + if (fuse) { + fuseLoader.components.animation.pauseAnimation(); + fuseLoader.setAttribute('geometry','thetaLength','0'); } el.setAttribute('scale', '1 1 1'); }); - if(fuse){ - el.addEventListener('fusing', function () { - fuseLoader.object3D.el.components.animation.animation.play(); + if (fuse) { + el.addEventListener('fusing', function (evt) { + console.log("evt.detail " + evt.detail, evt); + fuseLoader.components.animation.beginAnimation(); }); } el.addEventListener("stateremoved", function (evt) { - console.log("evt.detail " +evt.detail) - if (evt.detail.state === 'cursor-fusing' || evt.detail === 'cursor-fusing') { - if(data.design == 'dot' || data.design == 'ring' || data.design == 'cross' ){ - if(fuse){ - fuseLoader.object3D.el.components.animation.animation.pause(); - fuseLoader.object3D.el.components.animation.animation.seek(0); - AFRAME.utils.entity.setComponentProperty(fuseLoader, 'geometry.thetaLength', '0'); + console.log("evt.detail " + evt.detail, evt); + if (evt.detail === 'cursor-fusing') { + if (data.design == 'dot' || data.design == 'ring' || data.design == 'cross') { + if (fuse) { + fuseLoader.components.animation.pauseAnimation(); + fuseLoader.setAttribute('geometry','thetaLength','0'); + + } + } else if (data.design == 'reticle') { + if (fuse) { + fuseLoader.components.animation.pauseAnimation(); + fuseLoader.setAttribute('geometry','thetaLength','0'); + fuseLoader.setAttribute('geometry','width','0.000001'); } - }else if(data.design == 'reticle'){ - if(fuse){ - fuseLoader.object3D.el.components.animation.animation.pause(); - fuseLoader.object3D.el.components.animation.animation.seek(0); - AFRAME.utils.entity.setComponentProperty(fuseLoader, 'geometry.width', '0.000001'); - } } - }else if(evt.detail.state === 'cursor-hovering' || evt.detail === 'cursor-hovering') { - if(data.design == 'dot' || data.design == 'ring' ){ + } else if (evt.detail === 'cursor-hovering') { + if (data.design == 'dot' || data.design == 'ring') { AFRAME.utils.entity.setComponentProperty(this, 'scale', '1 1 1'); - if(fuse){ - AFRAME.utils.entity.setComponentProperty(fuseLoader, 'geometry.thetaLength', '0'); + if (fuse) { + fuseLoader.setAttribute('geometry','thetaLength','0'); } - }else if(data.design == 'cross' ){ - if(fuse){ - AFRAME.utils.entity.setComponentProperty(fuseLoader, 'geometry.thetaLength', '0'); + } else if (data.design == 'cross') { + if (fuse) { + fuseLoader.setAttribute('geometry','thetaLength','0'); } - }else if(data.design == 'reticle' ){ - if(fuse){ - AFRAME.utils.entity.setComponentProperty(fuseLoader, 'geometry.width', '0.000001'); + } else if (data.design == 'reticle') { + if (fuse) { + fuseLoader.setAttribute('geometry','width','0.000001'); } } } }); - }, update: function () { },