bruce-cesium 7.7.0 → 7.7.2

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.
@@ -12286,6 +12286,15 @@
12286
12286
  }
12287
12287
  return this.onUpdate;
12288
12288
  }
12289
+ /**
12290
+ * Fires after one or more regos changed their resolved style through SetRegoStyle.
12291
+ */
12292
+ get OnStyleChange() {
12293
+ if (!this.onStyleChange) {
12294
+ this.onStyleChange = new BModels.BruceEvent();
12295
+ }
12296
+ return this.onStyleChange;
12297
+ }
12289
12298
  get OnLabelGroupsChanged() { return this.labelGroupsChanged; }
12290
12299
  constructor(params) {
12291
12300
  var _a, _b;
@@ -12312,6 +12321,14 @@
12312
12321
  this.lazyOverrideInterval = null;
12313
12322
  this.activeChunkedIntervals = new Set();
12314
12323
  this.onUpdate = null;
12324
+ // A scene restyle touches every rego, so restyles are reported once per window rather than per Entity.
12325
+ this.styleChangeQueue = new BModels.DelayQueue(() => {
12326
+ var _a;
12327
+ if (!this.disposed) {
12328
+ (_a = this.onStyleChange) === null || _a === void 0 ? void 0 : _a.Trigger();
12329
+ }
12330
+ }, 250);
12331
+ this.onStyleChange = null;
12315
12332
  // Entity ID -> Menu Item ID -> State.
12316
12333
  // When no Menu Item ID is set, then the second key is a blank string.
12317
12334
  // If an Entity ID state is set without a Menu Item ID, then it acts as a default for all Menu Items.
@@ -13325,6 +13342,7 @@
13325
13342
  clearInterval(interval);
13326
13343
  }
13327
13344
  this.activeChunkedIntervals.clear();
13345
+ this.styleChangeQueue.Dispose();
13328
13346
  this.disposed = true;
13329
13347
  for (const record of Array.from(this.menuItemSources.values())) {
13330
13348
  try {
@@ -14695,6 +14713,19 @@
14695
14713
  }
14696
14714
  }
14697
14715
  }
14716
+ /**
14717
+ * Records the style a rego resolved to, and queues OnStyleChange when that moved.
14718
+ * Assigned outright, so a restyle that traces nothing clears the old key.
14719
+ */
14720
+ SetRegoStyle(params) {
14721
+ const { rego, styleId, styleEffective } = params;
14722
+ if (rego.styleId === styleId && rego.styleEffective === styleEffective) {
14723
+ return;
14724
+ }
14725
+ rego.styleId = styleId;
14726
+ rego.styleEffective = styleEffective;
14727
+ this.styleChangeQueue.Call();
14728
+ }
14698
14729
  async updateAllEntities(params) {
14699
14730
  this.syncDimming();
14700
14731
  const ids = Object.keys(this.rego);
@@ -16079,11 +16110,13 @@
16079
16110
  override: override
16080
16111
  });
16081
16112
  this.overrideFeatureColor.set(rego.entityId, true);
16082
- // Assigned outright, so a restyle that traces nothing clears the old key.
16083
- rego.styleId = resolvedStyleId !== null && resolvedStyleId !== void 0 ? resolvedStyleId : undefined;
16084
- rego.styleEffective = (_b = exports.StyleEffective.Combine([
16085
- { key: "color", effective: fillColorTrace.effective }
16086
- ])) !== null && _b !== void 0 ? _b : undefined;
16113
+ this.register.SetRegoStyle({
16114
+ rego,
16115
+ styleId: resolvedStyleId !== null && resolvedStyleId !== void 0 ? resolvedStyleId : undefined,
16116
+ styleEffective: (_b = exports.StyleEffective.Combine([
16117
+ { key: "color", effective: fillColorTrace.effective }
16118
+ ])) !== null && _b !== void 0 ? _b : undefined
16119
+ });
16087
16120
  }
16088
16121
  if (((_c = data === null || data === void 0 ? void 0 : data.Bruce) === null || _c === void 0 ? void 0 : _c.InternalID) != null) {
16089
16122
  rego.internalId = data.Bruce.InternalID;
@@ -20589,9 +20622,11 @@
20589
20622
  rego.schema = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.Schema;
20590
20623
  rego.canEdit = canEdit;
20591
20624
  rego.internalId = (_k = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.InternalID) !== null && _k !== void 0 ? _k : rego.internalId;
20592
- // Assigned outright, so a restyle that traces nothing clears the old key.
20593
- rego.styleId = cEntity.styleId;
20594
- rego.styleEffective = cEntity.styleEffective;
20625
+ this.visualsManager.SetRegoStyle({
20626
+ rego,
20627
+ styleId: cEntity.styleId,
20628
+ styleEffective: cEntity.styleEffective
20629
+ });
20595
20630
  // Marked as stale meaning some change was performed that requires a refresh.
20596
20631
  // This usually means a new sibling was added that we need to update.
20597
20632
  if (rego.stale) {
@@ -21601,8 +21636,11 @@
21601
21636
  else if (updated.get(id) && rego) {
21602
21637
  rego.visual = cEntity;
21603
21638
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
21604
- rego.styleId = cEntity.styleId;
21605
- rego.styleEffective = cEntity.styleEffective;
21639
+ this.visualsManager.SetRegoStyle({
21640
+ rego,
21641
+ styleId: cEntity.styleId,
21642
+ styleEffective: cEntity.styleEffective
21643
+ });
21606
21644
  rego.name = cEntity.name;
21607
21645
  // We manually trigger an update event since the graphic was updated but not recreated.
21608
21646
  this.visualsManager.OnUpdate.Trigger({
@@ -22059,8 +22097,11 @@
22059
22097
  else if (updated.get(id) && rego) {
22060
22098
  rego.visual = cEntity;
22061
22099
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
22062
- rego.styleId = cEntity.styleId;
22063
- rego.styleEffective = cEntity.styleEffective;
22100
+ this.visualsManager.SetRegoStyle({
22101
+ rego,
22102
+ styleId: cEntity.styleId,
22103
+ styleEffective: cEntity.styleEffective
22104
+ });
22064
22105
  rego.name = cEntity.name;
22065
22106
  // We manually trigger an update event since the graphic was updated but not recreated.
22066
22107
  this.visualsManager.OnUpdate.Trigger({
@@ -22340,8 +22381,11 @@
22340
22381
  else if (updated.get(id) && rego) {
22341
22382
  rego.visual = cEntity;
22342
22383
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
22343
- rego.styleId = cEntity.styleId;
22344
- rego.styleEffective = cEntity.styleEffective;
22384
+ this.visualsManager.SetRegoStyle({
22385
+ rego,
22386
+ styleId: cEntity.styleId,
22387
+ styleEffective: cEntity.styleEffective
22388
+ });
22345
22389
  rego.name = cEntity.name;
22346
22390
  // We manually trigger an update event since the graphic was updated but not recreated.
22347
22391
  this.visualsManager.OnUpdate.Trigger({
@@ -25728,8 +25772,11 @@
25728
25772
  rego.name = cEntity.name;
25729
25773
  rego.visual = cEntity;
25730
25774
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
25731
- rego.styleId = cEntity.styleId;
25732
- rego.styleEffective = cEntity.styleEffective;
25775
+ this.visualsManager.SetRegoStyle({
25776
+ rego,
25777
+ styleId: cEntity.styleId,
25778
+ styleEffective: cEntity.styleEffective
25779
+ });
25733
25780
  rego.tagIds = entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [];
25734
25781
  rego.outline = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.Outline;
25735
25782
  rego.cdn = this.item.cdnEnabled;
@@ -56968,7 +57015,7 @@ void main() {
56968
57015
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
56969
57016
  })(exports.StyleUtils || (exports.StyleUtils = {}));
56970
57017
 
56971
- const VERSION = "7.7.0";
57018
+ const VERSION = "7.7.2";
56972
57019
  /**
56973
57020
  * Updates the environment instance used by bruce-cesium to one specified.
56974
57021
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.