bruce-cesium 7.8.4 → 7.8.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.
@@ -11172,6 +11172,35 @@
11172
11172
  })(exports.EntityLabel || (exports.EntityLabel = {}));
11173
11173
 
11174
11174
  (function (EntityLabelGroup) {
11175
+ // Prefixes that make an icon value name its kind, so one mapping can send Entities to icons of different kinds.
11176
+ EntityLabelGroup.ICON_PREFIX = {
11177
+ // A Font Awesome class, "FA:fas fa-cube".
11178
+ FontAwesome: "FA:",
11179
+ // A client file by id, or an image by URL, "CF:<file id or URL>".
11180
+ ClientFile: "CF:"
11181
+ };
11182
+ /*
11183
+ * The icon a prefixed value names, as a class or an image URL, or null for a value with no known prefix.
11184
+ */
11185
+ function ParseIcon(value, api) {
11186
+ if (typeof value !== "string") {
11187
+ return null;
11188
+ }
11189
+ const named = value.trim();
11190
+ if (named.startsWith(EntityLabelGroup.ICON_PREFIX.FontAwesome)) {
11191
+ const iconClass = named.slice(EntityLabelGroup.ICON_PREFIX.FontAwesome.length).trim();
11192
+ return iconClass ? { iconClass } : null;
11193
+ }
11194
+ if (named.startsWith(EntityLabelGroup.ICON_PREFIX.ClientFile)) {
11195
+ const file = named.slice(EntityLabelGroup.ICON_PREFIX.ClientFile.length).trim();
11196
+ if (!file) {
11197
+ return null;
11198
+ }
11199
+ return { iconUrl: /^[a-z][a-z0-9+.-]*:/i.test(file) ? file : BModels.ClientFile.GetUrl({ api, fileId: file, viaCdn: true }) };
11200
+ }
11201
+ return null;
11202
+ }
11203
+ EntityLabelGroup.ParseIcon = ParseIcon;
11175
11204
  // The glow a selected place is drawn with.
11176
11205
  const PLACE_SELECTED_COLOR = "#33B1FF";
11177
11206
  // Keys places share the entity bookkeeping under, scoped to their group so a copied group keeps its own.
@@ -11647,7 +11676,7 @@
11647
11676
  * One member's label settings, with any image its own text links to but before its default image.
11648
11677
  */
11649
11678
  compose(group, entityId, menuItemId) {
11650
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
11679
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
11651
11680
  const item = group.items.get(entityId);
11652
11681
  const entity = (_a = item.entity) !== null && _a !== void 0 ? _a : { Bruce: { ID: entityId, Name: item.text } };
11653
11682
  let iconPriority = (_b = group.definition.options) === null || _b === void 0 ? void 0 : _b.iconPriority;
@@ -11698,6 +11727,13 @@
11698
11727
  iconPriority: Number.isFinite(iconPriority) ? iconPriority : item.iconPriority,
11699
11728
  iconStatus: (_p = resolveIcon((_o = group.definition.options) === null || _o === void 0 ? void 0 : _o.iconStatus, entity)) !== null && _p !== void 0 ? _p : item.iconStatus
11700
11729
  };
11730
+ // A prefixed icon names its kind and replaces the group's others; an unprefixed one stays the glyph it was.
11731
+ const named = ParseIcon(options.icon, (_q = this.register.ApiGetters) === null || _q === void 0 ? void 0 : _q.GetBruceApi());
11732
+ if (named) {
11733
+ options.icon = undefined;
11734
+ options.iconClass = named.iconClass;
11735
+ options.iconUrl = named.iconUrl;
11736
+ }
11701
11737
  if (item.placeId) {
11702
11738
  // Clickable only when the app asks, and reported then, as there is no Entity to select.
11703
11739
  options.selectOnClick = this.placesInteractive;
@@ -11708,16 +11744,19 @@
11708
11744
  options.iconUrl = look.iconUrl || undefined;
11709
11745
  options.iconClass = look.iconUrl ? undefined : look.iconClass;
11710
11746
  }
11711
- if (look === null || look === void 0 ? void 0 : look.iconColor) {
11712
- options.iconColor = look.iconColor;
11747
+ if ((look === null || look === void 0 ? void 0 : look.iconColor) != null) {
11748
+ options.iconColor = look.iconColor || undefined;
11713
11749
  }
11714
11750
  if ((look === null || look === void 0 ? void 0 : look.iconBackground) != null) {
11715
11751
  options.iconBackground = look.iconBackground;
11716
11752
  }
11753
+ if ((look === null || look === void 0 ? void 0 : look.iconScale) > 0) {
11754
+ options.iconScale = look.iconScale;
11755
+ }
11717
11756
  }
11718
11757
  if (options.attributes && item.entity && !(expression && resolvedText != null)) {
11719
11758
  options.text = [
11720
- (_s = (_q = options.text) !== null && _q !== void 0 ? _q : (_r = item.entity.Bruce) === null || _r === void 0 ? void 0 : _r.Name) !== null && _s !== void 0 ? _s : entityId,
11759
+ (_t = (_r = options.text) !== null && _r !== void 0 ? _r : (_s = item.entity.Bruce) === null || _s === void 0 ? void 0 : _s.Name) !== null && _t !== void 0 ? _t : entityId,
11721
11760
  ...options.attributes.map(path => BModels.Entity.GetValue({ entity: item.entity, path })).filter(value => value != null).map(String)
11722
11761
  ].join("\n");
11723
11762
  }
@@ -30101,7 +30140,7 @@
30101
30140
  * Loads a scan with optional SDK tuning and per-viewer budget control.
30102
30141
  */
30103
30142
  function Render(params) {
30104
- var _a, _b, _c, _d;
30143
+ var _a, _b, _c;
30105
30144
  const { api, viewer, tileset } = params;
30106
30145
  if (typeof LCCRender === "undefined" || typeof (LCCRender === null || LCCRender === void 0 ? void 0 : LCCRender.load) !== "function") {
30107
30146
  console.warn("[XGridsRenderEngine] Render() LCCRender library not available.");
@@ -30232,8 +30271,7 @@
30232
30271
  return null;
30233
30272
  }
30234
30273
  try {
30235
- const sdkBudget = typeof obj.getCurrentConfig === "function" ? (_d = obj.getCurrentConfig()) === null || _d === void 0 ? void 0 : _d.maxLoadSplatCount : undefined;
30236
- maxSplats = GetSplatBudget(sdkBudget, profile);
30274
+ maxSplats = GetSplatBudget(profile);
30237
30275
  if (LCCRender.nextspaceMetadataReady === 1 &&
30238
30276
  typeof obj.setNextspaceMetadataCallback === "function" &&
30239
30277
  typeof obj.setMaxSplats === "function") {
@@ -30275,16 +30313,16 @@
30275
30313
  }
30276
30314
  XGridsRenderEngine.Render = Render;
30277
30315
  /*
30278
- * The most splats a scan may load: the tier's, lowered by the SDK's GPU limit unless overridden.
30316
+ * The most splats a scan may load: the tier's, capped by what the SDK's splat texture can hold.
30279
30317
  */
30280
- function GetSplatBudget(sdkBudget, profile) {
30318
+ function GetSplatBudget(profile) {
30319
+ var _a;
30281
30320
  const budget = exports.DeviceProfile.GetBudget(profile.tier).splats;
30282
- // Above 2M the SDK is reporting its flat default, not a limit it chose for this GPU.
30283
- if (!profile.overridden &&
30284
- Number.isFinite(sdkBudget) &&
30285
- sdkBudget > 0 &&
30286
- sdkBudget <= 2000000) {
30287
- return Math.min(sdkBudget, budget);
30321
+ // The SDK's GPU guess misreads many GPU names and skips Firefox; only its texture cap is real.
30322
+ const size = (_a = profile.environment) === null || _a === void 0 ? void 0 : _a.maxTextureSize;
30323
+ if (Number.isFinite(size) &&
30324
+ size > 0) {
30325
+ return Math.min(budget, size * size / 4);
30288
30326
  }
30289
30327
  return budget;
30290
30328
  }
@@ -60860,7 +60898,7 @@ void main() {
60860
60898
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
60861
60899
  })(exports.StyleUtils || (exports.StyleUtils = {}));
60862
60900
 
60863
- const VERSION = "7.8.4";
60901
+ const VERSION = "7.8.6";
60864
60902
  /**
60865
60903
  * Updates the environment instance used by bruce-cesium to one specified.
60866
60904
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.