mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
938 fixed.4
This commit is contained in:
parent
68908e032d
commit
5c2632c70a
@ -459,7 +459,6 @@ class EntityCollection {
|
||||
}
|
||||
|
||||
protected _removeRecursively(entity: Entity) {
|
||||
entity.parent = null;
|
||||
entity._entityCollection = null;
|
||||
entity._entityCollectionIndex = -1;
|
||||
|
||||
@ -489,6 +488,30 @@ class EntityCollection {
|
||||
}
|
||||
}
|
||||
|
||||
protected _removeEntity(entity: Entity) {
|
||||
if (entity.parent) {
|
||||
let arr = entity.parent.childEntities;
|
||||
for (let i = 0, len = arr.length; i < len; i++) {
|
||||
if (arr[i].isEqual(entity)) {
|
||||
arr.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
entity.parent = null;
|
||||
} else {
|
||||
this._entities.splice(entity._entityCollectionIndex, 1);
|
||||
this.reindexEntitiesArray(entity._entityCollectionIndex);
|
||||
}
|
||||
|
||||
// clear picking color
|
||||
if (this.renderNode && this.renderNode.renderer) {
|
||||
this.renderNode.renderer.clearPickingColor(entity);
|
||||
entity._pickingColor.clear();
|
||||
}
|
||||
|
||||
this._removeRecursively(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes entity from this collection.
|
||||
* @public
|
||||
@ -496,46 +519,14 @@ class EntityCollection {
|
||||
*/
|
||||
public removeEntity(entity: Entity) {
|
||||
if (this.belongs(entity)) {
|
||||
|
||||
if (entity.parent) {
|
||||
let arr = entity.parent.childEntities;
|
||||
for (let i = 0, len = arr.length; i < len; i++) {
|
||||
if (arr[i].isEqual(entity)) {
|
||||
arr.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this._entities.splice(entity._entityCollectionIndex, 1);
|
||||
this.reindexEntitiesArray(entity._entityCollectionIndex);
|
||||
}
|
||||
|
||||
// clear picking color
|
||||
if (this.renderNode && this.renderNode.renderer) {
|
||||
this.renderNode.renderer.clearPickingColor(entity);
|
||||
entity._pickingColor.clear();
|
||||
}
|
||||
|
||||
this._removeRecursively(entity);
|
||||
|
||||
this._removeEntity(entity);
|
||||
this.events.dispatch(this.events.entityremove, entity);
|
||||
}
|
||||
}
|
||||
|
||||
public _removeEntitySilent(entity: Entity) {
|
||||
if (this.belongs(entity)) {
|
||||
if (!entity.parent) {
|
||||
this._entities.splice(entity._entityCollectionIndex, 1);
|
||||
this.reindexEntitiesArray(entity._entityCollectionIndex);
|
||||
}
|
||||
|
||||
// clear picking color
|
||||
if (this.renderNode && this.renderNode.renderer) {
|
||||
this.renderNode.renderer.clearPickingColor(entity);
|
||||
entity._pickingColor.clear();
|
||||
}
|
||||
|
||||
this._removeRecursively(entity);
|
||||
this._removeEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -427,12 +427,12 @@ class Vector extends Layer {
|
||||
|
||||
if (entity._layer && this.isEqual(entity._layer)) {
|
||||
|
||||
this._entities.splice(entity._layerIndex, 1);
|
||||
|
||||
this._reindexEntitiesArray(entity._layerIndex);
|
||||
if (!entity.parent) {
|
||||
this._entities.splice(entity._layerIndex, 1);
|
||||
this._reindexEntitiesArray(entity._layerIndex);
|
||||
}
|
||||
|
||||
entity._layer = null;
|
||||
|
||||
entity._layerIndex = -1;
|
||||
|
||||
if (entity._entityCollection) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user