Skip to content

Commit

Permalink
fix mapbox not visible map issue
Browse files Browse the repository at this point in the history
load components geometry and material first for each entity in JSON
  • Loading branch information
Algorush committed Sep 14, 2023
1 parent bf7b4b3 commit f0d6be8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ function createEntityFromObj(entityData, parentEl) {
entity.setAttribute('geometry', 'primitive', entityData['primitive']);
}

// load this attributes in advance in right order to correctly apply other specific components
for (const attr of ['geometry', 'material']) {
if (entityData.components[attr]) {
entity.setAttribute(attr, entityData.components[attr]);
delete entityData.components[attr];
}
}

if (entityData.id) {
entity.setAttribute('id', entityData.id);
}
Expand Down

0 comments on commit f0d6be8

Please sign in to comment.