bruce-cesium 7.0.8 → 7.0.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.
@@ -6307,6 +6307,7 @@
6307
6307
  // Attached to a cesium viewer to indicate a re-check should be done.
6308
6308
  // This is to override the cache that avoids re-checking when the camera hasn't moved.
6309
6309
  const SHOULD_RECHECK_KEY = Symbol("SHOULD_RECHECK_KEY");
6310
+ const RECHECK_KICK_KEY = Symbol("RECHECK_KICK_KEY");
6310
6311
  /**
6311
6312
  * We will recheck if the camera has turned or moved enough.
6312
6313
  * @param viewer
@@ -6490,11 +6491,11 @@
6490
6491
  }
6491
6492
  const shouldCull = shouldCullEntity(viewer, part);
6492
6493
  if (shouldCull) {
6493
- part[VisualRegisterCuller.VISUAL_CULL_KEY] = true;
6494
+ part[exports.VisualRegisterCuller.VISUAL_CULL_KEY] = true;
6494
6495
  toRemove.push(part);
6495
6496
  }
6496
6497
  else {
6497
- delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
6498
+ delete part[exports.VisualRegisterCuller.VISUAL_CULL_KEY];
6498
6499
  if (rego.overrideShow != false &&
6499
6500
  !IsCEntityInScene(viewer, part) &&
6500
6501
  !state.hidden &&
@@ -6574,7 +6575,6 @@
6574
6575
  });
6575
6576
  });
6576
6577
  }
6577
- var VisualRegisterCuller;
6578
6578
  (function (VisualRegisterCuller) {
6579
6579
  VisualRegisterCuller.VISUAL_CULL_KEY = Symbol("VISUAL_CULL_KEY");
6580
6580
  /**
@@ -6597,6 +6597,7 @@
6597
6597
  runCullChecker(register);
6598
6598
  lastCullCheck = new Date();
6599
6599
  }, 1000);
6600
+ register.Viewer[RECHECK_KICK_KEY] = () => { var _a; return (_a = checkQueue === null || checkQueue === void 0 ? void 0 : checkQueue.Call) === null || _a === void 0 ? void 0 : _a.call(checkQueue); };
6600
6601
  let moveStartRemoval = register.Viewer.camera.moveStart.addEventListener(() => {
6601
6602
  var _a;
6602
6603
  (_a = checkQueue.Call) === null || _a === void 0 ? void 0 : _a.call(checkQueue);
@@ -6639,6 +6640,9 @@
6639
6640
  checkWaiting = false;
6640
6641
  checkQueue === null || checkQueue === void 0 ? void 0 : checkQueue.Dispose();
6641
6642
  checkQueue = null;
6643
+ if (register.Viewer) {
6644
+ delete register.Viewer[RECHECK_KICK_KEY];
6645
+ }
6642
6646
  };
6643
6647
  }
6644
6648
  VisualRegisterCuller.Monitor = Monitor;
@@ -6734,11 +6738,19 @@
6734
6738
  return false;
6735
6739
  }
6736
6740
  VisualRegisterCuller.IsCulled = IsCulled;
6741
+ /**
6742
+ * Asks for the next cull pass to actually re-measure, and brings that pass forward.
6743
+ */
6737
6744
  function MarkShouldRecheck(viewer) {
6745
+ var _a, _b;
6746
+ if (!viewer || ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer))) {
6747
+ return;
6748
+ }
6738
6749
  viewer[SHOULD_RECHECK_KEY] = true;
6750
+ (_b = viewer[RECHECK_KICK_KEY]) === null || _b === void 0 ? void 0 : _b.call(viewer);
6739
6751
  }
6740
6752
  VisualRegisterCuller.MarkShouldRecheck = MarkShouldRecheck;
6741
- })(VisualRegisterCuller || (VisualRegisterCuller = {}));
6753
+ })(exports.VisualRegisterCuller || (exports.VisualRegisterCuller = {}));
6742
6754
 
6743
6755
  function isTilesetFeatureAlive(visual) {
6744
6756
  const cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
@@ -6825,7 +6837,7 @@
6825
6837
  }
6826
6838
  // A sub-object can be culled while the siblings are not.
6827
6839
  // We only cull things that give us some benefit. For example clamped to ground graphics are expensive to keep rendered.
6828
- show = show ? !VisualRegisterCuller.IsCulled(viewer, rego, visual) : false;
6840
+ show = show ? !exports.VisualRegisterCuller.IsCulled(viewer, rego, visual) : false;
6829
6841
  if (visual._parentEntity && !ignoreParent) {
6830
6842
  updateCEntityShow(viewer, visual._parentEntity, rego, show, false, depth + 1);
6831
6843
  }
@@ -7178,7 +7190,7 @@
7178
7190
  this.tilesets = new Map();
7179
7191
  this.viewer = params.viewer;
7180
7192
  this.apiGetters = params.apiGetters;
7181
- this.cameraCullerDispose = VisualRegisterCuller.Monitor({
7193
+ this.cameraCullerDispose = exports.VisualRegisterCuller.Monitor({
7182
7194
  register: this
7183
7195
  });
7184
7196
  }
@@ -8190,6 +8202,26 @@
8190
8202
  exports.CesiumEntityStyler.UpdateColorSetting("highlight", color);
8191
8203
  }
8192
8204
  }
8205
+ /**
8206
+ * Whether any rego for this entity is currently held as being edited.
8207
+ */
8208
+ IsEditing(params) {
8209
+ const { entityId, menuItemId } = params;
8210
+ const regos = this.rego[entityId];
8211
+ if (!(regos === null || regos === void 0 ? void 0 : regos.length)) {
8212
+ return false;
8213
+ }
8214
+ for (let i = 0; i < regos.length; i++) {
8215
+ const rego = regos[i];
8216
+ if (menuItemId && rego.menuItemId !== menuItemId) {
8217
+ continue;
8218
+ }
8219
+ if (rego.editing) {
8220
+ return true;
8221
+ }
8222
+ }
8223
+ return false;
8224
+ }
8193
8225
  /**
8194
8226
  * Marks visuals as being actively edited, which exempts them from culling until it is turned back off.
8195
8227
  */
@@ -8210,12 +8242,15 @@
8210
8242
  if (menuItemId && rego.menuItemId !== menuItemId) {
8211
8243
  continue;
8212
8244
  }
8213
- if (Boolean(rego.editing) == Boolean(editing)) {
8245
+ const wasEditing = Boolean(rego.editing);
8246
+ if (wasEditing == Boolean(editing) && editing) {
8214
8247
  continue;
8215
8248
  }
8216
8249
  // Null rather than false, so the rego does not carry a key for every visual ever edited.
8217
8250
  rego.editing = editing ? true : null;
8218
- changed = true;
8251
+ if (wasEditing != Boolean(editing)) {
8252
+ changed = true;
8253
+ }
8219
8254
  if (editing) {
8220
8255
  const parts = exports.EntityUtils.GatherEntity({
8221
8256
  entity: rego.visual
@@ -8225,18 +8260,17 @@
8225
8260
  if (!(part instanceof Cesium.Entity)) {
8226
8261
  continue;
8227
8262
  }
8228
- const removalPending = VisualRegisterCuller.CancelQueuedSceneChange(part);
8229
- const wasCulled = part[VisualRegisterCuller.VISUAL_CULL_KEY] == true || removalPending;
8230
- delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
8263
+ const removalPending = exports.VisualRegisterCuller.CancelQueuedSceneChange(part);
8264
+ const wasCulled = part[exports.VisualRegisterCuller.VISUAL_CULL_KEY] == true || removalPending;
8265
+ delete part[exports.VisualRegisterCuller.VISUAL_CULL_KEY];
8231
8266
  if (wasCulled && !IsCEntityInScene(this.viewer, part)) {
8232
8267
  AddCEntityToScene(this.viewer, part, rego.collection);
8233
8268
  }
8234
8269
  }
8235
8270
  }
8236
8271
  else {
8237
- // The geometry almost certainly moved, so what was measured before is worthless.
8238
- VisualRegisterCuller.InvalidateBounds(rego.visual);
8239
- VisualRegisterCuller.MarkShouldRecheck(this.viewer);
8272
+ exports.VisualRegisterCuller.InvalidateBounds(rego.visual);
8273
+ exports.VisualRegisterCuller.MarkShouldRecheck(this.viewer);
8240
8274
  }
8241
8275
  }
8242
8276
  }
@@ -8710,6 +8744,9 @@
8710
8744
  // Tilesets will often add -> remove -> add because of how tiles load in and out of the scene.
8711
8745
  // To avoid flickering, we'll just replace rather than remove -> add.
8712
8746
  if (!rego.tilesetId && params.removePrior != false) {
8747
+ if (!rego.editing && this.IsEditing({ entityId: rego.entityId, menuItemId: rego.menuItemId })) {
8748
+ rego.editing = true;
8749
+ }
8713
8750
  this.RemoveRegos({
8714
8751
  entityId: rego.entityId,
8715
8752
  menuItemId: rego.menuItemId,
@@ -36969,7 +37006,7 @@
36969
37006
  model._radius = radius;
36970
37007
  model._radiusLoaded = true;
36971
37008
  if (params.viewer && params.viewer.scene && !params.viewer.isDestroyed()) {
36972
- VisualRegisterCuller.MarkShouldRecheck(params.viewer);
37009
+ exports.VisualRegisterCuller.MarkShouldRecheck(params.viewer);
36973
37010
  }
36974
37011
  }
36975
37012
  // Rough estimate on when the model is ready in the scene.
@@ -39574,8 +39611,9 @@
39574
39611
  if (bandCheck) {
39575
39612
  cEntity._bandCheck = bandCheck;
39576
39613
  }
39577
- VisualRegisterCuller.InvalidateBounds(cEntity);
39614
+ exports.VisualRegisterCuller.InvalidateBounds(cEntity);
39578
39615
  });
39616
+ exports.VisualRegisterCuller.MarkShouldRecheck(params.viewer);
39579
39617
  return {
39580
39618
  entities: cEntities,
39581
39619
  updated
@@ -40341,7 +40379,7 @@
40341
40379
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
40342
40380
  })(exports.StyleUtils || (exports.StyleUtils = {}));
40343
40381
 
40344
- const VERSION = "7.0.8";
40382
+ const VERSION = "7.0.9";
40345
40383
  /**
40346
40384
  * Updates the environment instance used by bruce-cesium to one specified.
40347
40385
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.