bruce-cesium 7.8.0 → 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.
@@ -1,6 +1,6 @@
1
1
  import * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, JulianDate, Quaternion, HeadingPitchRoll, ColorBlendMode, Model, ClassificationType, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, FeatureDetection, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, OrthographicFrustum, EasingFunction, WebGLConstants, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, PrimitiveCollection, ShadowMode, PolylineCollection, LabelCollection, LabelStyle, Material, CustomDataSource, GeometryInstance, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, Event, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Geometry as Geometry$1, Api, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, Bounds, ClientFileValueMap, Color as Color$1, BruceApi, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Cartesian3, Model, ClassificationType, Matrix4, JulianDate, Quaternion, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, Cartesian2, Cartesian4, SceneMode, Ellipsoid, IntersectionTests, Ray, SceneTransforms, ShaderSource, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Intersect, WebGLConstants, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, ShadowMode, DynamicEnvironmentMapManager, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, Event, GeometryInstance, CustomDataSource, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Geometry as Geometry$1, Api, Bounds, ClientFileValueMap, Color as Color$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, BruceApi, EntityRelation, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttribute, MathUtils } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -7237,6 +7237,10 @@ var EntityLabel;
7237
7237
  const ICON_STACK_SCALE = 0.6;
7238
7238
  // How far an angled leader runs sideways before the label starts.
7239
7239
  const ANGLED_LEADER_RUN = 28;
7240
+ // How far a pin's white body reaches past the icon it wraps, before its tip.
7241
+ const PIN_RIM = 7;
7242
+ // A pin is drawn in one fixed look for now: a white body with a faint edge and a soft shadow.
7243
+ const PIN_COLOR = "#ffffff";
7240
7244
  // Clearance between a point or billboard glyph and the ring drawn around it.
7241
7245
  const ICON_RING_PADDING = 4;
7242
7246
  // Small points still get a ring as large as the default near ring.
@@ -7670,6 +7674,12 @@ var EntityLabel;
7670
7674
  color.brighten(ICON_BACKGROUND_BLEND, new Color());
7671
7675
  return shade.withAlpha(alpha).toCssColorString();
7672
7676
  }
7677
+ /*
7678
+ * 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.
7679
+ */
7680
+ function pinLook(look) {
7681
+ return look.iconBackground ? look : { ...look, iconBackground: PIN_COLOR };
7682
+ }
7673
7683
  function iconLook(options) {
7674
7684
  return {
7675
7685
  icon: options.icon || undefined,
@@ -9461,7 +9471,9 @@ var EntityLabel;
9461
9471
  target.addEventListener(type, event => event.stopPropagation());
9462
9472
  }
9463
9473
  };
9464
- const normalLeader = (_m = look.leader) !== null && _m !== void 0 ? _m : presentation === "text";
9474
+ // A pin needs an icon to wrap; a photo keeps its own shape, and plain text keeps a straight stem.
9475
+ const pin = this.options.leaderStyle === "pin" && look.leader !== false && presentation !== "text" && !look.iconPhoto;
9476
+ const normalLeader = (_m = look.leader) !== null && _m !== void 0 ? _m : (presentation === "text" || pin);
9465
9477
  const angled = this.options.leaderStyle === "angled";
9466
9478
  let leader = normalLeader;
9467
9479
  const content = document.createElement("span");
@@ -9472,6 +9484,8 @@ var EntityLabel;
9472
9484
  let iconElement;
9473
9485
  let iconContainer;
9474
9486
  let fitIconBackground;
9487
+ let pinHolder;
9488
+ let pinBody;
9475
9489
  let iconStack;
9476
9490
  let stackedFits = [];
9477
9491
  let displayedStack = "[]";
@@ -9492,7 +9506,8 @@ var EntityLabel;
9492
9506
  content.style.flexDirection = shape === "rect" ? "column-reverse" : "";
9493
9507
  };
9494
9508
  if (presentation !== "text") {
9495
- const built = this.buildIcon(look, counter, placePhoto);
9509
+ // Without a chip of its own the icon sits on the pin's white body, so its colour is inferred from that.
9510
+ const built = this.buildIcon(pin ? pinLook(look) : look, counter, placePhoto);
9496
9511
  startPhoto = built.start;
9497
9512
  const icon = iconElement = built.icon;
9498
9513
  fitIconBackground = built.fit;
@@ -9517,6 +9532,20 @@ var EntityLabel;
9517
9532
  iconStack.style.cssText = "display:none;gap:2px;align-items:center;justify-items:center;flex:none;";
9518
9533
  makeClickable(iconStack);
9519
9534
  iconContainer.append(iconStack, icon);
9535
+ if (pin) {
9536
+ // The shadow sits on an unturned holder so it falls the same way whichever way the tip points.
9537
+ pinHolder = document.createElement("span");
9538
+ pinHolder.className = "entity-label-pin";
9539
+ pinHolder.style.cssText = "position:absolute;left:50%;top:50%;z-index:-1;pointer-events:none;" +
9540
+ "filter:drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.35));";
9541
+ pinBody = document.createElement("span");
9542
+ pinBody.style.cssText = `position:absolute;inset:0;background:${PIN_COLOR};border:1px solid rgba(0, 0, 0, 0.14);` +
9543
+ "box-sizing:border-box;border-radius:50% 50% 0 50%;";
9544
+ pinHolder.appendChild(pinBody);
9545
+ iconContainer.prepend(pinHolder);
9546
+ // Text beside or above keeps its usual gap from the body rather than from the icon inside it.
9547
+ content.style.gap = `${6 + PIN_RIM}px`;
9548
+ }
9520
9549
  content.appendChild(iconContainer);
9521
9550
  }
9522
9551
  if (presentation !== "icon") {
@@ -9687,6 +9716,36 @@ var EntityLabel;
9687
9716
  run, side: (rightwards ? "right" : "left")
9688
9717
  };
9689
9718
  };
9719
+ /*
9720
+ * Where the icon sits in the label, and how far the pin's tip reaches from its centre, in layout pixels.
9721
+ * Measured from the icon's container, so a cluster's icon stack is wrapped the same way as a lone icon.
9722
+ */
9723
+ const measurePin = () => {
9724
+ const scale = layer.coordinates.scaleX;
9725
+ const radius = Math.max(iconContainer.offsetWidth, iconContainer.offsetHeight) / 2 + PIN_RIM;
9726
+ return {
9727
+ x: (iconContainer.offsetLeft + iconContainer.offsetWidth / 2) / scale,
9728
+ y: (iconContainer.offsetTop + iconContainer.offsetHeight / 2) / layer.coordinates.scaleY,
9729
+ radius: radius / scale,
9730
+ // The body's one square corner, half a diagonal from its centre.
9731
+ tip: radius * Math.SQRT2 / scale
9732
+ };
9733
+ };
9734
+ /*
9735
+ * A pin stands over its anchor with the icon centred on it, and hangs below when there is no room above.
9736
+ * Off to the side it is only clamped back on screen, and its tip turns to keep pointing at the anchor.
9737
+ */
9738
+ const fitPin = (anchorX, anchorY, stem, width, height, shape) => {
9739
+ const canvas = this.viewer.canvas;
9740
+ const reach = stem + shape.tip;
9741
+ const above = anchorY - reach - shape.y;
9742
+ const below = anchorY + reach - shape.y;
9743
+ const upwards = above >= 0 || (below + height > canvas.clientHeight && anchorY >= canvas.clientHeight - anchorY);
9744
+ return {
9745
+ x: Math.max(0, Math.min(anchorX - shape.x, canvas.clientWidth - width)),
9746
+ y: upwards ? above : below
9747
+ };
9748
+ };
9690
9749
  /*
9691
9750
  * The on-screen centre and half-size of a point or billboard glyph, relative to its projected position.
9692
9751
  * Read every frame, since styling and selection can rescale a billboard in place.
@@ -9803,7 +9862,7 @@ var EntityLabel;
9803
9862
  }
9804
9863
  let cursorMotion = this.cursorMotion;
9805
9864
  const project = () => {
9806
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
9865
+ 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;
9807
9866
  if (this.disposed || !this.viewer || this.viewer.isDestroyed() || ((_a = this.visible) === null || _a === void 0 ? void 0 : _a.call(this)) === false ||
9808
9867
  (presentation === "icon" && this.options.iconScale === 0)) {
9809
9868
  return null;
@@ -9920,6 +9979,10 @@ var EntityLabel;
9920
9979
  else if (this.options.leaderLength != null) {
9921
9980
  leaderLength = Math.max(0, this.options.leaderLength);
9922
9981
  }
9982
+ else if (pin) {
9983
+ // The tip itself is the leader, so by default it touches what it marks.
9984
+ leaderLength = 0;
9985
+ }
9923
9986
  else if (transientPivot) {
9924
9987
  // Cursor callouts must not jump when the next hover target has a different extent.
9925
9988
  leaderLength = 96;
@@ -9936,14 +9999,15 @@ var EntityLabel;
9936
9999
  if (visual instanceof Entity && (visual.polygon || visual.polyline))
9937
10000
  leaderLength /= 3;
9938
10001
  }
9939
- if (boxAnchor && this.options.leaderLength == null) {
10002
+ if (boxAnchor && this.options.leaderLength == null && !pin) {
9940
10003
  leaderLength += (MODEL_BOX_STEM - leaderLength) * boxBlend;
9941
10004
  }
9942
10005
  if (cursorAmount > 0) {
9943
10006
  leaderLength += (96 - leaderLength) * cursorAmount;
9944
10007
  }
9945
10008
  // Measured from the ring, so the visible stem is the same length whatever the glyph's size.
9946
- leaderLength += iconRing;
10009
+ // A pin's tip rests on the glyph instead, since no ring is drawn around it.
10010
+ leaderLength += pin ? (_t = icon === null || icon === void 0 ? void 0 : icon.radius) !== null && _t !== void 0 ? _t : 0 : iconRing;
9947
10011
  y = anchorY - leaderLength;
9948
10012
  }
9949
10013
  else if (hover && !reused && !pinned) {
@@ -9955,7 +10019,7 @@ var EntityLabel;
9955
10019
  const width = ele.offsetWidth / coordinates.scaleX;
9956
10020
  const height = ele.offsetHeight / coordinates.scaleY;
9957
10021
  let clusterBounds;
9958
- if ((_t = this.options.cluster) === null || _t === void 0 ? void 0 : _t.enabled) {
10022
+ if ((_u = this.options.cluster) === null || _u === void 0 ? void 0 : _u.enabled) {
9959
10023
  const textWidth = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetWidth) || 0;
9960
10024
  const textHeight = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetHeight) || 0;
9961
10025
  // A photo is never part of the footprint, so its arrival cannot change which cluster a label joins.
@@ -9967,7 +10031,7 @@ var EntityLabel;
9967
10031
  const baseWidth = ((above ? Math.max(textWidth, iconWidth) : textWidth + iconWidth + gap) + 16) / coordinates.scaleX;
9968
10032
  const baseHeight = ((above ? textHeight + iconHeight + gap : Math.max(textHeight, iconHeight)) + 12) / coordinates.scaleY;
9969
10033
  clusterBounds = {
9970
- x: leader ? x : x - baseWidth / 2,
10034
+ x: leader && !pin ? x : x - baseWidth / 2,
9971
10035
  y: leader ? y - baseHeight : y - baseHeight / 2, width: baseWidth, height: baseHeight
9972
10036
  };
9973
10037
  }
@@ -9978,7 +10042,9 @@ var EntityLabel;
9978
10042
  // Membership uses the unclamped source footprint, never the summary's changing dimensions.
9979
10043
  let leaderRun;
9980
10044
  let leaderSide;
9981
- if (leader && angled) {
10045
+ if (leader && pin)
10046
+ ({ x, y } = fitPin(anchorX, anchorY, leaderLength, width, height, measurePin()));
10047
+ else if (leader && angled) {
9982
10048
  const fit = fitAngledLeader(anchorX, anchorY, leaderLength, width, height);
9983
10049
  ({ x, y } = fit);
9984
10050
  ({ run: leaderRun, side: leaderSide } = fit);
@@ -9989,16 +10055,16 @@ var EntityLabel;
9989
10055
  if (!leader && (bounds.x + bounds.width < 0 || bounds.y + bounds.height < 0 || bounds.x > this.viewer.canvas.clientWidth || bounds.y > this.viewer.canvas.clientHeight)) {
9990
10056
  return null;
9991
10057
  }
9992
- 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 });
10058
+ 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 });
9993
10059
  const opacity = this.prePositioned || hoverOnly || MAX_DISTANCE === Infinity ? 1 : 1 - distance / MAX_DISTANCE;
9994
10060
  return {
9995
- canFlip: leader && presentation !== "icon", hasLeader: leader,
10061
+ canFlip: leader && presentation !== "icon" && !pin, hasLeader: leader,
9996
10062
  textWrapped: ((sourceNaturalText === null || sourceNaturalText === void 0 ? void 0 : sourceNaturalText.offsetWidth) || 0) > TEXT_MAX_WIDTH,
9997
10063
  transient: this.Transient || Boolean(hover) || cursorAmount > 0,
9998
10064
  extendedGeometry: visual instanceof Entity && Boolean(visual.polygon || visual.polyline || visual.corridor),
9999
10065
  viewportWidth: this.viewer.canvas.clientWidth,
10000
- 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,
10001
- 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,
10066
+ 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,
10067
+ 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,
10002
10068
  iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend, follows: !pinned && Boolean(transientPivot || cursorMotion.target),
10003
10069
  // Priority shows the hovered member individually without dragging its cluster along.
10004
10070
  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
@@ -10015,7 +10081,8 @@ var EntityLabel;
10015
10081
  lineEle.style.display = show && leader ? "block" : "none";
10016
10082
  if (runEle)
10017
10083
  runEle.style.display = show && leader ? "block" : "none";
10018
- this.anchor.style.display = show && leader && !(((_a = placement.frame) === null || _a === void 0 ? void 0 : _a.boxBlend) >= 1) ? "block" : "none";
10084
+ // A pin's tip marks the anchor itself, so it has no ring there.
10085
+ this.anchor.style.display = show && leader && !pin && !(((_a = placement.frame) === null || _a === void 0 ? void 0 : _a.boxBlend) >= 1) ? "block" : "none";
10019
10086
  if (!show) {
10020
10087
  displacement = { x: 0, y: 0 };
10021
10088
  nudge = { x: 0, y: 0, fromX: 0, fromY: 0, targetX: 0, targetY: 0, start: 0 };
@@ -10072,7 +10139,7 @@ var EntityLabel;
10072
10139
  const looks = ((_d = placement.icons) === null || _d === void 0 ? void 0 : _d.length) ? [iconLook(this.options), ...placement.icons] : [];
10073
10140
  // One small size for all, so no icon in the arrangement reads as more important than another.
10074
10141
  const size = (this.options.iconSize || 24) * ((_e = this.options.iconScale) !== null && _e !== void 0 ? _e : 1) * ICON_STACK_SCALE;
10075
- const built = looks.map(look => this.buildIcon({ ...look, iconSize: size }, counter));
10142
+ const built = looks.map(look => this.buildIcon({ ...(pin ? pinLook(look) : look), iconSize: size }, counter));
10076
10143
  // A stack is on show already, so its photos load straight away.
10077
10144
  built.forEach(({ start }) => start === null || start === void 0 ? void 0 : start());
10078
10145
  // Two sit side by side; three make a triangle with the representative on top.
@@ -10166,7 +10233,9 @@ var EntityLabel;
10166
10233
  }
10167
10234
  const ringShare = 1 - (frame.boxBlend || 0);
10168
10235
  const radius = ringShare > 0 && ringAnimation.inner > 0 ? ringAnimation.outer * ringShare : 0;
10169
- 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);
10236
+ const pinShape = leader && pin ? measurePin() : undefined;
10237
+ const stem = (pinShape ? fitPin(frame.anchorX, frame.anchorY, frame.leaderLength, ele.offsetWidth / coordinates.scaleX, ele.offsetHeight / coordinates.scaleY, pinShape) :
10238
+ 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);
10170
10239
  const position = { x: (stem || frame).x, y: (stem || frame).y };
10171
10240
  const width = ele.offsetWidth / coordinates.scaleX;
10172
10241
  const height = ele.offsetHeight / coordinates.scaleY;
@@ -10177,7 +10246,7 @@ var EntityLabel;
10177
10246
  const beside = side === "left" ? frame.anchorX - run - width : frame.anchorX + run;
10178
10247
  position.x = Math.max(0, Math.min(beside, this.viewer.canvas.clientWidth - width));
10179
10248
  }
10180
- else if (leader && placement.textSide === "left") {
10249
+ else if (leader && !pin && placement.textSide === "left") {
10181
10250
  position.x = Math.max(0, Math.min(frame.anchorX - width, this.viewer.canvas.clientWidth - width));
10182
10251
  }
10183
10252
  const gap = (_t = (_s = this.options.pointerAvoidance) === null || _s === void 0 ? void 0 : _s.gap) !== null && _t !== void 0 ? _t : 12;
@@ -10258,8 +10327,23 @@ var EntityLabel;
10258
10327
  const straightY = frame.anchorY < position.y ? position.y : frame.anchorY > position.y + height ? position.y + height : frame.anchorY;
10259
10328
  const beside = angled && (frame.anchorX < position.x || frame.anchorX > position.x + width);
10260
10329
  const elbowY = position.y + height / 2;
10261
- const endX = beside ? frame.anchorX : straightX;
10262
- const endY = beside ? elbowY : straightY;
10330
+ let endX = beside ? frame.anchorX : straightX;
10331
+ let endY = beside ? elbowY : straightY;
10332
+ if (pinShape) {
10333
+ // Aimed from wherever clamping or a nudge left it; a stem, if any, meets the tip.
10334
+ const centreX = position.x + pinShape.x, centreY = position.y + pinShape.y;
10335
+ const aim = Math.atan2(frame.anchorY - centreY, frame.anchorX - centreX);
10336
+ const reach = Math.min(pinShape.tip, Math.hypot(frame.anchorX - centreX, frame.anchorY - centreY));
10337
+ endX = centreX + Math.cos(aim) * reach;
10338
+ endY = centreY + Math.sin(aim) * reach;
10339
+ const size = `${pinShape.radius * 2 * coordinates.scaleX}px`;
10340
+ if (pinHolder.style.width !== size) {
10341
+ pinHolder.style.width = pinHolder.style.height = size;
10342
+ pinHolder.style.margin = `-${pinShape.radius * coordinates.scaleX}px`;
10343
+ }
10344
+ // The body's square corner starts at the lower right, a quarter turn short of pointing down.
10345
+ pinBody.style.transform = `rotate(${aim - Math.PI / 4}rad)`;
10346
+ }
10263
10347
  const runToX = frame.anchorX < position.x ? position.x : position.x + width;
10264
10348
  const dx = endX - frame.anchorX, dy = endY - frame.anchorY;
10265
10349
  const length = Math.hypot(dx, dy);
@@ -60365,7 +60449,7 @@ var StyleUtils;
60365
60449
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
60366
60450
  })(StyleUtils || (StyleUtils = {}));
60367
60451
 
60368
- const VERSION = "7.8.0";
60452
+ const VERSION = "7.8.1";
60369
60453
  /**
60370
60454
  * Updates the environment instance used by bruce-cesium to one specified.
60371
60455
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.