merge search result text. save draw calls + less updates

This commit is contained in:
Kevin Ngo
2018-10-05 04:17:33 -07:00
parent 3987ff2d33
commit 696a1b979b
3 changed files with 69 additions and 22 deletions

View File

@@ -78,3 +78,19 @@ AFRAME.registerComponent('search-result-image', {
this.el.setAttribute('material', this.materialUpdateObj);
},
});
AFRAME.registerComponent('search-song-name-selected', {
schema: {
anchor: {default: 0},
index: {default: 0},
offset: {default: 0},
selectedChallengeId: {default: ''}
},
update: function () {
const data = this.data;
const el = this.el;
el.object3D.visible = !!data.selectedChallengeId && data.index !== -1;
el.object3D.position.y = data.index * data.offset + data.anchor;
}
});