Skip to content

Commit

Permalink
fix(core): remove objects of a GeometryLayer from the Scene
Browse files Browse the repository at this point in the history
The property object3d (an instance of THREE.Object3D, most of the time
THREE.Group) was not correctly removed for a GeometryLayer, when calling
View#removeLayer.

Now, if the layer is a geometry one, the GeometryLayer#delete method is
called once more, and should remove the object3d property from its
parent (usually a THREE.Scene).
  • Loading branch information
zarov authored and gchoqueux committed Jan 30, 2020
1 parent 0e6d94a commit 95e420b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Layer/GeometryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ class GeometryLayer extends Layer {
disposeMesh(obj);
}
});
} else {
if (this.object3d.parent) {
this.object3d.parent.remove(this.object3d);
}
this.object3d.traverse(disposeMesh);
}

if (this.object3d.parent) {
this.object3d.parent.remove(this.object3d);
}
this.object3d.traverse(disposeMesh);
}

/**
Expand Down

0 comments on commit 95e420b

Please sign in to comment.