bruce-cesium 2.7.5 → 2.7.6

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.
@@ -8219,6 +8219,7 @@
8219
8219
  (function (TilesetEntitiesRenderManager) {
8220
8220
  var Manager = /** @class */ (function () {
8221
8221
  function Manager(params) {
8222
+ this.initCounter = 0;
8222
8223
  this.disposed = false;
8223
8224
  this.cTileset = null;
8224
8225
  var viewer = params.viewer, visualsManager = params.register, apiGetter = params.getters, item = params.item;
@@ -8241,23 +8242,32 @@
8241
8242
  enumerable: false,
8242
8243
  configurable: true
8243
8244
  });
8244
- Manager.prototype.Init = function () {
8245
+ Manager.prototype.Init = function (params) {
8245
8246
  var _a;
8246
8247
  return __awaiter(this, void 0, void 0, function () {
8247
- var tilesetId;
8248
+ var counter, tilesetId;
8248
8249
  var _this = this;
8249
8250
  return __generator(this, function (_b) {
8251
+ this.initCounter += 1;
8252
+ counter = this.initCounter;
8253
+ if (this.disposed) {
8254
+ return [2 /*return*/];
8255
+ }
8256
+ if (params === null || params === void 0 ? void 0 : params.item) {
8257
+ this.item = params.item;
8258
+ }
8250
8259
  tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
8251
8260
  if (!tilesetId) {
8252
8261
  return [2 /*return*/];
8253
8262
  }
8254
8263
  (function () { return __awaiter(_this, void 0, void 0, function () {
8255
- var canAccess, e_1, accountId, api, tileset, cTileset, _a;
8264
+ var canAccess, e_1, accountId, api, tileset, cTileset, _a, attenuation, attenuationMax;
8256
8265
  var _this = this;
8257
8266
  var _b, _c, _d;
8258
8267
  return __generator(this, function (_e) {
8259
8268
  switch (_e.label) {
8260
8269
  case 0:
8270
+ if (!!this.cTileset) return [3 /*break*/, 9];
8261
8271
  if (!tilesetId) return [3 /*break*/, 5];
8262
8272
  canAccess = false;
8263
8273
  _e.label = 1;
@@ -8286,6 +8296,9 @@
8286
8296
  console.warn("No tileset id found. Skipping access check.");
8287
8297
  _e.label = 6;
8288
8298
  case 6:
8299
+ if (this.disposed || counter !== this.initCounter) {
8300
+ return [2 /*return*/];
8301
+ }
8289
8302
  accountId = (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.ClientAccountID;
8290
8303
  if (!accountId) {
8291
8304
  accountId = this.getters.GetAccountId();
@@ -8299,7 +8312,7 @@
8299
8312
  })];
8300
8313
  case 7:
8301
8314
  tileset = (_e.sent()).tileset;
8302
- if (!tileset || this.disposed) {
8315
+ if (!tileset || this.disposed || counter !== this.initCounter) {
8303
8316
  return [2 /*return*/];
8304
8317
  }
8305
8318
  this.typeId = tileset.settings.entityTypeId;
@@ -8333,6 +8346,25 @@
8333
8346
  cTileset.tileLoad.addEventListener(function (tile) {
8334
8347
  _this.mapCTile(tile);
8335
8348
  });
8349
+ _e.label = 9;
8350
+ case 9:
8351
+ attenuation = this.item.attenuation;
8352
+ if (!attenuation && attenuation != false) {
8353
+ attenuation = true;
8354
+ }
8355
+ attenuationMax = this.item.attenuationMax;
8356
+ if (isNaN(attenuationMax)) {
8357
+ attenuationMax = 20;
8358
+ }
8359
+ this.cTileset.readyPromise.then(function () {
8360
+ exports.TilesetRenderEngine.ApplySettings({
8361
+ cTileset: _this.cTileset,
8362
+ settings: {
8363
+ attenuation: attenuation,
8364
+ maximumAttenuation: attenuationMax
8365
+ }
8366
+ });
8367
+ });
8336
8368
  return [2 /*return*/];
8337
8369
  }
8338
8370
  });
@@ -9350,6 +9382,14 @@
9350
9382
  rItem.item = params.item;
9351
9383
  }
9352
9384
  }
9385
+ // This means we're updating a entities tileset menu item.
9386
+ // These have different point scaling settings based on bookmark settings.
9387
+ else if (rItem.type == bruceModels.MenuItem.EType.EntityTileset && params.item.Type == bruceModels.MenuItem.EType.EntityTileset) {
9388
+ rItem.renderManager.Init({
9389
+ item: params.item,
9390
+ });
9391
+ rItem.item = params.item;
9392
+ }
9353
9393
  }
9354
9394
  else {
9355
9395
  rItem = {
@@ -10017,7 +10057,7 @@
10017
10057
  renderedItemIds = [];
10018
10058
  if (!((menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) && (enabledIds === null || enabledIds === void 0 ? void 0 : enabledIds.length))) return [3 /*break*/, 10];
10019
10059
  traverseItems_1 = function (item) { return __awaiter(_this, void 0, void 0, function () {
10020
- var eItem, eItemAlt, itemId, i;
10060
+ var eItem, eItemAlt, tItem, tItemAlt, itemId, i;
10021
10061
  var _a;
10022
10062
  return __generator(this, function (_b) {
10023
10063
  switch (_b.label) {
@@ -10032,6 +10072,12 @@
10032
10072
  eItem.BruceEntity = __assign(__assign({}, eItem.BruceEntity), { SelectedExpandLayers: (_a = eItemAlt.BruceEntity) === null || _a === void 0 ? void 0 : _a.SelectedExpandLayers });
10033
10073
  }
10034
10074
  }
10075
+ else if (item.Type == bruceModels.MenuItem.EType.EntityTileset) {
10076
+ tItem = item;
10077
+ tItemAlt = alternations[item.id];
10078
+ tItem.attenuation = tItemAlt.attenuation;
10079
+ tItem.attenuationMax = tItemAlt.attenuationMax;
10080
+ }
10035
10081
  }
10036
10082
  if (!enabledIds.includes(item.id)) return [3 /*break*/, 2];
10037
10083
  return [4 /*yield*/, manager.RenderItem({
@@ -15189,7 +15235,7 @@
15189
15235
  ViewerUtils.CreateWidgets = CreateWidgets;
15190
15236
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15191
15237
 
15192
- var VERSION$1 = "2.7.5";
15238
+ var VERSION$1 = "2.7.6";
15193
15239
 
15194
15240
  exports.VERSION = VERSION$1;
15195
15241
  exports.CesiumViewMonitor = CesiumViewMonitor;