don't use atlas for menu selected challenge image because pagination...perhaps can use for dialog image

This commit is contained in:
Kevin Ngo
2018-10-07 02:29:21 -07:00
parent 6416d24d2e
commit f169398e32
7 changed files with 43 additions and 29 deletions

View File

@@ -1,27 +1,13 @@
/**
* Reuse images from the search result.
*/
AFRAME.registerComponent('menu-selected-challenge-image', {
dependencies: ['geometry', 'material'],
schema: {
selectedChallengeIndex: {type: 'number'}
},
init: function () {
const el = this.el;
this.searchThumbnails = document.getElementById('searchThumbnailImages');
el.getObject3D('mesh').material.map = this.searchThumbnails.getObject3D('mesh').material.map;
el.getObject3D('mesh').material.needsUpdate = true;
selectedChallengeId: {type: 'string'}
},
update: function () {
const data = this.data;
const el = this.el;
if (data.selectedChallengeIndex === -1 || data.selectedChallengeIndex === '') { return; }
// Update UVs.
el.setAttribute('atlas-uvs', 'row', data.selectedChallengeIndex + 1);
if (!this.data.selectedChallengeId) { return; }
el.setAttribute(
'material', 'src',
`https://s3-us-west-2.amazonaws.com/supersaber/${this.data.selectedChallengeId}-image.jpg`);
}
});