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.
@@ -1,6 +1,6 @@
1
1
  import { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -7172,7 +7172,7 @@ var EntityRenderEngineModel3d;
7172
7172
  * @returns
7173
7173
  */
7174
7174
  function Render(params) {
7175
- var _a, _b, _c, _d, _e, _f;
7175
+ var _a, _b, _c, _d;
7176
7176
  const entity = params.entity;
7177
7177
  if (!params.entityHistoric) {
7178
7178
  params.entityHistoric = [];
@@ -7364,6 +7364,8 @@ var EntityRenderEngineModel3d;
7364
7364
  cEntity.model.colorBlendAmount = new ConstantProperty(blendAmount);
7365
7365
  cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
7366
7366
  cEntity.model.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
7367
+ 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;
7368
+ const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7367
7369
  if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
7368
7370
  animatePosition = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"];
7369
7371
  const animateSeries = animatePosition;
@@ -7371,8 +7373,6 @@ var EntityRenderEngineModel3d;
7371
7373
  if (series.length) {
7372
7374
  animateSeries.SupplementSeries(series);
7373
7375
  }
7374
- 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;
7375
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7376
7376
  if (dateTime) {
7377
7377
  animateSeries.UpdatePositionForDateTime(pos3d, dateTime, !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading);
7378
7378
  }
@@ -7395,8 +7395,6 @@ var EntityRenderEngineModel3d;
7395
7395
  cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
7396
7396
  }
7397
7397
  else {
7398
- 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;
7399
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7400
7398
  const posChanged = !prevPos3d || !Cartesian3.equals(prevPos3d, pos3d);
7401
7399
  if (posChanged) {
7402
7400
  let posses = [];
@@ -7426,7 +7424,7 @@ var EntityRenderEngineModel3d;
7426
7424
  }
7427
7425
  }
7428
7426
  // If we're animating position then we can animate orientation too based on the interpolated position.
7429
- if (animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7427
+ if (dateTime && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7430
7428
  cEntity.orientation = new CallbackProperty(() => {
7431
7429
  return animatePosition.GetOrient();
7432
7430
  }, false);
@@ -7571,7 +7569,7 @@ var EntityRenderEngineModel3d;
7571
7569
  // Generate a polyline 'track' for the historic data.
7572
7570
  // We do this for historic data that exists and is moving.
7573
7571
  if (shouldShowTrack && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
7574
- const lStyle = (_f = (_e = params.fullStyle) === null || _e === void 0 ? void 0 : _e.polylineStyle) !== null && _f !== void 0 ? _f : {};
7572
+ const lStyle = (_d = (_c = params.fullStyle) === null || _c === void 0 ? void 0 : _c.polylineStyle) !== null && _d !== void 0 ? _d : {};
7575
7573
  const bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
7576
7574
  const cColor = bColor ? ColorToCColor(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
7577
7575
  let width = lStyle.lineWidth ? EnsureNumber(Calculator.GetNumber(lStyle.lineWidth, entity, params.tags)) : 2;
@@ -32795,7 +32793,7 @@ function createDOMLabel(viewer, id, name, colorCss) {
32795
32793
  label.innerHTML = `<div style="margin-bottom:0px">${name !== null && name !== void 0 ? name : ""}</div>`;
32796
32794
  label.setAttribute("style", `
32797
32795
  position: absolute;
32798
- z-index: 1000;
32796
+ z-index: 2; /* keep under app panels */
32799
32797
  display: none;
32800
32798
  pointer-events: none;
32801
32799
  padding: 6px 10px;
@@ -32818,7 +32816,6 @@ function createDOMLabel(viewer, id, name, colorCss) {
32818
32816
  return label;
32819
32817
  }
32820
32818
  function updateDOMLabel(viewer, label, pos3d) {
32821
- var _a;
32822
32819
  if (!viewer || viewer.isDestroyed() || !label || !pos3d) {
32823
32820
  return;
32824
32821
  }
@@ -32841,11 +32838,11 @@ function updateDOMLabel(viewer, label, pos3d) {
32841
32838
  label.style.display = "none";
32842
32839
  return;
32843
32840
  }
32844
- const opacity = Math.max(0.2, 1 - (distance / maxDistance));
32845
- const camHeight = ((_a = viewer.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height) || distance;
32846
- const driver = Math.min(distance, camHeight);
32847
- const offsetX = 14 + Math.min(driver / 80, 30); // px
32848
- const offsetY = 12 + Math.min(driver / 100, 24); // px
32841
+ // Keep full opacity; no distance-based fading
32842
+ // Keep the label close to the cursor regardless of zoom
32843
+ // Use small, constant pixel offsets to bottom-right
32844
+ const offsetX = 12; // px
32845
+ const offsetY = 10; // px
32849
32846
  let leftPx = screenPos.x + offsetX;
32850
32847
  let topPx = screenPos.y + offsetY;
32851
32848
  const pad = 8;
@@ -32856,11 +32853,11 @@ function updateDOMLabel(viewer, label, pos3d) {
32856
32853
  label.style.left = `${leftPx}px`;
32857
32854
  label.style.top = `${topPx}px`;
32858
32855
  label.style.display = "block";
32859
- label.style.opacity = `${opacity}`;
32856
+ label.style.opacity = "1";
32860
32857
  }
32861
32858
  var LiveCursor;
32862
32859
  (function (LiveCursor) {
32863
- function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30 }) {
32860
+ function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30, labelZIndex }) {
32864
32861
  if (!labels[id]) {
32865
32862
  createDOMLabel(viewer, id, name !== null && name !== void 0 ? name : "", colorCss !== null && colorCss !== void 0 ? colorCss : "#3b82f6");
32866
32863
  }
@@ -32875,6 +32872,9 @@ var LiveCursor;
32875
32872
  labels[id].style.backgroundColor = colorCss;
32876
32873
  }
32877
32874
  }
32875
+ if (typeof labelZIndex === "number") {
32876
+ labels[id].style.zIndex = `${labelZIndex}`;
32877
+ }
32878
32878
  positions[id] = pos3d;
32879
32879
  viewers[id] = viewer;
32880
32880
  // Manage Cesium entity
@@ -32935,7 +32935,17 @@ var LiveCursor;
32935
32935
  if (!updaters[id]) {
32936
32936
  const remover = viewer.scene.postUpdate.addEventListener(() => {
32937
32937
  const label = labels[id];
32938
- const p = positions[id];
32938
+ let p = positions[id];
32939
+ // If we manage an entity with an animated position, follow its current value
32940
+ const ent = entities[id];
32941
+ if (ent === null || ent === void 0 ? void 0 : ent.position) {
32942
+ const posProp = ent.position;
32943
+ const date = viewer.scene.lastRenderTime || viewer.clock.currentTime;
32944
+ const val = (posProp === null || posProp === void 0 ? void 0 : posProp.getValue) ? posProp.getValue(date) : posProp;
32945
+ if (val && !isNaN(val.x)) {
32946
+ p = val;
32947
+ }
32948
+ }
32939
32949
  if (!label || !p) {
32940
32950
  return;
32941
32951
  }
@@ -33747,7 +33757,7 @@ class WidgetViewBar extends Widget.AWidget {
33747
33757
  }
33748
33758
  }
33749
33759
 
33750
- const VERSION = "6.1.4";
33760
+ const VERSION = "6.1.6";
33751
33761
 
33752
33762
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, LiveCursor, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
33753
33763
  //# sourceMappingURL=bruce-cesium.es5.js.map