bruce-cesium 7.7.9 → 7.8.1

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.
@@ -7218,6 +7218,10 @@
7218
7218
  const ICON_STACK_SCALE = 0.6;
7219
7219
  // How far an angled leader runs sideways before the label starts.
7220
7220
  const ANGLED_LEADER_RUN = 28;
7221
+ // How far a pin's white body reaches past the icon it wraps, before its tip.
7222
+ const PIN_RIM = 7;
7223
+ // A pin is drawn in one fixed look for now: a white body with a faint edge and a soft shadow.
7224
+ const PIN_COLOR = "#ffffff";
7221
7225
  // Clearance between a point or billboard glyph and the ring drawn around it.
7222
7226
  const ICON_RING_PADDING = 4;
7223
7227
  // Small points still get a ring as large as the default near ring.
@@ -7621,6 +7625,42 @@
7621
7625
  * Prefer declared semantics; only infers from recognisable glyphs and filename tokens, never image pixels.
7622
7626
  */
7623
7627
  EntityLabel.IconPriority = GetClusterIconPriority;
7628
+ /*
7629
+ * The glyph and chip colours an icon draws with: each given one as is, a missing one inferred from the other.
7630
+ */
7631
+ function IconColors(options) {
7632
+ var _a;
7633
+ const icon = typeof options.iconColor === "string" && options.iconColor ? options.iconColor : undefined;
7634
+ const background = typeof options.iconBackground === "string" && options.iconBackground.trim() ? options.iconBackground : undefined;
7635
+ if (background) {
7636
+ return { icon: icon !== null && icon !== void 0 ? icon : contrasting(background, 1), background };
7637
+ }
7638
+ if (options.iconBackground === true) {
7639
+ return { icon, background: (_a = contrasting(icon, ICON_BACKGROUND_ALPHA)) !== null && _a !== void 0 ? _a : contrasting("white", ICON_BACKGROUND_ALPHA) };
7640
+ }
7641
+ return { icon };
7642
+ }
7643
+ EntityLabel.IconColors = IconColors;
7644
+ /*
7645
+ * A light colour darkened, or a dark one brightened, far enough to read against it.
7646
+ */
7647
+ function contrasting(css, alpha) {
7648
+ const color = css ? Cesium.Color.fromCssColorString(css) : undefined;
7649
+ if (!color) {
7650
+ return undefined;
7651
+ }
7652
+ const luminance = 0.2126 * color.red + 0.7152 * color.green + 0.0722 * color.blue;
7653
+ const shade = luminance > 0.5 ?
7654
+ color.darken(ICON_BACKGROUND_BLEND, new Cesium.Color()) :
7655
+ color.brighten(ICON_BACKGROUND_BLEND, new Cesium.Color());
7656
+ return shade.withAlpha(alpha).toCssColorString();
7657
+ }
7658
+ /*
7659
+ * An icon's look on a pin: one with no chip of its own takes the pin's colour, which its glyph then contrasts with.
7660
+ */
7661
+ function pinLook(look) {
7662
+ return look.iconBackground ? look : { ...look, iconBackground: PIN_COLOR };
7663
+ }
7624
7664
  function iconLook(options) {
7625
7665
  return {
7626
7666
  icon: options.icon || undefined,
@@ -9412,7 +9452,9 @@
9412
9452
  target.addEventListener(type, event => event.stopPropagation());
9413
9453
  }
9414
9454
  };
9415
- const normalLeader = (_m = look.leader) !== null && _m !== void 0 ? _m : presentation === "text";
9455
+ // A pin needs an icon to wrap; a photo keeps its own shape, and plain text keeps a straight stem.
9456
+ const pin = this.options.leaderStyle === "pin" && look.leader !== false && presentation !== "text" && !look.iconPhoto;
9457
+ const normalLeader = (_m = look.leader) !== null && _m !== void 0 ? _m : (presentation === "text" || pin);
9416
9458
  const angled = this.options.leaderStyle === "angled";
9417
9459
  let leader = normalLeader;
9418
9460
  const content = document.createElement("span");
@@ -9423,6 +9465,8 @@
9423
9465
  let iconElement;
9424
9466
  let iconContainer;
9425
9467
  let fitIconBackground;
9468
+ let pinHolder;
9469
+ let pinBody;
9426
9470
  let iconStack;
9427
9471
  let stackedFits = [];
9428
9472
  let displayedStack = "[]";
@@ -9443,7 +9487,8 @@
9443
9487
  content.style.flexDirection = shape === "rect" ? "column-reverse" : "";
9444
9488
  };
9445
9489
  if (presentation !== "text") {
9446
- const built = this.buildIcon(look, counter, placePhoto);
9490
+ // Without a chip of its own the icon sits on the pin's white body, so its colour is inferred from that.
9491
+ const built = this.buildIcon(pin ? pinLook(look) : look, counter, placePhoto);
9447
9492
  startPhoto = built.start;
9448
9493
  const icon = iconElement = built.icon;
9449
9494
  fitIconBackground = built.fit;
@@ -9468,6 +9513,20 @@
9468
9513
  iconStack.style.cssText = "display:none;gap:2px;align-items:center;justify-items:center;flex:none;";
9469
9514
  makeClickable(iconStack);
9470
9515
  iconContainer.append(iconStack, icon);
9516
+ if (pin) {
9517
+ // The shadow sits on an unturned holder so it falls the same way whichever way the tip points.
9518
+ pinHolder = document.createElement("span");
9519
+ pinHolder.className = "entity-label-pin";
9520
+ pinHolder.style.cssText = "position:absolute;left:50%;top:50%;z-index:-1;pointer-events:none;" +
9521
+ "filter:drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.35));";
9522
+ pinBody = document.createElement("span");
9523
+ pinBody.style.cssText = `position:absolute;inset:0;background:${PIN_COLOR};border:1px solid rgba(0, 0, 0, 0.14);` +
9524
+ "box-sizing:border-box;border-radius:50% 50% 0 50%;";
9525
+ pinHolder.appendChild(pinBody);
9526
+ iconContainer.prepend(pinHolder);
9527
+ // Text beside or above keeps its usual gap from the body rather than from the icon inside it.
9528
+ content.style.gap = `${6 + PIN_RIM}px`;
9529
+ }
9471
9530
  content.appendChild(iconContainer);
9472
9531
  }
9473
9532
  if (presentation !== "icon") {
@@ -9638,6 +9697,36 @@
9638
9697
  run, side: (rightwards ? "right" : "left")
9639
9698
  };
9640
9699
  };
9700
+ /*
9701
+ * Where the icon sits in the label, and how far the pin's tip reaches from its centre, in layout pixels.
9702
+ * Measured from the icon's container, so a cluster's icon stack is wrapped the same way as a lone icon.
9703
+ */
9704
+ const measurePin = () => {
9705
+ const scale = layer.coordinates.scaleX;
9706
+ const radius = Math.max(iconContainer.offsetWidth, iconContainer.offsetHeight) / 2 + PIN_RIM;
9707
+ return {
9708
+ x: (iconContainer.offsetLeft + iconContainer.offsetWidth / 2) / scale,
9709
+ y: (iconContainer.offsetTop + iconContainer.offsetHeight / 2) / layer.coordinates.scaleY,
9710
+ radius: radius / scale,
9711
+ // The body's one square corner, half a diagonal from its centre.
9712
+ tip: radius * Math.SQRT2 / scale
9713
+ };
9714
+ };
9715
+ /*
9716
+ * A pin stands over its anchor with the icon centred on it, and hangs below when there is no room above.
9717
+ * Off to the side it is only clamped back on screen, and its tip turns to keep pointing at the anchor.
9718
+ */
9719
+ const fitPin = (anchorX, anchorY, stem, width, height, shape) => {
9720
+ const canvas = this.viewer.canvas;
9721
+ const reach = stem + shape.tip;
9722
+ const above = anchorY - reach - shape.y;
9723
+ const below = anchorY + reach - shape.y;
9724
+ const upwards = above >= 0 || (below + height > canvas.clientHeight && anchorY >= canvas.clientHeight - anchorY);
9725
+ return {
9726
+ x: Math.max(0, Math.min(anchorX - shape.x, canvas.clientWidth - width)),
9727
+ y: upwards ? above : below
9728
+ };
9729
+ };
9641
9730
  /*
9642
9731
  * The on-screen centre and half-size of a point or billboard glyph, relative to its projected position.
9643
9732
  * Read every frame, since styling and selection can rescale a billboard in place.
@@ -9754,7 +9843,7 @@
9754
9843
  }
9755
9844
  let cursorMotion = this.cursorMotion;
9756
9845
  const project = () => {
9757
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
9846
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
9758
9847
  if (this.disposed || !this.viewer || this.viewer.isDestroyed() || ((_a = this.visible) === null || _a === void 0 ? void 0 : _a.call(this)) === false ||
9759
9848
  (presentation === "icon" && this.options.iconScale === 0)) {
9760
9849
  return null;
@@ -9871,6 +9960,10 @@
9871
9960
  else if (this.options.leaderLength != null) {
9872
9961
  leaderLength = Math.max(0, this.options.leaderLength);
9873
9962
  }
9963
+ else if (pin) {
9964
+ // The tip itself is the leader, so by default it touches what it marks.
9965
+ leaderLength = 0;
9966
+ }
9874
9967
  else if (transientPivot) {
9875
9968
  // Cursor callouts must not jump when the next hover target has a different extent.
9876
9969
  leaderLength = 96;
@@ -9887,14 +9980,15 @@
9887
9980
  if (visual instanceof Cesium.Entity && (visual.polygon || visual.polyline))
9888
9981
  leaderLength /= 3;
9889
9982
  }
9890
- if (boxAnchor && this.options.leaderLength == null) {
9983
+ if (boxAnchor && this.options.leaderLength == null && !pin) {
9891
9984
  leaderLength += (MODEL_BOX_STEM - leaderLength) * boxBlend;
9892
9985
  }
9893
9986
  if (cursorAmount > 0) {
9894
9987
  leaderLength += (96 - leaderLength) * cursorAmount;
9895
9988
  }
9896
9989
  // Measured from the ring, so the visible stem is the same length whatever the glyph's size.
9897
- leaderLength += iconRing;
9990
+ // A pin's tip rests on the glyph instead, since no ring is drawn around it.
9991
+ leaderLength += pin ? (_t = icon === null || icon === void 0 ? void 0 : icon.radius) !== null && _t !== void 0 ? _t : 0 : iconRing;
9898
9992
  y = anchorY - leaderLength;
9899
9993
  }
9900
9994
  else if (hover && !reused && !pinned) {
@@ -9906,7 +10000,7 @@
9906
10000
  const width = ele.offsetWidth / coordinates.scaleX;
9907
10001
  const height = ele.offsetHeight / coordinates.scaleY;
9908
10002
  let clusterBounds;
9909
- if ((_t = this.options.cluster) === null || _t === void 0 ? void 0 : _t.enabled) {
10003
+ if ((_u = this.options.cluster) === null || _u === void 0 ? void 0 : _u.enabled) {
9910
10004
  const textWidth = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetWidth) || 0;
9911
10005
  const textHeight = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetHeight) || 0;
9912
10006
  // A photo is never part of the footprint, so its arrival cannot change which cluster a label joins.
@@ -9918,7 +10012,7 @@
9918
10012
  const baseWidth = ((above ? Math.max(textWidth, iconWidth) : textWidth + iconWidth + gap) + 16) / coordinates.scaleX;
9919
10013
  const baseHeight = ((above ? textHeight + iconHeight + gap : Math.max(textHeight, iconHeight)) + 12) / coordinates.scaleY;
9920
10014
  clusterBounds = {
9921
- x: leader ? x : x - baseWidth / 2,
10015
+ x: leader && !pin ? x : x - baseWidth / 2,
9922
10016
  y: leader ? y - baseHeight : y - baseHeight / 2, width: baseWidth, height: baseHeight
9923
10017
  };
9924
10018
  }
@@ -9929,7 +10023,9 @@
9929
10023
  // Membership uses the unclamped source footprint, never the summary's changing dimensions.
9930
10024
  let leaderRun;
9931
10025
  let leaderSide;
9932
- if (leader && angled) {
10026
+ if (leader && pin)
10027
+ ({ x, y } = fitPin(anchorX, anchorY, leaderLength, width, height, measurePin()));
10028
+ else if (leader && angled) {
9933
10029
  const fit = fitAngledLeader(anchorX, anchorY, leaderLength, width, height);
9934
10030
  ({ x, y } = fit);
9935
10031
  ({ run: leaderRun, side: leaderSide } = fit);
@@ -9940,16 +10036,16 @@
9940
10036
  if (!leader && (bounds.x + bounds.width < 0 || bounds.y + bounds.height < 0 || bounds.x > this.viewer.canvas.clientWidth || bounds.y > this.viewer.canvas.clientHeight)) {
9941
10037
  return null;
9942
10038
  }
9943
- const state = (_u = this.visualRegister) === null || _u === void 0 ? void 0 : _u.GetState({ entityId: (_v = this.rego) === null || _v === void 0 ? void 0 : _v.entityId, menuItemId: (_w = this.rego) === null || _w === void 0 ? void 0 : _w.menuItemId });
10039
+ const state = (_v = this.visualRegister) === null || _v === void 0 ? void 0 : _v.GetState({ entityId: (_w = this.rego) === null || _w === void 0 ? void 0 : _w.entityId, menuItemId: (_x = this.rego) === null || _x === void 0 ? void 0 : _x.menuItemId });
9944
10040
  const opacity = this.prePositioned || hoverOnly || MAX_DISTANCE === Infinity ? 1 : 1 - distance / MAX_DISTANCE;
9945
10041
  return {
9946
- canFlip: leader && presentation !== "icon", hasLeader: leader,
10042
+ canFlip: leader && presentation !== "icon" && !pin, hasLeader: leader,
9947
10043
  textWrapped: ((sourceNaturalText === null || sourceNaturalText === void 0 ? void 0 : sourceNaturalText.offsetWidth) || 0) > TEXT_MAX_WIDTH,
9948
10044
  transient: this.Transient || Boolean(hover) || cursorAmount > 0,
9949
10045
  extendedGeometry: visual instanceof Cesium.Entity && Boolean(visual.polygon || visual.polyline || visual.corridor),
9950
10046
  viewportWidth: this.viewer.canvas.clientWidth,
9951
- id: this.id, entityKey: ((_x = this.rego) === null || _x === void 0 ? void 0 : _x.entityId) ? JSON.stringify([this.rego.entityId, this.rego.menuItemId || "", this.Transient && !this.Persistent ? "hover" : ""]) : undefined,
9952
- entityId: (_y = this.rego) === null || _y === void 0 ? void 0 : _y.entityId, group: this.groupId, x, y, width, height, anchorX, anchorY, depth, leaderLength, leaderRun, leaderSide, distance,
10047
+ id: this.id, entityKey: ((_y = this.rego) === null || _y === void 0 ? void 0 : _y.entityId) ? JSON.stringify([this.rego.entityId, this.rego.menuItemId || "", this.Transient && !this.Persistent ? "hover" : ""]) : undefined,
10048
+ entityId: (_z = this.rego) === null || _z === void 0 ? void 0 : _z.entityId, group: this.groupId, x, y, width, height, anchorX, anchorY, depth, leaderLength, leaderRun, leaderSide, distance,
9953
10049
  iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend, follows: !pinned && Boolean(transientPivot || cursorMotion.target),
9954
10050
  // Priority shows the hovered member individually without dragging its cluster along.
9955
10051
  opacity: waiting ? 0 : opacity, priority: hover || cursorAmount > 0 || (state === null || state === void 0 ? void 0 : state.highlighted) ? 1 : 0, options: this.options, text: originalText, clusterBounds
@@ -9966,7 +10062,8 @@
9966
10062
  lineEle.style.display = show && leader ? "block" : "none";
9967
10063
  if (runEle)
9968
10064
  runEle.style.display = show && leader ? "block" : "none";
9969
- this.anchor.style.display = show && leader && !(((_a = placement.frame) === null || _a === void 0 ? void 0 : _a.boxBlend) >= 1) ? "block" : "none";
10065
+ // A pin's tip marks the anchor itself, so it has no ring there.
10066
+ this.anchor.style.display = show && leader && !pin && !(((_a = placement.frame) === null || _a === void 0 ? void 0 : _a.boxBlend) >= 1) ? "block" : "none";
9970
10067
  if (!show) {
9971
10068
  displacement = { x: 0, y: 0 };
9972
10069
  nudge = { x: 0, y: 0, fromX: 0, fromY: 0, targetX: 0, targetY: 0, start: 0 };
@@ -10023,7 +10120,7 @@
10023
10120
  const looks = ((_d = placement.icons) === null || _d === void 0 ? void 0 : _d.length) ? [iconLook(this.options), ...placement.icons] : [];
10024
10121
  // One small size for all, so no icon in the arrangement reads as more important than another.
10025
10122
  const size = (this.options.iconSize || 24) * ((_e = this.options.iconScale) !== null && _e !== void 0 ? _e : 1) * ICON_STACK_SCALE;
10026
- const built = looks.map(look => this.buildIcon({ ...look, iconSize: size }, counter));
10123
+ const built = looks.map(look => this.buildIcon({ ...(pin ? pinLook(look) : look), iconSize: size }, counter));
10027
10124
  // A stack is on show already, so its photos load straight away.
10028
10125
  built.forEach(({ start }) => start === null || start === void 0 ? void 0 : start());
10029
10126
  // Two sit side by side; three make a triangle with the representative on top.
@@ -10117,7 +10214,9 @@
10117
10214
  }
10118
10215
  const ringShare = 1 - (frame.boxBlend || 0);
10119
10216
  const radius = ringShare > 0 && ringAnimation.inner > 0 ? ringAnimation.outer * ringShare : 0;
10120
- const stem = (leader ? (angled ? fitAngledLeader : fitLeader)(frame.anchorX, frame.anchorY, Math.max(frame.leaderLength, radius ? radius + 4 : 0), ele.offsetWidth / coordinates.scaleX, ele.offsetHeight / coordinates.scaleY, radius) : undefined);
10217
+ const pinShape = leader && pin ? measurePin() : undefined;
10218
+ const stem = (pinShape ? fitPin(frame.anchorX, frame.anchorY, frame.leaderLength, ele.offsetWidth / coordinates.scaleX, ele.offsetHeight / coordinates.scaleY, pinShape) :
10219
+ leader ? (angled ? fitAngledLeader : fitLeader)(frame.anchorX, frame.anchorY, Math.max(frame.leaderLength, radius ? radius + 4 : 0), ele.offsetWidth / coordinates.scaleX, ele.offsetHeight / coordinates.scaleY, radius) : undefined);
10121
10220
  const position = { x: (stem || frame).x, y: (stem || frame).y };
10122
10221
  const width = ele.offsetWidth / coordinates.scaleX;
10123
10222
  const height = ele.offsetHeight / coordinates.scaleY;
@@ -10128,7 +10227,7 @@
10128
10227
  const beside = side === "left" ? frame.anchorX - run - width : frame.anchorX + run;
10129
10228
  position.x = Math.max(0, Math.min(beside, this.viewer.canvas.clientWidth - width));
10130
10229
  }
10131
- else if (leader && placement.textSide === "left") {
10230
+ else if (leader && !pin && placement.textSide === "left") {
10132
10231
  position.x = Math.max(0, Math.min(frame.anchorX - width, this.viewer.canvas.clientWidth - width));
10133
10232
  }
10134
10233
  const gap = (_t = (_s = this.options.pointerAvoidance) === null || _s === void 0 ? void 0 : _s.gap) !== null && _t !== void 0 ? _t : 12;
@@ -10209,8 +10308,23 @@
10209
10308
  const straightY = frame.anchorY < position.y ? position.y : frame.anchorY > position.y + height ? position.y + height : frame.anchorY;
10210
10309
  const beside = angled && (frame.anchorX < position.x || frame.anchorX > position.x + width);
10211
10310
  const elbowY = position.y + height / 2;
10212
- const endX = beside ? frame.anchorX : straightX;
10213
- const endY = beside ? elbowY : straightY;
10311
+ let endX = beside ? frame.anchorX : straightX;
10312
+ let endY = beside ? elbowY : straightY;
10313
+ if (pinShape) {
10314
+ // Aimed from wherever clamping or a nudge left it; a stem, if any, meets the tip.
10315
+ const centreX = position.x + pinShape.x, centreY = position.y + pinShape.y;
10316
+ const aim = Math.atan2(frame.anchorY - centreY, frame.anchorX - centreX);
10317
+ const reach = Math.min(pinShape.tip, Math.hypot(frame.anchorX - centreX, frame.anchorY - centreY));
10318
+ endX = centreX + Math.cos(aim) * reach;
10319
+ endY = centreY + Math.sin(aim) * reach;
10320
+ const size = `${pinShape.radius * 2 * coordinates.scaleX}px`;
10321
+ if (pinHolder.style.width !== size) {
10322
+ pinHolder.style.width = pinHolder.style.height = size;
10323
+ pinHolder.style.margin = `-${pinShape.radius * coordinates.scaleX}px`;
10324
+ }
10325
+ // The body's square corner starts at the lower right, a quarter turn short of pointing down.
10326
+ pinBody.style.transform = `rotate(${aim - Math.PI / 4}rad)`;
10327
+ }
10214
10328
  const runToX = frame.anchorX < position.x ? position.x : position.x + width;
10215
10329
  const dx = endX - frame.anchorX, dy = endY - frame.anchorY;
10216
10330
  const length = Math.hypot(dx, dy);
@@ -10302,8 +10416,10 @@
10302
10416
  }
10303
10417
  icon.style.cssText = `font-size:${(options.iconSize || 24) * ((_a = options.iconScale) !== null && _a !== void 0 ? _a : 1)}px;line-height:1;`;
10304
10418
  icon.style.textShadow = "0 1px 2px rgba(0, 0, 0, 0.25)";
10305
- const iconColor = typeof options.iconColor === "string" ? options.iconColor : undefined;
10306
- const iconBackground = options.iconBackground && options.iconScale !== 0;
10419
+ const colors = IconColors(options);
10420
+ // A file keeps its own colours unless one was given; only a glyph takes an inferred one.
10421
+ const iconColor = options.iconUrl ? (typeof options.iconColor === "string" ? options.iconColor : undefined) : colors.icon;
10422
+ const iconBackground = options.iconScale !== 0 ? colors.background : undefined;
10307
10423
  if (iconColor) {
10308
10424
  icon.style.color = iconColor;
10309
10425
  }
@@ -10368,12 +10484,8 @@
10368
10484
  icon.textContent = options.icon || "●";
10369
10485
  }
10370
10486
  if (iconBackground) {
10371
- const color = Cesium.Color.fromCssColorString(iconColor || "white") || Cesium.Color.WHITE;
10372
- const luminance = 0.2126 * color.red + 0.7152 * color.green + 0.0722 * color.blue;
10373
- const background = (luminance > 0.5 ? color.darken(ICON_BACKGROUND_BLEND, new Cesium.Color()) :
10374
- color.brighten(ICON_BACKGROUND_BLEND, new Cesium.Color()));
10375
10487
  const size = (options.iconSize || 24) * ((_c = options.iconScale) !== null && _c !== void 0 ? _c : 1);
10376
- icon.style.backgroundColor = background.withAlpha(ICON_BACKGROUND_ALPHA).toCssColorString();
10488
+ icon.style.backgroundColor = iconBackground;
10377
10489
  icon.style.borderRadius = "50%";
10378
10490
  icon.style.padding = `${size / 3}px`;
10379
10491
  icon.style.display = "inline-flex";
@@ -10747,7 +10859,7 @@
10747
10859
  }
10748
10860
  return [
10749
10861
  options.text, options.icon, options.iconUrl, options.iconClass,
10750
- options.iconColor, options.iconStatus, options.iconPriority, options.iconScale
10862
+ options.iconColor, options.iconBackground, options.iconStatus, options.iconPriority, options.iconScale
10751
10863
  ].some(Array.isArray);
10752
10864
  }
10753
10865
  EntityLabelGroup.NeedsEntityData = NeedsEntityData;
@@ -10875,6 +10987,12 @@
10875
10987
  return null;
10876
10988
  }
10877
10989
  }
10990
+ /*
10991
+ * A calculated chip colour that finds nothing for an entity draws no chip, as an unset one would.
10992
+ */
10993
+ function resolveBackground(value, entity) {
10994
+ return typeof value === "boolean" ? value : resolveIcon(value, entity) || undefined;
10995
+ }
10878
10996
  // How many entities one attachment read asks for.
10879
10997
  const IMAGES_AT_ONCE = 100;
10880
10998
  // How long on-screen requests gather before they are read together.
@@ -11112,7 +11230,7 @@
11112
11230
  iconUrl: resolveIcon((_h = group.definition.options) === null || _h === void 0 ? void 0 : _h.iconUrl, entity),
11113
11231
  iconClass: resolveIcon((_j = group.definition.options) === null || _j === void 0 ? void 0 : _j.iconClass, entity),
11114
11232
  iconColor: resolveIcon((_k = group.definition.options) === null || _k === void 0 ? void 0 : _k.iconColor, entity),
11115
- iconBackground: (_l = group.definition.options) === null || _l === void 0 ? void 0 : _l.iconBackground,
11233
+ iconBackground: resolveBackground((_l = group.definition.options) === null || _l === void 0 ? void 0 : _l.iconBackground, entity),
11116
11234
  iconPriority: Number.isFinite(iconPriority) ? iconPriority : item.iconPriority,
11117
11235
  iconStatus: (_o = resolveIcon((_m = group.definition.options) === null || _m === void 0 ? void 0 : _m.iconStatus, entity)) !== null && _o !== void 0 ? _o : item.iconStatus
11118
11236
  };
@@ -11367,8 +11485,11 @@
11367
11485
  if (!options) {
11368
11486
  return;
11369
11487
  }
11370
- if (options.iconBackground != null && typeof options.iconBackground !== "boolean") {
11371
- throw new Error("Label iconBackground must be a boolean");
11488
+ if (options.iconBackground != null &&
11489
+ typeof options.iconBackground !== "boolean" &&
11490
+ typeof options.iconBackground !== "string" &&
11491
+ !Array.isArray(options.iconBackground)) {
11492
+ throw new Error("Label iconBackground must be a boolean, a colour or a Calculator field array");
11372
11493
  }
11373
11494
  for (const value of [options.icon, options.iconUrl, options.iconClass, options.iconColor, options.text]) {
11374
11495
  if (value != null && typeof value !== "string" && !Array.isArray(value)) {
@@ -60158,7 +60279,7 @@ void main() {
60158
60279
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
60159
60280
  })(exports.StyleUtils || (exports.StyleUtils = {}));
60160
60281
 
60161
- const VERSION = "7.7.9";
60282
+ const VERSION = "7.8.1";
60162
60283
  /**
60163
60284
  * Updates the environment instance used by bruce-cesium to one specified.
60164
60285
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.