Skip to content

Commit

Permalink
[FIX] Fix deletion from MetaScene.rootMetaObjects
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Dec 5, 2024
1 parent 2dc8183 commit 34a579d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/viewer/metadata/MetaModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class MetaModel {
this.metaScene.metaObjects[id] = metaObject;
metaObject.metaModels = [];
}
this.metaObjects[id] =metaObject;
this.metaObjects[id] = metaObject;
if (!metaObjectData.parent) {
this.rootMetaObjects.push(metaObject);
metaScene.rootMetaObjects[id] = metaObject;
Expand Down
9 changes: 4 additions & 5 deletions src/viewer/metadata/MetaScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,12 @@ class MetaScene {
// Remove MetaObjects

if (metaModel.metaObjects) {
for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
const metaObject = metaModel.metaObjects[i];
const id = metaObject.id;
for (let objectId in metaModel.metaObjects) {
const metaObject = metaModel.metaObjects[objectId];
if (metaObject.metaModels.length === 1 && metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete
delete this.metaObjects[id];
delete this.metaObjects[objectId];
if (!metaObject.parent) {
delete this.rootMetaObjects[id];
delete this.rootMetaObjects[objectId];
}
} else {
metaObject.metaModels = metaObject.metaModels.filter(metaModel => metaModel.id !== metaModelId);
Expand Down

0 comments on commit 34a579d

Please sign in to comment.