bruce-cesium 5.2.8 → 5.2.9

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.
@@ -16843,6 +16843,10 @@
16843
16843
  // It's pretty expensive so we save it for a few seconds inbetween checks.
16844
16844
  this.somethingIsolated = null;
16845
16845
  this.somethingIsolatedDateTime = null;
16846
+ // Entity ID -> rego.
16847
+ // We retain this information as a quick look-up on what has been registered.
16848
+ // This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
16849
+ this.loadedCesiumEntities = {};
16846
16850
  const { viewer, register: visualsManager, getters, item } = params;
16847
16851
  this.viewer = viewer;
16848
16852
  this.getters = getters;
@@ -17146,6 +17150,26 @@
17146
17150
  }
17147
17151
  }
17148
17152
  feature.show = !hide;
17153
+ // Already exists, so we add this graphic as a sibling.
17154
+ if (this.loadedCesiumEntities[rego.entityId]) {
17155
+ rego = this.loadedCesiumEntities[rego.entityId];
17156
+ if (!rego.visual) {
17157
+ // No parent graphic.
17158
+ rego.visual = feature;
17159
+ }
17160
+ else if (rego.visual == feature) ;
17161
+ else {
17162
+ const visual = rego.visual;
17163
+ // Sibling graphic.
17164
+ if (!visual._siblingGraphics) {
17165
+ visual._siblingGraphics = [];
17166
+ }
17167
+ if (visual._siblingGraphics.indexOf(feature) < 0) {
17168
+ visual._siblingGraphics.push(feature);
17169
+ }
17170
+ }
17171
+ }
17172
+ this.loadedCesiumEntities[rego.entityId] = rego;
17149
17173
  this.visualsManager.AddRego({
17150
17174
  rego,
17151
17175
  requestRender: false
@@ -17159,6 +17183,9 @@
17159
17183
  menuItemId: this.item.id,
17160
17184
  doRemove: false
17161
17185
  });
17186
+ // Might have to do something smarter since siblings could still be OK.
17187
+ this.loadedCesiumEntities[rego.entityId] = null;
17188
+ delete this.loadedCesiumEntities[rego.entityId];
17162
17189
  }
17163
17190
  }
17164
17191
  getMetaByGeomId(geomId, tileset) {
@@ -17171,9 +17198,9 @@
17171
17198
  if (!modelTree) {
17172
17199
  return null;
17173
17200
  }
17174
- return this.digMetaByGeomId(geomId, modelTree, [], 0);
17201
+ return this.digMetaByGeomId(geomId, modelTree, [], 0, null);
17175
17202
  }
17176
- digMetaByGeomId(geomId, branch, path, depth) {
17203
+ digMetaByGeomId(geomId, branch, path, depth, firstFoundCollapsedBranch) {
17177
17204
  if (this.hasHitDepthLimit || depth > 10) {
17178
17205
  if (!this.hasHitDepthLimit) {
17179
17206
  console.error("digMetaByGeomId: depth > 10. Disabling further attempts.");
@@ -17183,12 +17210,19 @@
17183
17210
  }
17184
17211
  path = [].concat(path);
17185
17212
  path.push(branch.id);
17213
+ if (!firstFoundCollapsedBranch && branch.collapsed) {
17214
+ firstFoundCollapsedBranch = branch;
17215
+ }
17186
17216
  if (branch.geomId == geomId) {
17187
- return { id: path[path.length - 1], typeId: branch.typeId, name: branch.name };
17217
+ // If we collapsed on a higher branch then we return it instead.
17218
+ if (firstFoundCollapsedBranch) {
17219
+ branch = firstFoundCollapsedBranch;
17220
+ }
17221
+ return { id: branch.id, typeId: branch.typeId, name: branch.name };
17188
17222
  }
17189
17223
  else if (branch.children) {
17190
17224
  for (let i = 0; i < branch.children.length; i++) {
17191
- let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1);
17225
+ let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1, firstFoundCollapsedBranch);
17192
17226
  if (meta) {
17193
17227
  return meta;
17194
17228
  }
@@ -29882,7 +29916,7 @@
29882
29916
  }
29883
29917
  }
29884
29918
 
29885
- const VERSION = "5.2.8";
29919
+ const VERSION = "5.2.9";
29886
29920
 
29887
29921
  exports.VERSION = VERSION;
29888
29922
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;