@openglobus/openglobus-react 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4302,7 +4302,7 @@ const eo = class to {
4302
4302
  return e.add(this), this;
4303
4303
  }
4304
4304
  remove() {
4305
- this._layer && this._layer.removeEntity(this), this._entityCollection && this._entityCollection.removeEntity(this);
4305
+ return this._layer && this._layer.removeEntity(this), this._entityCollection && this._entityCollection.removeEntity(this), this;
4306
4306
  }
4307
4307
  setVisibility(e) {
4308
4308
  this._visibility = e, this.billboard && this.billboard.setVisibility(e), this.geoObject && this.geoObject.setVisibility(e), this.label && this.label.setVisibility(e), this.polyline && this.polyline.setVisibility(e), this.ray && this.ray.setVisibility(e), this.geometry && this.geometry.setVisibility(e);
@@ -5361,7 +5361,15 @@ precision highp float;uniform float frustumPickingColor;layout(location=0)out ve
5361
5361
  let t = e._tagData, i = e.tag;
5362
5362
  t.numInstances--;
5363
5363
  let r = !1;
5364
- t.numInstances === 0 && (t.clear(), this._instanceDataMap.delete(i), this._instanceDataMapValues = [], this._clearDataTagQueue(), r = !0), this._geoObjects.splice(e._handlerIndex, 1);
5364
+ if (t.numInstances === 0) {
5365
+ t.clear(), this._instanceDataMap.delete(i);
5366
+ for (let n = 0; this._instanceDataMapValues.length; n++) if (this._instanceDataMapValues[n].numInstances === 0) {
5367
+ this._instanceDataMapValues.splice(n, 1);
5368
+ break;
5369
+ }
5370
+ this._clearDataTagQueue(), r = !0;
5371
+ }
5372
+ this._geoObjects.splice(e._handlerIndex, 1);
5365
5373
  for (let n = e._handlerIndex, a = this._geoObjects.length; n < a; n++) {
5366
5374
  let l = this._geoObjects[n];
5367
5375
  l._handlerIndex = l._handlerIndex - 1;
@@ -5933,7 +5941,7 @@ const Ro = class Mo {
5933
5941
  _addRecursively(e) {
5934
5942
  let t = this.renderNode;
5935
5943
  t && t.ellipsoid && e._cartesian.isZero() && !e.relativePosition && e.setCartesian3v(t.ellipsoid.lonLatToCartesian(e._lonLat)), this._setPickingColor(e), e._updateAbsolutePosition(), e.setScale3v(e.getScale()), e.billboard && this.billboardHandler.add(e.billboard), e.label && this.labelHandler.add(e.label), e.polyline && this.polylineHandler.add(e.polyline), e.ray && this.rayHandler.add(e.ray), e.pointCloud && this.pointCloudHandler.add(e.pointCloud), e.strip && this.stripHandler.add(e.strip), e.geoObject && this.geoObjectHandler.add(e.geoObject), this.events.dispatch(this.events.entityadd, e);
5936
- for (let i = 0; i < e.childEntities.length; i++) e.childEntities[i]._entityCollection = this, e.childEntities[i]._entityCollectionIndex = e._entityCollectionIndex, this._addRecursively(e.childEntities[i]);
5944
+ for (let i = 0; i < e.childEntities.length; i++) e.childEntities[i]._entityCollection = this, this._addRecursively(e.childEntities[i]);
5937
5945
  }
5938
5946
  add(e) {
5939
5947
  return e._entityCollection || (e._entityCollection = this, e._entityCollectionIndex = this._entities.length, this._entities.push(e), this._addRecursively(e)), this;
@@ -5949,11 +5957,22 @@ const Ro = class Mo {
5949
5957
  e._entityCollection = null, e._entityCollectionIndex = -1, e.billboard && this.billboardHandler.remove(e.billboard), e.label && this.labelHandler.remove(e.label), e.polyline && this.polylineHandler.remove(e.polyline), e.ray && this.rayHandler.remove(e.ray), e.pointCloud && this.pointCloudHandler.remove(e.pointCloud), e.strip && this.stripHandler.remove(e.strip), e.geoObject && this.geoObjectHandler.remove(e.geoObject);
5950
5958
  for (let t = 0; t < e.childEntities.length; t++) this._removeRecursively(e.childEntities[t]);
5951
5959
  }
5960
+ _removeEntity(e) {
5961
+ if (e.parent) {
5962
+ let t = e.parent.childEntities;
5963
+ for (let i = 0, r = t.length; i < r; i++) if (t[i].isEqual(e)) {
5964
+ t.splice(i, 1);
5965
+ break;
5966
+ }
5967
+ e.parent = null;
5968
+ } else this._entities.splice(e._entityCollectionIndex, 1), this.reindexEntitiesArray(e._entityCollectionIndex);
5969
+ this.renderNode && this.renderNode.renderer && (this.renderNode.renderer.clearPickingColor(e), e._pickingColor.clear()), this._removeRecursively(e);
5970
+ }
5952
5971
  removeEntity(e) {
5953
- this._entities.splice(e._entityCollectionIndex, 1), this.reindexEntitiesArray(e._entityCollectionIndex), this.renderNode && this.renderNode.renderer && (this.renderNode.renderer.clearPickingColor(e), e._pickingColor.clear()), this.belongs(e) && this._removeRecursively(e), this.events.dispatch(this.events.entityremove, e);
5972
+ this.belongs(e) && (this._removeEntity(e), this.events.dispatch(this.events.entityremove, e));
5954
5973
  }
5955
5974
  _removeEntitySilent(e) {
5956
- this._entities.splice(e._entityCollectionIndex, 1), this.reindexEntitiesArray(e._entityCollectionIndex), this.renderNode && this.renderNode.renderer && (this.renderNode.renderer.clearPickingColor(e), e._pickingColor.clear()), this.belongs(e) && this._removeRecursively(e);
5975
+ this.belongs(e) && this._removeEntity(e);
5957
5976
  }
5958
5977
  createPickingColors(e = this._entities) {
5959
5978
  if (this.renderNode && this.renderNode.renderer) for (let t = 0; t < e.length; t++) {
@@ -6572,7 +6591,7 @@ class ge extends We {
6572
6591
  }
6573
6592
  removeEntity(e) {
6574
6593
  if (e._layer && this.isEqual(e._layer)) {
6575
- if (this._entities.splice(e._layerIndex, 1), this._reindexEntitiesArray(e._layerIndex), e._layer = null, e._layerIndex = -1, e._entityCollection) {
6594
+ if (e.parent || (this._entities.splice(e._layerIndex, 1), this._reindexEntitiesArray(e._layerIndex)), e._layer = null, e._layerIndex = -1, e._entityCollection) {
6576
6595
  e._entityCollection._removeEntitySilent(e);
6577
6596
  let t = e._nodePtr;
6578
6597
  for (; t; ) t.count--, t = t.parentNode;