bruce-cesium 7.5.9 → 7.6.0
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.
- package/dist/bruce-cesium.es5.js +32 -15
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +30 -13
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +29 -12
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +1 -1
package/dist/lib/bruce-cesium.js
CHANGED
|
@@ -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.
|
|
92
|
+
exports.VERSION = "7.6.0";
|
|
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.
|
|
@@ -2421,6 +2421,22 @@ var EntityLabel;
|
|
|
2421
2421
|
radius: Math.max(width, height) / 2
|
|
2422
2422
|
};
|
|
2423
2423
|
};
|
|
2424
|
+
/*
|
|
2425
|
+
* The on-screen centre and half-size of a model too small for its box, so the box is ringed like a glyph.
|
|
2426
|
+
*/
|
|
2427
|
+
const measureModel = (anchor) => {
|
|
2428
|
+
const hull = layer.modelBoxes.Hull(this.id);
|
|
2429
|
+
if (!(hull === null || hull === void 0 ? void 0 : hull.length)) {
|
|
2430
|
+
return null;
|
|
2431
|
+
}
|
|
2432
|
+
const xs = hull.map(point => point.x), ys = hull.map(point => point.y);
|
|
2433
|
+
const left = Math.min(...xs), top = Math.min(...ys);
|
|
2434
|
+
const width = Math.max(...xs) - left, height = Math.max(...ys) - top;
|
|
2435
|
+
if (Math.max(width, height) >= MODEL_BOX_MIN_SIZE) {
|
|
2436
|
+
return null;
|
|
2437
|
+
}
|
|
2438
|
+
return { x: left + width / 2 - anchor.x, y: top + height / 2 - anchor.y, radius: Math.max(width, height) / 2 };
|
|
2439
|
+
};
|
|
2424
2440
|
// Only CAD tilesets and model Entities are assembly parts with a geometry box; anything else stays a point.
|
|
2425
2441
|
const boxable = Boolean(normalLeader && ((_r = this.rego) === null || _r === void 0 ? void 0 : _r.entityId) && ((visual instanceof Cesium.Cesium3DTileFeature && this.rego.tilesetType === bruce_models_1.Tileset.EType.Cad) ||
|
|
2426
2442
|
(visual instanceof Cesium.Entity && Boolean(visual.model))));
|
|
@@ -2479,7 +2495,7 @@ var EntityLabel;
|
|
|
2479
2495
|
}
|
|
2480
2496
|
let cursorMotion = this.cursorMotion;
|
|
2481
2497
|
const project = () => {
|
|
2482
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
2498
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
2483
2499
|
if (this.disposed || !this.viewer || this.viewer.isDestroyed() || ((_a = this.visible) === null || _a === void 0 ? void 0 : _a.call(this)) === false ||
|
|
2484
2500
|
(presentation === "icon" && this.options.iconScale === 0)) {
|
|
2485
2501
|
return null;
|
|
@@ -2522,7 +2538,8 @@ var EntityLabel;
|
|
|
2522
2538
|
const boxBlend = this.morphToBox(boxed, shownOnce ? (_f = (_e = this.options.anchorRing) === null || _e === void 0 ? void 0 : _e.transitionDuration) !== null && _f !== void 0 ? _f : 200 : 0);
|
|
2523
2539
|
// Eased between the ring and where the stem meets the box, so gaining or losing a box never jumps.
|
|
2524
2540
|
const boxTarget = this.boxMorph.anchor;
|
|
2525
|
-
const
|
|
2541
|
+
const model = ((_g = this.modelBox) === null || _g === void 0 ? void 0 : _g.corners) ? measureModel(anchor) : null;
|
|
2542
|
+
const ringPoint = { x: anchor.x + (model || pixelOffset).x, y: anchor.y + (model || pixelOffset).y };
|
|
2526
2543
|
const boxAnchor = boxBlend > 0 && boxTarget ? {
|
|
2527
2544
|
x: ringPoint.x + (boxTarget.x - ringPoint.x) * boxBlend,
|
|
2528
2545
|
y: ringPoint.y + (boxTarget.y - ringPoint.y) * boxBlend
|
|
@@ -2533,13 +2550,13 @@ var EntityLabel;
|
|
|
2533
2550
|
return null;
|
|
2534
2551
|
if (onScreen && !this.imageAsked && this.groupId && !HasIcon(this.options) && !this.options.photo) {
|
|
2535
2552
|
this.imageAsked = true;
|
|
2536
|
-
(
|
|
2553
|
+
(_h = this.visualRegister) === null || _h === void 0 ? void 0 : _h.RequestLabelImage((_j = this.rego) === null || _j === void 0 ? void 0 : _j.entityId);
|
|
2537
2554
|
}
|
|
2538
2555
|
const transientPivot = (this.Transient && !this.Persistent ?
|
|
2539
|
-
(this.hoverFade.to === 0 ? this.retainedHoverPosition : (
|
|
2556
|
+
(this.hoverFade.to === 0 ? this.retainedHoverPosition : (_k = this.visualRegister) === null || _k === void 0 ? void 0 : _k.GetLabelHoverPosition((_l = this.rego) === null || _l === void 0 ? void 0 : _l.entityId, (_m = this.rego) === null || _m === void 0 ? void 0 : _m.menuItemId)) : undefined);
|
|
2540
2557
|
const hover = (presentation !== "icon" ?
|
|
2541
2558
|
(this.Transient && !this.Persistent && this.hoverFade.to === 0 ? this.retainedHoverPosition :
|
|
2542
|
-
(
|
|
2559
|
+
(_o = this.visualRegister) === null || _o === void 0 ? void 0 : _o.GetLabelHoverPosition((_p = this.rego) === null || _p === void 0 ? void 0 : _p.entityId, (_q = this.rego) === null || _q === void 0 ? void 0 : _q.menuItemId)) : undefined);
|
|
2543
2560
|
const reused = !this.Transient || this.Persistent;
|
|
2544
2561
|
const now = Date.now();
|
|
2545
2562
|
const animateCursor = () => {
|
|
@@ -2566,13 +2583,13 @@ var EntityLabel;
|
|
|
2566
2583
|
const cursorAmount = cursorMotion.amount;
|
|
2567
2584
|
leader = normalLeader || cursorAmount > 0;
|
|
2568
2585
|
// An icon keeps its callout centred on the glyph rather than following the cursor across it.
|
|
2569
|
-
const icon = boxAnchor ? null : measureIcon();
|
|
2586
|
+
const icon = boxAnchor ? null : measureIcon() || model;
|
|
2570
2587
|
const iconRing = icon ? Math.max(ICON_RING_MIN, icon.radius + ICON_RING_PADDING) : 0;
|
|
2571
2588
|
// A boxed model is pinned the same way, with its stem leaving the top of the box outline.
|
|
2572
2589
|
const pinned = Boolean(icon || boxAnchor);
|
|
2573
2590
|
const pivot = pinned ? undefined : transientPivot;
|
|
2574
|
-
let x = boxAnchor ? boxAnchor.x : ((
|
|
2575
|
-
let y = boxAnchor ? boxAnchor.y : ((
|
|
2591
|
+
let x = boxAnchor ? boxAnchor.x : ((_r = pivot === null || pivot === void 0 ? void 0 : pivot.x) !== null && _r !== void 0 ? _r : anchor.x) + (icon || pixelOffset).x;
|
|
2592
|
+
let y = boxAnchor ? boxAnchor.y : ((_s = pivot === null || pivot === void 0 ? void 0 : pivot.y) !== null && _s !== void 0 ? _s : anchor.y) + (icon || pixelOffset).y;
|
|
2576
2593
|
if (cursorAmount > 0 && !pinned) {
|
|
2577
2594
|
// A leader-less label starts centred on its anchor; preserve that box as it lifts away.
|
|
2578
2595
|
if (!normalLeader) {
|
|
@@ -2628,7 +2645,7 @@ var EntityLabel;
|
|
|
2628
2645
|
const width = ele.offsetWidth / coordinates.scaleX;
|
|
2629
2646
|
const height = ele.offsetHeight / coordinates.scaleY;
|
|
2630
2647
|
let clusterBounds;
|
|
2631
|
-
if ((
|
|
2648
|
+
if ((_t = this.options.cluster) === null || _t === void 0 ? void 0 : _t.enabled) {
|
|
2632
2649
|
const textWidth = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetWidth) || 0;
|
|
2633
2650
|
const textHeight = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetHeight) || 0;
|
|
2634
2651
|
// A photo is never part of the footprint, so its arrival cannot change which cluster a label joins.
|
|
@@ -2662,7 +2679,7 @@ var EntityLabel;
|
|
|
2662
2679
|
if (!leader && (bounds.x + bounds.width < 0 || bounds.y + bounds.height < 0 || bounds.x > this.viewer.canvas.clientWidth || bounds.y > this.viewer.canvas.clientHeight)) {
|
|
2663
2680
|
return null;
|
|
2664
2681
|
}
|
|
2665
|
-
const state = (
|
|
2682
|
+
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 });
|
|
2666
2683
|
const opacity = this.prePositioned || hoverOnly || MAX_DISTANCE === Infinity ? 1 : 1 - distance / MAX_DISTANCE;
|
|
2667
2684
|
return {
|
|
2668
2685
|
canFlip: leader && presentation !== "icon", hasLeader: leader,
|
|
@@ -2670,8 +2687,8 @@ var EntityLabel;
|
|
|
2670
2687
|
transient: this.Transient || Boolean(hover) || cursorAmount > 0,
|
|
2671
2688
|
extendedGeometry: visual instanceof Cesium.Entity && Boolean(visual.polygon || visual.polyline || visual.corridor),
|
|
2672
2689
|
viewportWidth: this.viewer.canvas.clientWidth,
|
|
2673
|
-
id: this.id, entityKey: ((
|
|
2674
|
-
entityId: (
|
|
2690
|
+
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
|
+
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,
|
|
2675
2692
|
iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend,
|
|
2676
2693
|
// Priority shows the hovered member individually without dragging its cluster along.
|
|
2677
2694
|
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
|