start integrating search into menu
This commit is contained in:
@@ -3,6 +3,6 @@ AFRAME.registerComponent('keyboard-raycastable', {
|
||||
|
||||
play: function () {
|
||||
this.el.components['super-keyboard'].kbImg.setAttribute('bind-toggle__raycastable',
|
||||
'keyboardActive');
|
||||
'isSearching');
|
||||
}
|
||||
});
|
||||
|
||||
38
src/components/menu-slide-animation.js
Normal file
38
src/components/menu-slide-animation.js
Normal file
@@ -0,0 +1,38 @@
|
||||
AFRAME.registerComponent('menu-slide-animation', {
|
||||
schema: {
|
||||
isSearching: {default: false},
|
||||
menuSelectedChallengeId: {type: 'string'}
|
||||
},
|
||||
|
||||
init: function () {
|
||||
this.isOpen = false; // Means toleft.
|
||||
},
|
||||
|
||||
update: function (oldData) {
|
||||
const data = this.data;
|
||||
|
||||
if (this.isOpen) {
|
||||
// Unselect.
|
||||
if (oldData.menuSelectedChallengeId && !data.menuSelectedChallengeId) { this.closeMenu(); }
|
||||
// Keyboard close.
|
||||
if (oldData.isSearching && !data.isSearching) { this.closeMenu(); }
|
||||
}
|
||||
|
||||
if (!this.isOpen) {
|
||||
// Select.
|
||||
if (!oldData.menuSelectedChallengeId && data.menuSelectedChallengeId) { this.openMenu(); }
|
||||
// Keyboard open.
|
||||
if (!oldData.isSearching && data.isSearching) { this.openMenu(); }
|
||||
}
|
||||
},
|
||||
|
||||
closeMenu: function () {
|
||||
this.el.components.animation__menuright.beginAnimation();
|
||||
this.isOpen = false;
|
||||
},
|
||||
|
||||
openMenu: function () {
|
||||
this.el.components.animation__menuleft.beginAnimation();
|
||||
this.isOpen = true;
|
||||
}
|
||||
});
|
||||
@@ -36,6 +36,11 @@ AFRAME.registerComponent('song-preview-system', {
|
||||
return;
|
||||
}
|
||||
|
||||
// Unselect.
|
||||
if (oldData.selectedChallengeId && !data.selectedChallengeId) {
|
||||
this.stopSong();
|
||||
}
|
||||
|
||||
// Song finished loading.
|
||||
// Continue to play preview song during loading to keep entertained.
|
||||
if (oldData.isSongLoading && !data.isSongLoading) {
|
||||
|
||||
@@ -30,4 +30,4 @@ AFRAME.registerComponent('stage-lasers', {
|
||||
this.lasers[1].rotation.z -= this.speed * delta * 1.01;
|
||||
this.lasers[2].rotation.z += this.speed * delta * 1.02;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user