bruce-cesium 7.6.0 → 7.6.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.
@@ -89,7 +89,7 @@ __exportStar(require("./widgets/widget-info-view"), exports);
89
89
  __exportStar(require("./widgets/widget-left-panel"), exports);
90
90
  __exportStar(require("./widgets/widget-nav-compass"), exports);
91
91
  __exportStar(require("./widgets/widget-view-bar"), exports);
92
- exports.VERSION = "7.6.0";
92
+ exports.VERSION = "7.6.1";
93
93
  /**
94
94
  * Updates the environment instance used by bruce-cesium to one specified.
95
95
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -953,6 +953,22 @@ var EntityLabel;
953
953
  return centre && half && (axes === null || axes === void 0 ? void 0 : axes.every(Boolean)) ? { centre, axes, half } : null;
954
954
  }
955
955
  EntityLabel.ReadOrientedBox = ReadOrientedBox;
956
+ /*
957
+ * Whether a placement turns what it places. Scale alone does not count.
958
+ */
959
+ function isRotated(matrix) {
960
+ for (let column = 0; column < 3; column++) {
961
+ const axis = [0, 1, 2].map(row => Number(matrix[row][column]));
962
+ const length = Math.hypot(...axis);
963
+ if (!(length > 0)) {
964
+ return false;
965
+ }
966
+ if (axis.some((value, row) => Math.abs(value / length - Number(row === column)) > 1e-5)) {
967
+ return true;
968
+ }
969
+ }
970
+ return false;
971
+ }
956
972
  /*
957
973
  * The eight padded world corners of an assembly Entity's geometry box, or null when the record cannot give one.
958
974
  *
@@ -971,6 +987,10 @@ var EntityLabel;
971
987
  if ((matrix === null || matrix === void 0 ? void 0 : matrix.length) !== 4 || !matrix.every(row => (row === null || row === void 0 ? void 0 : row.length) === 4) || !Number.isFinite(+(root === null || root === void 0 ? void 0 : root.latitude)) || !Number.isFinite(+(root === null || root === void 0 ? void 0 : root.longitude))) {
972
988
  return null;
973
989
  }
990
+ // A pure translation can hide a rotation baked into the vertices, which leaves the extents loose.
991
+ if (!shape && !isRotated(matrix)) {
992
+ return null;
993
+ }
974
994
  const pivot = ((_c = bruce.GeometryPivot) === null || _c === void 0 ? void 0 : _c.length) >= 3 ? bruce.GeometryPivot.slice(0, 3).map(Number) : [0, 0, 0];
975
995
  // Without an oriented box the record's own extents are an axis-aligned box about the pivot.
976
996
  const box = shape || { centre: pivot, axes: [[1, 0, 0], [0, 1, 0], [0, 0, 1]], half: half };
@@ -2689,7 +2709,7 @@ var EntityLabel;
2689
2709
  viewportWidth: this.viewer.canvas.clientWidth,
2690
2710
  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,
2691
2711
  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,
2692
- iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend,
2712
+ iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend, follows: !pinned && Boolean(transientPivot || cursorMotion.target),
2693
2713
  // Priority shows the hovered member individually without dragging its cluster along.
2694
2714
  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
2695
2715
  };
@@ -2816,15 +2836,16 @@ var EntityLabel;
2816
2836
  const normalRadius = (!leader || (ring === null || ring === void 0 ? void 0 : ring.enabled) === false ? 0 : Math.max(frame.distance <= ((_l = ring === null || ring === void 0 ? void 0 : ring.nearDistance) !== null && _l !== void 0 ? _l : 100) ? ((_m = ring === null || ring === void 0 ? void 0 : ring.nearRadius) !== null && _m !== void 0 ? _m : 10) : 0, hovered ? ((_o = ring === null || ring === void 0 ? void 0 : ring.hoverRadius) !== null && _o !== void 0 ? _o : (this.Transient && !this.Persistent ? 15.4 : 22)) : 0));
2817
2837
  const targetRadius = normalRadius + (15.4 - normalRadius) * cursorMotion.amount;
2818
2838
  // Around a glyph the ring keeps the glyph's size and only fades its stroke in, so it never covers the icon.
2819
- const targetOuter = iconRing || targetRadius || 2.5;
2820
- const targetInner = iconRing ? (targetRadius > 0 ? iconRing - 2 : iconRing) : Math.max(0, targetRadius - 2);
2839
+ // A ring around the cursor marks nothing, so a riding label keeps only its leader.
2840
+ const targetOuter = frame.follows ? 0 : iconRing || targetRadius || 2.5;
2841
+ const targetInner = frame.follows ? 0 : iconRing ? (targetRadius > 0 ? iconRing - 2 : iconRing) : Math.max(0, targetRadius - 2);
2821
2842
  const now = Date.now();
2822
2843
  const duration = (_p = ring === null || ring === void 0 ? void 0 : ring.transitionDuration) !== null && _p !== void 0 ? _p : 200;
2823
2844
  const sharedRing = this.Transient && !this.Persistent && this.hoverFade.to === 1 ? this.hoverRingState : undefined;
2824
2845
  let ringAnimation = sharedRing ? sharedRing.animation : this.ringAnimation;
2825
2846
  if (!ringAnimation) {
2826
- const outer = iconRing || 2.5;
2827
- const inner = iconRing;
2847
+ const outer = frame.follows ? 0 : iconRing || 2.5;
2848
+ const inner = frame.follows ? 0 : iconRing;
2828
2849
  ringAnimation = { target: outer, targetInner: inner, start: now, outer, inner, fromOuter: outer, fromInner: inner };
2829
2850
  }
2830
2851
  ;