Skip to content

Commit

Permalink
save and load visible component
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Sep 1, 2024
1 parent bf39f69 commit 5397b1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/json-utils_1.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ function getAttributes(entity) {
if (entity.getAttribute('data-layer-name')) {
elemObj['data-layer-name'] = entity.getAttribute('data-layer-name');
}
if (entity.getAttribute('visible') === false) {
elemObj['visible'] = false;
}
const entityComponents = entity.components;

if (entityComponents) {
Expand Down Expand Up @@ -434,6 +437,10 @@ function createEntityFromObj(entityData, parentEl) {
entity.setAttribute('data-layer-name', entityData['data-layer-name']);
}

if (entityData['visible'] === false) {
entity.setAttribute('visible', false);
}

entity.addEventListener('loaded', () => {
// load attributes
for (const attr in entityData.components) {
Expand Down

0 comments on commit 5397b1a

Please sign in to comment.