diff --git a/package-lock.json b/package-lock.json index 1c3c972..d1cd8cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -148,12 +148,9 @@ "integrity": "sha1-+w+EQdrdHosRzCRRK6eqaS1iK+E=" }, "aframe-state-component": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/aframe-state-component/-/aframe-state-component-4.5.0.tgz", - "integrity": "sha512-jo7GG3ILwWW0zvaf8A2/30zLYyiqNJK/pBLZwGa/y6Xo3FWYgDL30stEHJslka4MtQNK7ONWPOA8mfQTwWUDjg==", - "requires": { - "aframe": "github:aframevr/aframe#2afb6ac191f1a44edbbfe6f0e733380356a9e0c8" - } + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/aframe-state-component/-/aframe-state-component-4.6.0.tgz", + "integrity": "sha512-sth2BuNuw1Z7wb4HclkD3EJDJ5cYDFOkKCPobih63kw+L8ulhx0G1qEcCMg5JFEvK/Xn7SwpJMKfhJHMlGypMg==" }, "aframe-super-keyboard": { "version": "2.0.0", diff --git a/package.json b/package.json index 825a679..2b3bc60 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "aframe-particle-system-component": "^1.0.11", "aframe-proxy-event-component": "^1.1.1", "aframe-slice9-component": "^1.0.0", - "aframe-state-component": "^4.5.0", + "aframe-state-component": "^4.6.0", "aframe-super-keyboard": "^2.0.0", "algoliasearch": "^3.29.0", "ansi-html": "0.0.7", diff --git a/src/components/active-color.js b/src/components/active-color.js new file mode 100644 index 0000000..afcb265 --- /dev/null +++ b/src/components/active-color.js @@ -0,0 +1,24 @@ +/** + * Acitve color. + */ +AFRAME.registerComponent('active-color', { + dependencies: ['material'], + + schema: { + active: {default: false}, + color: {default: '#4BF'} + }, + + init: function () { + this.defaultColor = this.el.getAttribute('material').color; + }, + + update: function () { + var el = this.el; + if (this.data.active) { + el.setAttribute('material', 'color', this.data.color); + } else { + el.setAttribute('material', 'color', this.defaultColor); + } + }, +}); diff --git a/src/components/menu-difficulty-select.js b/src/components/menu-difficulty-select.js index 8235974..38779a9 100644 --- a/src/components/menu-difficulty-select.js +++ b/src/components/menu-difficulty-select.js @@ -1,34 +1,5 @@ var bindEvent = require('aframe-event-decorators').bindEvent; -/** - * Select difficulty. - */ -AFRAME.registerComponent('menu-difficulty-option', { - dependencies: ['material'], - - schema: { - activeDifficulty: {default: ''} - }, - - init: function () { - this.defaultColor = this.el.getAttribute('material').color; - }, - - update: function () { - var el = this.el; - let optionValue = this.el.closest('[data-bind-for-value]').dataset.bindForValue; - if (optionValue === this.data.activeDifficulty) { - el.setAttribute('animation__mouseenter', 'enabled', false); - el.setAttribute('animation__mouseleave', 'enabled', false); - el.setAttribute('material', 'color', '#4BF'); - } else { - el.setAttribute('material', 'color', this.defaultColor); - el.setAttribute('animation__mouseenter', 'enabled', true); - el.setAttribute('animation__mouseleave', 'enabled', true); - } - }, -}); - /** * Select difficulty. */ diff --git a/src/index.html b/src/index.html index f15cd89..db71618 100644 --- a/src/index.html +++ b/src/index.html @@ -2,7 +2,7 @@ Supersaber - + diff --git a/src/templates/menu.html b/src/templates/menu.html index 3a55199..c17ae03 100644 --- a/src/templates/menu.html +++ b/src/templates/menu.html @@ -20,6 +20,9 @@