bruce-cesium 5.2.6 → 5.2.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.
@@ -16839,6 +16839,10 @@
16839
16839
  // This likely means poor data so we have to disable drilling otherwise lag would be too bad.
16840
16840
  // The result is no entity type IDs are known so most styles fail.
16841
16841
  this.hasHitDepthLimit = false;
16842
+ // Cache of 'something isolated' that we detect and use to calculate a default show state.
16843
+ // It's pretty expensive so we save it for a few seconds inbetween checks.
16844
+ this.somethingIsolated = null;
16845
+ this.somethingIsolatedDateTime = null;
16842
16846
  const { viewer, register: visualsManager, getters, item } = params;
16843
16847
  this.viewer = viewer;
16844
16848
  this.getters = getters;
@@ -16954,6 +16958,12 @@
16954
16958
  if (this.disposed || cTileset.isDestroyed()) {
16955
16959
  return;
16956
16960
  }
16961
+ // We style Entities to be hidden by default so that we can selectively-
16962
+ // do a default later.
16963
+ // This stops them flickering in/out as Bookmark settings get applied.
16964
+ this.cTileset.style = new Cesium.Cesium3DTileStyle({
16965
+ show: "false"
16966
+ });
16957
16967
  this.onCTilesetLoad();
16958
16968
  this.styler.Init({
16959
16969
  viewer: this.viewer,
@@ -17014,7 +17024,12 @@
17014
17024
  for (let i = 0; i < content.featuresLength; i++) {
17015
17025
  const feature = content.getFeature(i);
17016
17026
  let rego = this.mapTilesetFeature(feature, load);
17017
- if ((rego === null || rego === void 0 ? void 0 : rego.entityId) && this.styler) {
17027
+ if (!(rego === null || rego === void 0 ? void 0 : rego.entityId)) {
17028
+ // Override the default hide state set by the style.
17029
+ feature.show = true;
17030
+ continue;
17031
+ }
17032
+ if (this.styler) {
17018
17033
  this.styler.QueueEntities([rego]);
17019
17034
  }
17020
17035
  }
@@ -17100,6 +17115,31 @@
17100
17115
  return null;
17101
17116
  }
17102
17117
  if (add) {
17118
+ // Get the initial hide/show state.
17119
+ const state = this.visualsManager.GetState({
17120
+ entityId: rego.entityId,
17121
+ menuItemId: this.item.id,
17122
+ });
17123
+ if (this.somethingIsolated == null ||
17124
+ // 5s cache.
17125
+ (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
17126
+ this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
17127
+ this.somethingIsolatedDateTime = new Date();
17128
+ }
17129
+ // Override the default hide state set by the style.
17130
+ let hide = false;
17131
+ if (state) {
17132
+ if (state.hidden) {
17133
+ hide = true;
17134
+ }
17135
+ else if (state.opacity === 0) {
17136
+ hide = true;
17137
+ }
17138
+ else if (!state.isolated && this.somethingIsolated) {
17139
+ hide = true;
17140
+ }
17141
+ }
17142
+ feature.show = !hide;
17103
17143
  this.visualsManager.AddRego({
17104
17144
  rego,
17105
17145
  requestRender: false
@@ -29836,7 +29876,7 @@
29836
29876
  }
29837
29877
  }
29838
29878
 
29839
- const VERSION = "5.2.6";
29879
+ const VERSION = "5.2.7";
29840
29880
 
29841
29881
  exports.VERSION = VERSION;
29842
29882
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;