bruce-cesium 6.1.4 → 6.1.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.
@@ -7154,7 +7154,7 @@
7154
7154
  * @returns
7155
7155
  */
7156
7156
  function Render(params) {
7157
- var _a, _b, _c, _d, _e, _f;
7157
+ var _a, _b, _c, _d;
7158
7158
  const entity = params.entity;
7159
7159
  if (!params.entityHistoric) {
7160
7160
  params.entityHistoric = [];
@@ -7346,6 +7346,8 @@
7346
7346
  cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
7347
7347
  cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
7348
7348
  cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(exports.EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
7349
+ const dateTimeStr = (_b = (_a = entity.Bruce.Outline) === null || _a === void 0 ? void 0 : _a.find(x => !!x.DateTime)) === null || _b === void 0 ? void 0 : _b.DateTime;
7350
+ const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7349
7351
  if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
7350
7352
  animatePosition = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"];
7351
7353
  const animateSeries = animatePosition;
@@ -7353,8 +7355,6 @@
7353
7355
  if (series.length) {
7354
7356
  animateSeries.SupplementSeries(series);
7355
7357
  }
7356
- const dateTimeStr = (_b = (_a = entity.Bruce.Outline) === null || _a === void 0 ? void 0 : _a.find(x => !!x.DateTime)) === null || _b === void 0 ? void 0 : _b.DateTime;
7357
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7358
7358
  if (dateTime) {
7359
7359
  animateSeries.UpdatePositionForDateTime(pos3d, dateTime, !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading);
7360
7360
  }
@@ -7377,8 +7377,6 @@
7377
7377
  cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
7378
7378
  }
7379
7379
  else {
7380
- const dateTimeStr = (_d = (_c = entity.Bruce.Outline) === null || _c === void 0 ? void 0 : _c.find(x => !!x.DateTime)) === null || _d === void 0 ? void 0 : _d.DateTime;
7381
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7382
7380
  const posChanged = !prevPos3d || !Cesium.Cartesian3.equals(prevPos3d, pos3d);
7383
7381
  if (posChanged) {
7384
7382
  let posses = [];
@@ -7408,7 +7406,7 @@
7408
7406
  }
7409
7407
  }
7410
7408
  // If we're animating position then we can animate orientation too based on the interpolated position.
7411
- if (animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7409
+ if (dateTime && animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7412
7410
  cEntity.orientation = new Cesium.CallbackProperty(() => {
7413
7411
  return animatePosition.GetOrient();
7414
7412
  }, false);
@@ -7553,7 +7551,7 @@
7553
7551
  // Generate a polyline 'track' for the historic data.
7554
7552
  // We do this for historic data that exists and is moving.
7555
7553
  if (shouldShowTrack && animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
7556
- const lStyle = (_f = (_e = params.fullStyle) === null || _e === void 0 ? void 0 : _e.polylineStyle) !== null && _f !== void 0 ? _f : {};
7554
+ const lStyle = (_d = (_c = params.fullStyle) === null || _c === void 0 ? void 0 : _c.polylineStyle) !== null && _d !== void 0 ? _d : {};
7557
7555
  const bColor = lStyle.lineColor ? BModels.Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
7558
7556
  const cColor = bColor ? ColorToCColor(bColor) : Cesium.Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
7559
7557
  let width = lStyle.lineWidth ? EnsureNumber(BModels.Calculator.GetNumber(lStyle.lineWidth, entity, params.tags)) : 2;
@@ -32692,7 +32690,7 @@
32692
32690
  label.innerHTML = `<div style="margin-bottom:0px">${name !== null && name !== void 0 ? name : ""}</div>`;
32693
32691
  label.setAttribute("style", `
32694
32692
  position: absolute;
32695
- z-index: 1000;
32693
+ z-index: 2; /* keep under app panels */
32696
32694
  display: none;
32697
32695
  pointer-events: none;
32698
32696
  padding: 6px 10px;
@@ -32715,7 +32713,6 @@
32715
32713
  return label;
32716
32714
  }
32717
32715
  function updateDOMLabel(viewer, label, pos3d) {
32718
- var _a;
32719
32716
  if (!viewer || viewer.isDestroyed() || !label || !pos3d) {
32720
32717
  return;
32721
32718
  }
@@ -32738,11 +32735,11 @@
32738
32735
  label.style.display = "none";
32739
32736
  return;
32740
32737
  }
32741
- const opacity = Math.max(0.2, 1 - (distance / maxDistance));
32742
- const camHeight = ((_a = viewer.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height) || distance;
32743
- const driver = Math.min(distance, camHeight);
32744
- const offsetX = 14 + Math.min(driver / 80, 30); // px
32745
- const offsetY = 12 + Math.min(driver / 100, 24); // px
32738
+ // Keep full opacity; no distance-based fading
32739
+ // Keep the label close to the cursor regardless of zoom
32740
+ // Use small, constant pixel offsets to bottom-right
32741
+ const offsetX = 12; // px
32742
+ const offsetY = 10; // px
32746
32743
  let leftPx = screenPos.x + offsetX;
32747
32744
  let topPx = screenPos.y + offsetY;
32748
32745
  const pad = 8;
@@ -32753,10 +32750,10 @@
32753
32750
  label.style.left = `${leftPx}px`;
32754
32751
  label.style.top = `${topPx}px`;
32755
32752
  label.style.display = "block";
32756
- label.style.opacity = `${opacity}`;
32753
+ label.style.opacity = "1";
32757
32754
  }
32758
32755
  (function (LiveCursor) {
32759
- function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30 }) {
32756
+ function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30, labelZIndex }) {
32760
32757
  if (!labels[id]) {
32761
32758
  createDOMLabel(viewer, id, name !== null && name !== void 0 ? name : "", colorCss !== null && colorCss !== void 0 ? colorCss : "#3b82f6");
32762
32759
  }
@@ -32771,6 +32768,9 @@
32771
32768
  labels[id].style.backgroundColor = colorCss;
32772
32769
  }
32773
32770
  }
32771
+ if (typeof labelZIndex === "number") {
32772
+ labels[id].style.zIndex = `${labelZIndex}`;
32773
+ }
32774
32774
  positions[id] = pos3d;
32775
32775
  viewers[id] = viewer;
32776
32776
  // Manage Cesium entity
@@ -32831,7 +32831,17 @@
32831
32831
  if (!updaters[id]) {
32832
32832
  const remover = viewer.scene.postUpdate.addEventListener(() => {
32833
32833
  const label = labels[id];
32834
- const p = positions[id];
32834
+ let p = positions[id];
32835
+ // If we manage an entity with an animated position, follow its current value
32836
+ const ent = entities[id];
32837
+ if (ent === null || ent === void 0 ? void 0 : ent.position) {
32838
+ const posProp = ent.position;
32839
+ const date = viewer.scene.lastRenderTime || viewer.clock.currentTime;
32840
+ const val = (posProp === null || posProp === void 0 ? void 0 : posProp.getValue) ? posProp.getValue(date) : posProp;
32841
+ if (val && !isNaN(val.x)) {
32842
+ p = val;
32843
+ }
32844
+ }
32835
32845
  if (!label || !p) {
32836
32846
  return;
32837
32847
  }
@@ -33642,7 +33652,7 @@
33642
33652
  }
33643
33653
  }
33644
33654
 
33645
- const VERSION = "6.1.4";
33655
+ const VERSION = "6.1.6";
33646
33656
 
33647
33657
  exports.VERSION = VERSION;
33648
33658
  exports.isOutlineChanged = isOutlineChanged;