bruce-cesium 6.8.7 → 6.8.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.
@@ -6324,7 +6324,12 @@
6324
6324
  cache.isIsolatedAny = register.GetIsIsolatedAny();
6325
6325
  }
6326
6326
  if (cache.isIsolatedAny) {
6327
- return false;
6327
+ if (cache.isolationOpacity === undefined) {
6328
+ cache.isolationOpacity = register.GetIsolationOpacity();
6329
+ }
6330
+ if (cache.isolationOpacity == null) {
6331
+ return false;
6332
+ }
6328
6333
  }
6329
6334
  }
6330
6335
  // We show all regos in the same highest priority level.
@@ -6378,10 +6383,19 @@
6378
6383
  }
6379
6384
  }
6380
6385
  if (refresh === true || (refresh !== false && (refresh === null || refresh === void 0 ? void 0 : refresh.opacity))) {
6381
- if (state.opacity != null && state.opacity != 1) {
6386
+ let effectiveOpacity = state.opacity;
6387
+ if ((effectiveOpacity == null || effectiveOpacity == 1) && !state.isolated && visible) {
6388
+ if (cache.isolationOpacity === undefined) {
6389
+ cache.isolationOpacity = register.GetIsolationOpacity();
6390
+ }
6391
+ if (cache.isolationOpacity != null) {
6392
+ effectiveOpacity = cache.isolationOpacity;
6393
+ }
6394
+ }
6395
+ if (effectiveOpacity != null && effectiveOpacity != 1) {
6382
6396
  exports.EntityUtils.SetOpacity({
6383
6397
  entity: rego.visual,
6384
- opacity: state.opacity,
6398
+ opacity: effectiveOpacity,
6385
6399
  viewer: viewer,
6386
6400
  requestRender: false
6387
6401
  });
@@ -6521,6 +6535,10 @@
6521
6535
  // Caches GetIsIsolatedAny(). `null` means "unknown, recompute".
6522
6536
  // Invalidated on any write that could affect isolation.
6523
6537
  this.isolatedAnyCache = null;
6538
+ // Caches GetIsolationOpacity(). `undefined` means "unknown, recompute", `null` means
6539
+ // "isolation (if any) is the legacy boolean/full-hide kind, not a numeric dim".
6540
+ // Invalidated alongside isolatedAnyCache.
6541
+ this.isolationOpacityCache = undefined;
6524
6542
  // Lazy OverrideStates() bookkeeping. See cancelLazyOverride()/startLazyOverride().
6525
6543
  this.lazyOverrideToken = 0;
6526
6544
  this.lazyOverrideActive = false;
@@ -6702,12 +6720,12 @@
6702
6720
  if (!state || isBlankState(state)) {
6703
6721
  return;
6704
6722
  }
6723
+ const updateAll = state.hasOwnProperty("isolated");
6705
6724
  const refresh = {
6706
6725
  highlighted: state.hasOwnProperty("highlighted"),
6707
6726
  selected: state.hasOwnProperty("selected"),
6708
- opacity: state.hasOwnProperty("opacity")
6727
+ opacity: state.hasOwnProperty("opacity") || updateAll
6709
6728
  };
6710
- const updateAll = state.hasOwnProperty("isolated");
6711
6729
  let changed = this.setStateValues(state);
6712
6730
  // Update the related Entity.
6713
6731
  if (changed && update) {
@@ -6765,6 +6783,7 @@
6765
6783
  const updateRefreshMarkers = (state) => {
6766
6784
  if (state.hasOwnProperty("isolated")) {
6767
6785
  updateAll = true;
6786
+ refreshAccumulated.opacity = true;
6768
6787
  }
6769
6788
  let values = refresh[state.entityId];
6770
6789
  if (!values) {
@@ -6863,6 +6882,7 @@
6863
6882
  }
6864
6883
  if (keys.includes("isolated")) {
6865
6884
  this.isolatedAnyCache = null;
6885
+ this.isolationOpacityCache = undefined;
6866
6886
  }
6867
6887
  let changed = false;
6868
6888
  const eStates = this.states[entityId] || {};
@@ -7700,18 +7720,28 @@
7700
7720
  SetIsolated(params) {
7701
7721
  var _a;
7702
7722
  const { entityIds, isolated: isolate, requestRender, menuItemId, source, doUpdate } = params;
7723
+ let isolatedValue;
7724
+ if (isolate === true) {
7725
+ isolatedValue = true;
7726
+ }
7727
+ else if (typeof isolate === "number" && !isNaN(isolate)) {
7728
+ isolatedValue = Math.max(0, Math.min(1, isolate));
7729
+ }
7730
+ else {
7731
+ isolatedValue = null;
7732
+ }
7703
7733
  for (let i = 0; i < entityIds.length; i++) {
7704
7734
  const entityId = entityIds[i];
7705
7735
  this.setStateValues({
7706
7736
  entityId: entityId,
7707
7737
  menuItemId: menuItemId,
7708
7738
  // Null means it will be deleted from the object.
7709
- isolated: isolate ? true : null
7739
+ isolated: isolatedValue
7710
7740
  });
7711
7741
  const update = {
7712
7742
  entityId: entityId,
7713
7743
  type: EVisualUpdateType.Update,
7714
- isolated: isolate
7744
+ isolated: isolatedValue
7715
7745
  };
7716
7746
  if (source) {
7717
7747
  update.source = source;
@@ -7721,9 +7751,12 @@
7721
7751
  }
7722
7752
  }
7723
7753
  if (doUpdate !== false) {
7754
+ // Always a full refresh (not just when isolating): un-isolating these entities can
7755
+ // change opacity for every other entity too, eg: if this was the last isolated
7756
+ // entity, everyone else needs to revert from a numeric dim back to full opacity.
7724
7757
  this.updateAllEntities({
7725
7758
  requestRender: false,
7726
- refresh: isolate
7759
+ refresh: true
7727
7760
  });
7728
7761
  if (requestRender != false) {
7729
7762
  this.viewer.scene.requestRender();
@@ -7736,7 +7769,9 @@
7736
7769
  entityId: id,
7737
7770
  menuItemId: menuItemId
7738
7771
  });
7739
- return state.isolated === true;
7772
+ // Truthy check (not strict `=== true`) so a numeric isolate value (see
7773
+ // GetIsolationOpacity()) still counts as "this entity is isolated".
7774
+ return Boolean(state.isolated);
7740
7775
  }
7741
7776
  GetIsIsolatedAny() {
7742
7777
  if (this.isolatedAnyCache == null) {
@@ -7744,6 +7779,36 @@
7744
7779
  }
7745
7780
  return this.isolatedAnyCache;
7746
7781
  }
7782
+ /**
7783
+ * Returns the opacity that should be applied to non-isolated entities while isolation is
7784
+ * active, or null if isolation (if any) is the legacy boolean kind.
7785
+ */
7786
+ GetIsolationOpacity() {
7787
+ if (this.isolationOpacityCache !== undefined) {
7788
+ return this.isolationOpacityCache;
7789
+ }
7790
+ let sawBooleanIsolate = false;
7791
+ let minOpacity = null;
7792
+ for (const entityStates of Object.values(this.states)) {
7793
+ if (!entityStates) {
7794
+ continue;
7795
+ }
7796
+ for (const item of Object.values(entityStates)) {
7797
+ const isolated = item === null || item === void 0 ? void 0 : item.isolated;
7798
+ if (isolated === true) {
7799
+ sawBooleanIsolate = true;
7800
+ }
7801
+ else if (typeof isolated === "number" && !isNaN(isolated)) {
7802
+ const clamped = Math.max(0, Math.min(1, isolated));
7803
+ if (minOpacity == null || clamped < minOpacity) {
7804
+ minOpacity = clamped;
7805
+ }
7806
+ }
7807
+ }
7808
+ }
7809
+ this.isolationOpacityCache = sawBooleanIsolate ? null : minOpacity;
7810
+ return this.isolationOpacityCache;
7811
+ }
7747
7812
  /**
7748
7813
  * Returns all isolated entity ids, without regard to menu item id.
7749
7814
  * @returns
@@ -7770,6 +7835,7 @@
7770
7835
  if (changed) {
7771
7836
  // Mutated `isolated` directly rather than through setStateValues().
7772
7837
  this.isolatedAnyCache = false;
7838
+ this.isolationOpacityCache = null;
7773
7839
  }
7774
7840
  if (changed && (params === null || params === void 0 ? void 0 : params.doUpdate) !== false) {
7775
7841
  this.updateAllEntities({
@@ -13675,7 +13741,7 @@
13675
13741
  viaCdn: false
13676
13742
  }) + "?generation=" + params.tileset.generateVersion;
13677
13743
  }
13678
- const cTileset = await createTileset(loadUrl, null, params.noMemoryLimit);
13744
+ const cTileset = await createTileset(loadUrl, params.skipLevelOfDetail ? { skipLevelOfDetail: true } : null, params.noMemoryLimit);
13679
13745
  params.viewer.scene.primitives.add(cTileset);
13680
13746
  watchTilesetDateRange(params.viewer, cTileset, params.tileset);
13681
13747
  OnTilesetReady(cTileset).then(() => {
@@ -14414,7 +14480,8 @@
14414
14480
  accountId: accountId,
14415
14481
  viaCdn: viaCdn,
14416
14482
  noMemoryLimit: this.item["noMaximumMemory"],
14417
- modelSpace: this.modelSpace
14483
+ modelSpace: this.modelSpace,
14484
+ skipLevelOfDetail: true
14418
14485
  });
14419
14486
  if (this.disposed) {
14420
14487
  this.doDispose();
@@ -37445,7 +37512,7 @@
37445
37512
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
37446
37513
  })(exports.StyleUtils || (exports.StyleUtils = {}));
37447
37514
 
37448
- const VERSION = "6.8.7";
37515
+ const VERSION = "6.8.9";
37449
37516
  /**
37450
37517
  * Updates the environment instance used by bruce-cesium to one specified.
37451
37518
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.