From f0d6be826d4c2ed4634fe47910b71d5dd35367ec Mon Sep 17 00:00:00 2001 From: Alexander Goryushkin Date: Thu, 14 Sep 2023 13:18:02 -0300 Subject: [PATCH] fix mapbox not visible map issue load components geometry and material first for each entity in JSON --- src/json-utils.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/json-utils.js b/src/json-utils.js index 1b48bb698..d874a3810 100644 --- a/src/json-utils.js +++ b/src/json-utils.js @@ -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); }