@orbat-mapper/tactical-draw 0.17.1 → 0.19.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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as PinOverridePatch, B as isValidPinNumber, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PinPresentationStatus, H as pinZoomScale, I as PinPresentationStatusEvent, L as PinPresentationStore, M as PinPresentationCapability, N as PinPresentationPatch, O as DEFAULT_PIN_PRESENTATION, P as PinPresentationState, R as PinRender, S as isMinePattern, T as EditPointerDriver, U as resolvePinPresentation, V as pinDistanceScale, _ as HatchPattern, a as LayerId, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, j as PinPresentation, k as PinFootprint, l as MapEventHandler, m as StyleOptions, n as HandleStyle, o as MapAdapter, p as PixelCoordinate, r as IconResource, s as MapCursor, t as FeatureGroup, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as combinePinScale } from "./map-adapter-B8zVKzWH.mjs";
2
- import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
1
+ import { A as PinOverridePatch, B as isValidPinNumber, C as makeFillPatternImage, D as PointerEventInfo, E as PointerCallback, F as PinPresentationStatus, H as pinZoomScale, I as PinPresentationStatusEvent, L as PinPresentationStore, M as PinPresentationCapability, N as PinPresentationPatch, O as DEFAULT_PIN_PRESENTATION, P as PinPresentationState, R as PinRender, S as isMinePattern, T as EditPointerDriver, U as resolvePinPresentation, V as pinDistanceScale, _ as HatchPattern, a as LayerId, b as fillPatternImageDimension, c as MapEvent, d as PickHandler, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, j as PinPresentation, k as PinFootprint, l as MapEventHandler, m as StyleOptions, n as HandleStyle, o as MapAdapter, p as PixelCoordinate, r as IconResource, s as MapCursor, t as FeatureGroup, u as PickEvent, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as combinePinScale } from "./map-adapter-DFqXaRgp.mjs";
2
+ import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, LabelFit, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
3
3
  import { Feature, Position } from "geojson";
4
4
 
5
5
  //#region src/base-map-adapter.d.ts
@@ -218,27 +218,36 @@ declare function resolvePickPresentation(feature: Feature, layerStyle?: StyleOpt
218
218
  * when missing or shaped wrong so callers fall through to the layer style.
219
219
  */
220
220
  declare function coerceHandleStyle(raw: unknown): HandleStyle | undefined;
221
- /** Default lower edge of the ground-anchored label clamp band (ADR-0028). */
222
- declare const DEFAULT_TEXT_SIZE_MIN_PIXELS = 8;
223
- /** Default upper edge of the ground-anchored label clamp band (ADR-0028). */
221
+ /**
222
+ * Default lower edge of the ground-anchored label band (ADR-0060): below it a
223
+ * label fades out and hides on the map, rather than pinning.
224
+ */
225
+ declare const DEFAULT_TEXT_SIZE_MIN_PIXELS = 4;
226
+ /** Default upper edge of the ground-anchored label band (ADR-0028): labels pin here. */
224
227
  declare const DEFAULT_TEXT_SIZE_MAX_PIXELS = 24;
225
228
  /**
226
- * Rendered pixel size of a ground-anchored label (ADR-0028):
227
- * `textSizeMeters / resolution`, clamped to the layer's text-style band.
228
- * Within the band the text scales with its graphic; past either edge it pins
229
- * to the bound, so zooming out never yields unreadable smudges and zooming in
230
- * never yields screen-covering text. Shared by the adapters that resolve text
231
- * size in code (OpenLayers, Leaflet); the MapLibre adapter reproduces the same
232
- * clamp as a native camera expression whose stops are the two clamp
233
- * boundaries, so it stays exact at fractional zooms.
229
+ * Share of the band minimum at which a fading ground label reaches zero
230
+ * opacity and hides (ADR-0060): 4 px fades out to nothing at 3.2 px.
231
+ */
232
+ declare const TEXT_FADE_END_RATIO = 0.8;
233
+ /**
234
+ * Ground label size `textSizeMeters / resolution`, pinned to both edges of
235
+ * the band. The fixed-scale rule behind [[resolveTextAppearance]]'s
236
+ * `pinBelowMinimum` policy; on an interactive map labels hide below the
237
+ * minimum instead.
234
238
  */
235
239
  declare function resolveGroundTextSizePixels(textSizeMeters: number, resolution: number, text?: Pick<TextStyleOptions, "textSizeMinPixels" | "textSizeMaxPixels">): number;
236
240
  /**
237
- * The size properties a Text graphic's feature carries (see `text.ts` /
238
- * `FeaturePartProps`). Mutually exclusive size anchors: `textSizePixels`
239
- * (screen-anchored) or `textSizeMeters` (ground-anchored). `textMaxSizePixels`
240
- * is the ADR-0037 hide threshold; the min/max band fields are the amplifier
241
- * -label clamp bounds, applied only when no max-size threshold is present.
241
+ * The ground-anchored label band a host sets on a layer's text style
242
+ * (ADR-0060): labels pin at the maximum and fade out below the minimum.
243
+ */
244
+ type LabelSizeBand = Pick<TextStyleOptions, "textSizeMinPixels" | "textSizeMaxPixels">;
245
+ /**
246
+ * The size properties a label feature carries (see `FeaturePartProps`).
247
+ * Mutually exclusive size anchors: `textSizePixels` (screen-anchored) or
248
+ * `textSizeMeters` (ground-anchored). `textMaxSizePixels` is the Text
249
+ * graphic's hide threshold (ADR-0037); the min/max band fields are the
250
+ * layer's amplifier-label band, applied only when no threshold is present.
242
251
  */
243
252
  interface TextSizeProps {
244
253
  textSizeMeters?: number;
@@ -247,23 +256,34 @@ interface TextSizeProps {
247
256
  textSizeMinPixels?: number;
248
257
  textSizeMaxPixels?: number;
249
258
  }
259
+ /** How a label renders this frame: its pixel size and its fade opacity. */
260
+ interface TextAppearance {
261
+ sizePixels: number;
262
+ /** `1` except while a ground label fades out below the band minimum. */
263
+ opacity: number;
264
+ }
250
265
  /**
251
- * Resolve a Text graphic's on-screen size in pixels, honoring the
252
- * `textMaxSizePixels` hide threshold (ADR-0037). Returns `null` — the "hidden"
253
- * signal — when the graphic should render no text this frame; adapters emit no
254
- * text style for a `null`. Distinct from [[resolveGroundTextSizePixels]], which
255
- * keeps the 8–24 px clamp band for amplifier labels: this helper is the Text
256
- * graphic's own sizing rule.
266
+ * Resolve how a label renders on an interactive map at `resolution`, or
267
+ * `null` when it should render nothing this frame:
257
268
  *
258
- * - screen-anchored (`textSizePixels`): the fixed pixel size, never scaled or
259
- * hidden by zoom.
260
- * - ground-anchored (`textSizeMeters`) with a `textMaxSizePixels` threshold:
261
- * *unclamped* `meters / resolution` (the 8–24 band does NOT apply), hidden
262
- * (`null`) once that exceeds the threshold — text shrinks freely zooming out
263
- * and vanishes rather than clamps zooming in.
264
- * - ground-anchored without a threshold: falls back to the clamped band.
269
+ * - screen-anchored (`textSizePixels`): the fixed pixel size, never scaled
270
+ * or hidden by zoom.
271
+ * - ground-anchored with a `textMaxSizePixels` threshold (the Text graphic,
272
+ * ADR-0037): unclamped `meters / resolution`, hidden once that exceeds the
273
+ * threshold. No minimum.
274
+ * - ground-anchored without a threshold (amplifier labels, ADR-0060): scales
275
+ * with its graphic, pinned at the band maximum when zoomed in. Below the
276
+ * band minimum it keeps shrinking while its opacity fades to zero at
277
+ * [[TEXT_FADE_END_RATIO]] × the minimum, then hides. A visible label never
278
+ * stops scaling on the zoom-out side, so it cannot outgrow its area.
279
+ * With `pinBelowMinimum` it pins at the minimum instead: the fixed-scale
280
+ * rule of a printed map sheet, where a label must not vanish.
265
281
  * - no usable size or resolution: `null`.
266
282
  */
283
+ declare function resolveTextAppearance(props: TextSizeProps, resolution: number, policy?: {
284
+ pinBelowMinimum?: boolean;
285
+ }): TextAppearance | null;
286
+ /** The pixel size from [[resolveTextAppearance]], or `null` when hidden. */
267
287
  declare function resolveTextSizePixels(props: TextSizeProps, resolution: number): number | null;
268
288
  /** Fallback halo color when a `textHalo` feature carries no `textHaloColor`. */
269
289
  declare const TEXT_HALO_COLOR = "#ffffff";
@@ -274,6 +294,13 @@ declare const TEXT_HALO_COLOR = "#ffffff";
274
294
  * one must double this value to get the same visible depth.
275
295
  */
276
296
  declare function resolveTextHaloWidth(textSizePixels?: number): number;
297
+ /**
298
+ * Text sizes (px) where `resolveTextHaloWidth` switches between its pieces:
299
+ * below the first the halo shrinks with tiny text, between them it holds at
300
+ * its floor, above the second it grows with the text. Engines that ramp the
301
+ * halo natively (MapLibre) put a stop at each so interpolation stays exact.
302
+ */
303
+ declare const TEXT_HALO_BREAKPOINT_PIXELS: readonly [number, number];
277
304
  //#endregion
278
305
  //#region src/gestures/hit-test.d.ts
279
306
  type ToPixel = (lonLat: Position) => PixelCoordinate | null;
@@ -1561,6 +1588,25 @@ interface TacticalDrawOptions {
1561
1588
  graphicsStyle?: ControlMeasureStyle;
1562
1589
  /** Doctrinal defaults; explicit style colors take precedence. */
1563
1590
  symbolColors?: SymbolColors;
1591
+ /**
1592
+ * Pixel band for ground-anchored labels on the graphics and preview layers
1593
+ * (ADR-0060). A label stops growing at `textSizeMaxPixels` (default 24) and,
1594
+ * below `textSizeMinPixels` (default 4), fades out and hides so it never
1595
+ * outgrows the area it names. `textSizeMinPixels: 0` never hides a label.
1596
+ * Label selection boxes follow the same band.
1597
+ */
1598
+ labelSizeBand?: LabelSizeBand;
1599
+ /**
1600
+ * What a screen-anchored area label on the graphics layer does once the
1601
+ * view zooms out far enough that it no longer fits inside its area
1602
+ * (ADR-0061). `"shrink"` shrinks the label with its area, then fades it out
1603
+ * within `labelSizeBand` like a ground-anchored label. `"hide"` leaves out
1604
+ * the rows that don't fit, lowest priority first (W1, W, H, then the name).
1605
+ * `"overflow"` always renders them at their pixel size. The graphic being
1606
+ * edited always shows every row at its pixel size.
1607
+ * @default "shrink"
1608
+ */
1609
+ labelFit?: LabelFit;
1564
1610
  /**
1565
1611
  * Façade-level default interaction-affordance style. Per-slot, per-property
1566
1612
  * merged with `DrawOptions.interactionStyle` / `EditOptions.interactionStyle`
@@ -1736,6 +1782,8 @@ declare class TacticalDraw {
1736
1782
  private readonly ownedLayers;
1737
1783
  private readonly graphicsStyle;
1738
1784
  private readonly symbolColors;
1785
+ private readonly labelSizeBand;
1786
+ private labelFit;
1739
1787
  private readonly defaultInteractionStyle;
1740
1788
  private readonly generateId;
1741
1789
  private offsetDragModifier;
@@ -1854,6 +1902,12 @@ declare class TacticalDraw {
1854
1902
  setPinPresentation(defaults: PinPresentationPatch): void;
1855
1903
  setPinOverride(id: string, patch: PinOverridePatch): void;
1856
1904
  resetPinOverride(id: string): void;
1905
+ /**
1906
+ * Set several pin overrides, and with `null` reset them, in one change and
1907
+ * one re-render. Prefer it over a loop of {@link setPinOverride} calls when
1908
+ * many pins change at once.
1909
+ */
1910
+ setPinOverrides(patches: Readonly<Record<string, PinOverridePatch | null>>): void;
1857
1911
  getPinPresentationCapability(id?: string): PinPresentationCapability;
1858
1912
  onPinPresentationStatusChange(listener: (event: PinPresentationStatusEvent) => void): () => void;
1859
1913
  getPinPresentationState(): PinPresentationState;
@@ -1874,6 +1928,12 @@ declare class TacticalDraw {
1874
1928
  private graphicUsesPinPresentation;
1875
1929
  /** Change the default shortcut for subsequent drags, including in an active edit. */
1876
1930
  setOffsetDragModifier(modifier: OffsetDragModifier | false): void;
1931
+ /**
1932
+ * Change what screen-anchored area labels do once they no longer fit their
1933
+ * area (ADR-0061), re-rendering the graphics layer. See
1934
+ * {@link TacticalDrawOptions.labelFit}.
1935
+ */
1936
+ setLabelFit(labelFit: LabelFit): void;
1877
1937
  /** Replace snapping configuration without recreating the map adapter or façade. */
1878
1938
  setSnappingOptions(options?: SnappingOptions): void;
1879
1939
  /** Clear transient host affordances when snapping or its interaction ends. */
@@ -2373,4 +2433,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
2373
2433
  /** `nearestWorldCopyLng` applied to a lon/lat position. */
2374
2434
  declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
2375
2435
  //#endregion
2376
- export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DeferredSnapProvider, type DrawImageDraft, type DrawMarkerDraft, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, type HandleStyle, type HatchPattern, type IconResource, type ImageCapability, ImageCapabilityRequiredError, type ImageFootprint, type ImageGraphic, type ImageGraphicStyle, type ImageIntrinsicSize, type ImageOverlayResource, type ImageRender, type ImageResource, type ImageSize, type InteractionHit, type InteractionStyle, type LabelExtent, type LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type Marker, type MarkerAnchor, type MarkerCapability, MarkerCapabilityRequiredError, type MarkerFootprint, type MarkerIcon, type MarkerRender, type MarkerSize, type MarkerStyle, type MergedPickFeature, type NativeEventEntry, type OffsetDragModifier, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, PinFootprint, PinOverridePatch, PinPresentation, PinPresentationCapability, PinPresentationPatch, PinPresentationState, PinPresentationStatus, PinPresentationStatusEvent, PinPresentationStore, PinRender, type PinnableGraphic, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolConnector, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolOffset, type PointSymbolOffsetControls, type PointSymbolOffsetLayout, type PointSymbolOffsetStyle, type PointSymbolPlacement, type PointSymbolProjection, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, type Rgba, type RotatedScreenBounds, type ScreenBounds, type SessionChangeSource, type SessionHistory, type SessionHistoryState, type SettleReason, type SizeAnchor, type SnapCandidate, type SnapCandidateProvider, type SnapCandidateRequest, type SnapInteraction, type SnapResult, type SnappingOptions, type StyleOptions, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
2436
+ export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, type DeferredSnapProvider, type DrawImageDraft, type DrawMarkerDraft, type DrawMeasureDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, type HandleStyle, type HatchPattern, type IconResource, type ImageCapability, ImageCapabilityRequiredError, type ImageFootprint, type ImageGraphic, type ImageGraphicStyle, type ImageIntrinsicSize, type ImageOverlayResource, type ImageRender, type ImageResource, type ImageSize, type InteractionHit, type InteractionStyle, type LabelExtent, type LabelSizeBand, type LayerId, MINE_PATTERN_TILE_SIZE, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type Marker, type MarkerAnchor, type MarkerCapability, MarkerCapabilityRequiredError, type MarkerFootprint, type MarkerIcon, type MarkerRender, type MarkerSize, type MarkerStyle, type MergedPickFeature, type NativeEventEntry, type OffsetDragModifier, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickOptions, type PickPointerType, PinFootprint, PinOverridePatch, PinPresentation, PinPresentationCapability, PinPresentationPatch, PinPresentationState, PinPresentationStatus, PinPresentationStatusEvent, PinPresentationStore, PinRender, type PinnableGraphic, type PixelCoordinate, type PointSymbol, type PointSymbolAnchor, type PointSymbolCapability, PointSymbolCapabilityRequiredError, type PointSymbolColors, type PointSymbolConnector, type PointSymbolFootprint, type PointSymbolGraphicModifiers, type PointSymbolOffset, type PointSymbolOffsetControls, type PointSymbolOffsetLayout, type PointSymbolOffsetStyle, type PointSymbolPlacement, type PointSymbolProjection, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedPickPresentation, type Rgba, type RotatedScreenBounds, type ScreenBounds, type SessionChangeSource, type SessionHistory, type SessionHistoryState, type SettleReason, type SizeAnchor, type SnapCandidate, type SnapCandidateProvider, type SnapCandidateRequest, type SnapInteraction, type SnapResult, type SnappingOptions, type StyleOptions, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextAppearance, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransientChangeEvent, type TransientPhase, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
package/dist/index.mjs CHANGED
@@ -646,51 +646,79 @@ function coerceHandleStyle(raw) {
646
646
  if (!raw || typeof raw !== "object") return void 0;
647
647
  return raw;
648
648
  }
649
- /** Default lower edge of the ground-anchored label clamp band (ADR-0028). */
650
- const DEFAULT_TEXT_SIZE_MIN_PIXELS = 8;
651
- /** Default upper edge of the ground-anchored label clamp band (ADR-0028). */
649
+ /**
650
+ * Default lower edge of the ground-anchored label band (ADR-0060): below it a
651
+ * label fades out and hides on the map, rather than pinning.
652
+ */
653
+ const DEFAULT_TEXT_SIZE_MIN_PIXELS = 4;
654
+ /** Default upper edge of the ground-anchored label band (ADR-0028): labels pin here. */
652
655
  const DEFAULT_TEXT_SIZE_MAX_PIXELS = 24;
653
656
  /**
654
- * Rendered pixel size of a ground-anchored label (ADR-0028):
655
- * `textSizeMeters / resolution`, clamped to the layer's text-style band.
656
- * Within the band the text scales with its graphic; past either edge it pins
657
- * to the bound, so zooming out never yields unreadable smudges and zooming in
658
- * never yields screen-covering text. Shared by the adapters that resolve text
659
- * size in code (OpenLayers, Leaflet); the MapLibre adapter reproduces the same
660
- * clamp as a native camera expression whose stops are the two clamp
661
- * boundaries, so it stays exact at fractional zooms.
657
+ * Share of the band minimum at which a fading ground label reaches zero
658
+ * opacity and hides (ADR-0060): 4 px fades out to nothing at 3.2 px.
659
+ */
660
+ const TEXT_FADE_END_RATIO = .8;
661
+ /**
662
+ * Ground label size `textSizeMeters / resolution`, pinned to both edges of
663
+ * the band. The fixed-scale rule behind [[resolveTextAppearance]]'s
664
+ * `pinBelowMinimum` policy; on an interactive map labels hide below the
665
+ * minimum instead.
662
666
  */
663
667
  function resolveGroundTextSizePixels(textSizeMeters, resolution, text) {
664
- const min = text?.textSizeMinPixels ?? 8;
668
+ const min = text?.textSizeMinPixels ?? 4;
665
669
  const max = text?.textSizeMaxPixels ?? 24;
666
670
  return Math.min(max, Math.max(min, textSizeMeters / resolution));
667
671
  }
668
672
  /**
669
- * Resolve a Text graphic's on-screen size in pixels, honoring the
670
- * `textMaxSizePixels` hide threshold (ADR-0037). Returns `null` — the "hidden"
671
- * signal — when the graphic should render no text this frame; adapters emit no
672
- * text style for a `null`. Distinct from [[resolveGroundTextSizePixels]], which
673
- * keeps the 8–24 px clamp band for amplifier labels: this helper is the Text
674
- * graphic's own sizing rule.
673
+ * Resolve how a label renders on an interactive map at `resolution`, or
674
+ * `null` when it should render nothing this frame:
675
675
  *
676
- * - screen-anchored (`textSizePixels`): the fixed pixel size, never scaled or
677
- * hidden by zoom.
678
- * - ground-anchored (`textSizeMeters`) with a `textMaxSizePixels` threshold:
679
- * *unclamped* `meters / resolution` (the 8–24 band does NOT apply), hidden
680
- * (`null`) once that exceeds the threshold — text shrinks freely zooming out
681
- * and vanishes rather than clamps zooming in.
682
- * - ground-anchored without a threshold: falls back to the clamped band.
676
+ * - screen-anchored (`textSizePixels`): the fixed pixel size, never scaled
677
+ * or hidden by zoom.
678
+ * - ground-anchored with a `textMaxSizePixels` threshold (the Text graphic,
679
+ * ADR-0037): unclamped `meters / resolution`, hidden once that exceeds the
680
+ * threshold. No minimum.
681
+ * - ground-anchored without a threshold (amplifier labels, ADR-0060): scales
682
+ * with its graphic, pinned at the band maximum when zoomed in. Below the
683
+ * band minimum it keeps shrinking while its opacity fades to zero at
684
+ * [[TEXT_FADE_END_RATIO]] × the minimum, then hides. A visible label never
685
+ * stops scaling on the zoom-out side, so it cannot outgrow its area.
686
+ * With `pinBelowMinimum` it pins at the minimum instead: the fixed-scale
687
+ * rule of a printed map sheet, where a label must not vanish.
683
688
  * - no usable size or resolution: `null`.
684
689
  */
685
- function resolveTextSizePixels(props, resolution) {
686
- if (typeof props.textSizePixels === "number") return props.textSizePixels;
690
+ function resolveTextAppearance(props, resolution, policy) {
691
+ if (typeof props.textSizePixels === "number") return {
692
+ sizePixels: props.textSizePixels,
693
+ opacity: 1
694
+ };
687
695
  const meters = props.textSizeMeters;
688
696
  if (typeof meters !== "number" || !(resolution > 0)) return null;
689
- if (typeof props.textMaxSizePixels === "number") {
690
- const px = meters / resolution;
691
- return px > props.textMaxSizePixels ? null : px;
692
- }
693
- return resolveGroundTextSizePixels(meters, resolution, props);
697
+ const px = meters / resolution;
698
+ if (typeof props.textMaxSizePixels === "number") return px > props.textMaxSizePixels ? null : {
699
+ sizePixels: px,
700
+ opacity: 1
701
+ };
702
+ if (policy?.pinBelowMinimum) return {
703
+ sizePixels: resolveGroundTextSizePixels(meters, resolution, props),
704
+ opacity: 1
705
+ };
706
+ const min = props.textSizeMinPixels ?? 4;
707
+ const max = props.textSizeMaxPixels ?? 24;
708
+ if (px >= min) return {
709
+ sizePixels: Math.min(max, px),
710
+ opacity: 1
711
+ };
712
+ const fadeEnd = min * TEXT_FADE_END_RATIO;
713
+ if (px <= fadeEnd) return null;
714
+ return {
715
+ sizePixels: px,
716
+ opacity: (px - fadeEnd) / (min - fadeEnd)
717
+ };
718
+ }
719
+ /** The pixel size from [[resolveTextAppearance]], or `null` when hidden. */
720
+ function resolveTextSizePixels(props, resolution) {
721
+ return resolveTextAppearance(props, resolution)?.sizePixels ?? null;
694
722
  }
695
723
  /** Fallback halo color when a `textHalo` feature carries no `textHaloColor`. */
696
724
  const TEXT_HALO_COLOR = "#ffffff";
@@ -701,8 +729,19 @@ const TEXT_HALO_COLOR = "#ffffff";
701
729
  * one must double this value to get the same visible depth.
702
730
  */
703
731
  function resolveTextHaloWidth(textSizePixels) {
704
- return Math.max(1.5, (textSizePixels ?? 24) / 8);
732
+ const size = textSizePixels ?? 24;
733
+ return Math.max(size / HALO_SIZE_RATIO, Math.min(HALO_FLOOR, size / TINY_HALO_SIZE_RATIO));
705
734
  }
735
+ const HALO_SIZE_RATIO = 8;
736
+ const TINY_HALO_SIZE_RATIO = 5;
737
+ const HALO_FLOOR = 1.5;
738
+ /**
739
+ * Text sizes (px) where `resolveTextHaloWidth` switches between its pieces:
740
+ * below the first the halo shrinks with tiny text, between them it holds at
741
+ * its floor, above the second it grows with the text. Engines that ramp the
742
+ * halo natively (MapLibre) put a stop at each so interpolation stays exact.
743
+ */
744
+ const TEXT_HALO_BREAKPOINT_PIXELS = [HALO_FLOOR * TINY_HALO_SIZE_RATIO, HALO_FLOOR * HALO_SIZE_RATIO];
706
745
  //#endregion
707
746
  //#region src/gestures/hit-test.ts
708
747
  /** Clamped parameter t ∈ [0, 1] of `pixel` projected onto the segment a→b in pixel space, or null for a zero-length segment. */
@@ -1274,6 +1313,10 @@ var PinPresentationStore = class {
1274
1313
  defaults: {},
1275
1314
  overrides: {}
1276
1315
  };
1316
+ /** Monotonic stamp source for {@link revision}. */
1317
+ revisions = 0;
1318
+ defaultsRevision = 0;
1319
+ overrideRevisions = /* @__PURE__ */ new Map();
1277
1320
  emitter = createCommitEmitter("PinPresentationStore.onChange listener errors");
1278
1321
  getState() {
1279
1322
  return structuredClone(this.state);
@@ -1281,18 +1324,34 @@ var PinPresentationStore = class {
1281
1324
  resolve(id) {
1282
1325
  return resolvePinPresentation(this.state.defaults, Object.hasOwn(this.state.overrides, id) ? this.state.overrides[id] : {});
1283
1326
  }
1327
+ /**
1328
+ * @internal A stamp that changes whenever {@link resolve} may return a
1329
+ * different presentation for `id`, so a renderer can keep reusing the pins
1330
+ * whose presentation a change left alone.
1331
+ */
1332
+ revision(id) {
1333
+ return Math.max(this.defaultsRevision, this.overrideRevisions.get(id) ?? 0);
1334
+ }
1284
1335
  replace(state) {
1285
1336
  if (!state || !state.overrides || typeof state.overrides !== "object" || Array.isArray(state.overrides)) throw new TypeError("Invalid pin state");
1286
- if (!Object.is(state.defaults, this.state.defaults)) {
1337
+ const defaultsChanged = !Object.is(state.defaults, this.state.defaults);
1338
+ const changed = [];
1339
+ if (defaultsChanged) {
1287
1340
  resolvePinPresentation(state.defaults);
1288
1341
  for (const patch of Object.values(state.overrides)) {
1289
1342
  validateOverride(patch);
1290
1343
  resolvePinPresentation(state.defaults, patch);
1291
1344
  }
1292
- } else for (const [id, patch] of Object.entries(state.overrides)) if (!Object.is(patch, this.state.overrides[id])) {
1293
- validateOverride(patch);
1294
- resolvePinPresentation(state.defaults, patch);
1345
+ } else {
1346
+ for (const [id, patch] of Object.entries(state.overrides)) if (!Object.is(patch, this.state.overrides[id])) {
1347
+ validateOverride(patch);
1348
+ resolvePinPresentation(state.defaults, patch);
1349
+ changed.push(id);
1350
+ }
1351
+ for (const id of Object.keys(this.state.overrides)) if (!Object.hasOwn(state.overrides, id)) changed.push(id);
1295
1352
  }
1353
+ if (defaultsChanged) this.defaultsRevision = ++this.revisions;
1354
+ for (const id of changed) this.overrideRevisions.set(id, ++this.revisions);
1296
1355
  this.state = structuredClone(state);
1297
1356
  this.emitter.emit(this.getState());
1298
1357
  }
@@ -1303,20 +1362,27 @@ var PinPresentationStore = class {
1303
1362
  });
1304
1363
  }
1305
1364
  setOverride(id, patch) {
1306
- this.replace({
1307
- ...this.state,
1308
- overrides: {
1309
- ...this.state.overrides,
1310
- [id]: patch
1311
- }
1312
- });
1365
+ this.setOverrides({ [id]: patch });
1313
1366
  }
1314
1367
  resetOverride(id) {
1315
- const overrides = { ...this.state.overrides };
1316
- delete overrides[id];
1368
+ this.setOverrides({ [id]: null });
1369
+ }
1370
+ /**
1371
+ * Set several overrides, and with `null` reset them, as one validated change
1372
+ * and one `onChange` emit. Each patch replaces that id's previous patch, as
1373
+ * {@link setOverride} does; ids not named keep theirs. An invalid patch
1374
+ * throws and leaves every override unchanged.
1375
+ */
1376
+ setOverrides(patches) {
1377
+ if (!patches || typeof patches !== "object" || Array.isArray(patches)) throw new TypeError("Invalid pin overrides");
1378
+ const entries = Object.entries(patches);
1379
+ if (entries.length === 0) return;
1380
+ const overrides = new Map(Object.entries(this.state.overrides));
1381
+ for (const [id, patch] of entries) if (patch === null) overrides.delete(id);
1382
+ else overrides.set(id, patch);
1317
1383
  this.replace({
1318
1384
  ...this.state,
1319
- overrides
1385
+ overrides: Object.fromEntries(overrides)
1320
1386
  });
1321
1387
  }
1322
1388
  onChange(listener) {
@@ -4085,31 +4151,37 @@ function normalizeAngle(angle) {
4085
4151
  * times `CHAR_WIDTH_FACTOR × h` gives the width, the line count times
4086
4152
  * `LINE_HEIGHT_FACTOR × h` gives the height, where `h` is the resolved
4087
4153
  * text-height-in-pixels, mirroring how the adapters render each anchor
4088
- * kind (ADR-0028): screen-anchored `textSizePixels` is used as-is,
4089
- * unclamped (only a `1px` sanity floor to keep the box non-degenerate);
4090
- * ground-anchored `textSizeMeters / resolution` is clamped to the default
4091
- * `[DEFAULT_TEXT_SIZE_MIN_PIXELS, DEFAULT_TEXT_SIZE_MAX_PIXELS]` band via
4092
- * `resolveGroundTextSizePixels` (`feature-style.ts`); absent both,
4093
- * `DEFAULT_LABEL_TEXT_SIZE_PX`. `LABEL_BOX_PADDING_PX` is added on every
4094
- * side. Hosts can override the clamp band per layer style
4095
- * (`TextStyleOptions.textSizeMinPixels`/`textSizeMaxPixels`), which this
4096
- * estimate can't see — the default band keeps the box honest at extreme
4097
- * zooms even when a host has customized it.
4154
+ * kind through `resolveTextAppearance` (`feature-style.ts`, ADR-0028,
4155
+ * ADR-0060), with only a `1px` sanity floor to keep the box
4156
+ * non-degenerate: screen-anchored `textSizePixels` as-is; ground-anchored
4157
+ * `textSizeMeters / resolution` within the host's `labelSizeBand`;
4158
+ * absent both, `DEFAULT_LABEL_TEXT_SIZE_PX`. `LABEL_BOX_PADDING_PX` is
4159
+ * added on every side.
4098
4160
  * - **Center**: `anchor` for centered text (`textAnchor` absent); offset by
4099
4161
  * half the fitted width along the label's local +x for `"start"` (text
4100
4162
  * grows away from the anchor) or local −x for `"end"` (text grows back
4101
4163
  * toward the anchor) — `rotate()` (`transform-box.ts`) already uses the
4102
4164
  * screen (y-down) convention this offset needs.
4103
- * - **Hidden**: a ground-anchored size past `textMaxSizePixels` (ADR-0037)
4104
- * returns `null` — the box tracks `resolveTextSizePixels`'s hide rule
4105
- * rather than keep boxing text that no adapter is drawing.
4165
+ * - **Hidden**: a ground-anchored size past `textMaxSizePixels` (ADR-0037),
4166
+ * or faded out below the band minimum (ADR-0060), returns `null` — the box
4167
+ * tracks `resolveTextAppearance`'s hide rule rather than keep boxing text
4168
+ * that no adapter is drawing.
4106
4169
  */
4107
4170
  function fitLabelTransformBox(input) {
4108
- const { text, rotation, textAnchor, textSizePixels, textSizeMeters, anchor, resolution, bearing, unclamped, textMaxSizePixels } = input;
4171
+ const { text, rotation, textAnchor, textSizePixels, textSizeMeters, anchor, resolution, bearing, unclamped, textMaxSizePixels, labelSizeBand } = input;
4109
4172
  if (!text) return null;
4110
- if (typeof textMaxSizePixels === "number" && textSizePixels === void 0 && typeof textSizeMeters === "number" && typeof resolution === "number" && resolution > 0 && textSizeMeters / resolution > textMaxSizePixels) return null;
4111
4173
  const angle = normalizeAngle(Math.PI - (rotation ?? 0) - (bearing ?? 0));
4112
- const h = textSizePixels !== void 0 ? Math.max(1, textSizePixels) : textSizeMeters !== void 0 && resolution !== void 0 && resolution > 0 ? unclamped ? Math.max(1, textSizeMeters / resolution) : resolveGroundTextSizePixels(textSizeMeters, resolution) : 16;
4174
+ let h = 16;
4175
+ if (textSizePixels !== void 0 || textSizeMeters !== void 0 && resolution !== void 0 && resolution > 0) {
4176
+ const appearance = resolveTextAppearance({
4177
+ textSizePixels,
4178
+ textSizeMeters,
4179
+ textMaxSizePixels: unclamped ? textMaxSizePixels ?? Infinity : textMaxSizePixels,
4180
+ ...labelSizeBand
4181
+ }, resolution ?? 0);
4182
+ if (!appearance) return null;
4183
+ h = Math.max(1, appearance.sizePixels);
4184
+ }
4113
4185
  const lines = text.split("\n");
4114
4186
  const width = lines.reduce((max, line) => Math.max(max, line.length), 0) * CHAR_WIDTH_FACTOR * h;
4115
4187
  const height = lines.length * LINE_HEIGHT_FACTOR * h;
@@ -4148,7 +4220,8 @@ function fitLabelBoxFromFeature(feature, anchorPixel, view) {
4148
4220
  anchor: anchorPixel,
4149
4221
  resolution: view.resolution,
4150
4222
  bearing: view.bearing,
4151
- unclamped: view.unclamped
4223
+ unclamped: view.unclamped,
4224
+ labelSizeBand: view.labelSizeBand
4152
4225
  });
4153
4226
  }
4154
4227
  /**
@@ -4249,7 +4322,12 @@ function mergeAmplifierPlacementField(existing, incoming) {
4249
4322
  * its session-owned `workingAmplifierPlacements`.
4250
4323
  */
4251
4324
  function createLabelPlacement(deps) {
4252
- const { projection, view, features, snapshotAmplifierPlacements, handleIdPrefix, interactionStyle } = deps;
4325
+ const { projection, features, snapshotAmplifierPlacements, handleIdPrefix, interactionStyle, labelSizeBand } = deps;
4326
+ /** The live view plus the fixed band: everything a label box fit needs. */
4327
+ const view = () => ({
4328
+ ...deps.view(),
4329
+ labelSizeBand
4330
+ });
4253
4331
  /**
4254
4332
  * The currently selected label's `labelPlacementKey`, or `null` when no label
4255
4333
  * is selected. A click on a label toggles this (select / deselect / switch —
@@ -4431,7 +4509,7 @@ function createLabelPlacement(deps) {
4431
4509
  const drag = activeLabelRotateDrag;
4432
4510
  const delta = pointerAngleAround(pixel, drag.anchorPixel) - drag.startPointerAngle;
4433
4511
  const rotation = drag.startRotation - delta;
4434
- const { resolution, bearing } = view();
4512
+ const { resolution, bearing } = deps.view();
4435
4513
  const liveBox = fitLabelTransformBox({
4436
4514
  text: drag.text,
4437
4515
  rotation,
@@ -4440,7 +4518,8 @@ function createLabelPlacement(deps) {
4440
4518
  textSizeMeters: drag.textSizeMeters,
4441
4519
  anchor: drag.anchorPixel,
4442
4520
  resolution,
4443
- bearing
4521
+ bearing,
4522
+ labelSizeBand
4444
4523
  });
4445
4524
  if (liveBox) drag.lastBox = liveBox;
4446
4525
  return {
@@ -4660,6 +4739,7 @@ function runEdit(opts) {
4660
4739
  resolution: adapter.getResolution(),
4661
4740
  bearing: adapter.getBearing()
4662
4741
  }),
4742
+ labelSizeBand: opts.labelSizeBand,
4663
4743
  features: () => lastWorkingFeatures,
4664
4744
  snapshotAmplifierPlacements,
4665
4745
  handleIdPrefix,
@@ -8537,6 +8617,8 @@ var TacticalDraw = class {
8537
8617
  ownedLayers;
8538
8618
  graphicsStyle;
8539
8619
  symbolColors;
8620
+ labelSizeBand;
8621
+ labelFit;
8540
8622
  defaultInteractionStyle;
8541
8623
  generateId;
8542
8624
  offsetDragModifier;
@@ -8655,6 +8737,8 @@ var TacticalDraw = class {
8655
8737
  this.adapter = adapter;
8656
8738
  this.offsetDragModifier = options?.offsetDragModifier ?? false;
8657
8739
  this.symbolColors = options?.symbolColors ? { ...options.symbolColors } : void 0;
8740
+ this.labelSizeBand = options?.labelSizeBand ? { ...options.labelSizeBand } : void 0;
8741
+ this.labelFit = options?.labelFit ?? "shrink";
8658
8742
  this.lastViewResolution = adapter.getResolution();
8659
8743
  this.graphicsStyle = resolveStyleHints(BUILT_IN_GRAPHICS_STYLE, options?.graphicsStyle, void 0);
8660
8744
  this.defaultInteractionStyle = options?.interactionStyle;
@@ -8676,14 +8760,13 @@ var TacticalDraw = class {
8676
8760
  this.guideLayer = resolveSlot(adapter, provided.guide, owned);
8677
8761
  this.handlesLayer = resolveSlot(adapter, provided.handles, owned);
8678
8762
  this.ownedLayers = owned;
8679
- const graphicsLayerStyle = styleToStyleOptions(this.graphicsStyle);
8763
+ const graphicsLayerStyle = styleToStyleOptions(this.graphicsStyle, this.labelSizeBand);
8680
8764
  this.adapter.setLayerStyle(this.graphicsLayer, graphicsLayerStyle);
8681
8765
  this.adapter.setLayerStyle(this.previewLayer, graphicsLayerStyle);
8682
8766
  this.adapter.setLayerStyle(this.guideLayer, guideToStyleOptions(this.baseGuideStyle()));
8683
8767
  this.adapter.setLayerStyle(this.highlightLayer, guideToStyleOptions(this.baseHighlightStyle()));
8684
8768
  this.adapter.onViewChange(this.handleViewChange);
8685
8769
  this.unsubscribePins = this.pins.onChange(() => {
8686
- this.invalidateGraphicGroupCache(false);
8687
8770
  this.refreshActiveEditPresentation();
8688
8771
  this.reconcileGraphicsStack();
8689
8772
  this.flushHighlights();
@@ -8701,6 +8784,15 @@ var TacticalDraw = class {
8701
8784
  this.assertAlive();
8702
8785
  this.pins.resetOverride(id);
8703
8786
  }
8787
+ /**
8788
+ * Set several pin overrides, and with `null` reset them, in one change and
8789
+ * one re-render. Prefer it over a loop of {@link setPinOverride} calls when
8790
+ * many pins change at once.
8791
+ */
8792
+ setPinOverrides(patches) {
8793
+ this.assertAlive();
8794
+ this.pins.setOverrides(patches);
8795
+ }
8704
8796
  getPinPresentationCapability(id) {
8705
8797
  return this.adapter.getPinPresentationCapability?.(id) ?? {
8706
8798
  status: "unsupported",
@@ -8745,6 +8837,18 @@ var TacticalDraw = class {
8745
8837
  this.assertAlive();
8746
8838
  this.offsetDragModifier = modifier;
8747
8839
  }
8840
+ /**
8841
+ * Change what screen-anchored area labels do once they no longer fit their
8842
+ * area (ADR-0061), re-rendering the graphics layer. See
8843
+ * {@link TacticalDrawOptions.labelFit}.
8844
+ */
8845
+ setLabelFit(labelFit) {
8846
+ this.assertAlive();
8847
+ if (labelFit === this.labelFit) return;
8848
+ this.labelFit = labelFit;
8849
+ this.invalidateGraphicGroupCache(false);
8850
+ if (this.hasRendered) this.reconcileGraphicsStack();
8851
+ }
8748
8852
  /** Replace snapping configuration without recreating the map adapter or façade. */
8749
8853
  setSnappingOptions(options) {
8750
8854
  this.assertAlive();
@@ -8773,19 +8877,22 @@ var TacticalDraw = class {
8773
8877
  * per-frame reconcile cost becomes O(selection) rather than O(document).
8774
8878
  */
8775
8879
  renderGraphicGroup(graphic) {
8880
+ const pinnable = isPinnableGraphic(graphic);
8881
+ const pinRevision = pinnable ? this.pins.revision(graphic.id) : void 0;
8776
8882
  const cached = this.graphicGroupCache.get(graphic);
8777
- if (cached) {
8883
+ if (cached && cached.pinRevision === pinRevision) {
8778
8884
  if (cached.dependence === "none") return cached.group;
8779
8885
  if (cached.dependence === "resolution" && Object.is(cached.resolution, this.adapter.getResolution())) return cached.group;
8780
8886
  }
8781
- const presentation = isPinnableGraphic(graphic) ? this.pins.resolve(graphic.id) : void 0;
8887
+ const presentation = pinnable ? this.pins.resolve(graphic.id) : void 0;
8782
8888
  const dependence = presentation && this.graphicUsesPinPresentation(graphic, presentation) ? "none" : graphicViewDependence(graphic, this.adapter.scalesGroundPointSymbolsNatively === true);
8783
8889
  const resolution = dependence === "none" ? void 0 : this.adapter.getResolution();
8784
8890
  const group = this.buildGraphicGroup(graphic, presentation);
8785
8891
  this.graphicGroupCache.set(graphic, {
8786
8892
  group,
8787
8893
  dependence,
8788
- resolution
8894
+ resolution,
8895
+ pinRevision
8789
8896
  });
8790
8897
  return group;
8791
8898
  }
@@ -8854,7 +8961,8 @@ var TacticalDraw = class {
8854
8961
  }
8855
8962
  const render = renderMeasureForAdapter(this.adapter, graphic, {
8856
8963
  graphicsStyle: this.graphicsStyle,
8857
- symbolColors: this.symbolColors
8964
+ symbolColors: this.symbolColors,
8965
+ context: { labelFit: this.labelFit }
8858
8966
  });
8859
8967
  return {
8860
8968
  id: graphic.id,
@@ -9509,6 +9617,7 @@ var TacticalDraw = class {
9509
9617
  handlesLayer: this.handlesLayer,
9510
9618
  graphicsStyle: this.graphicsStyle,
9511
9619
  symbolColors: this.symbolColors,
9620
+ labelSizeBand: this.labelSizeBand,
9512
9621
  signal: options?.signal,
9513
9622
  closeOnClickAway: options?.closeOnClickAway,
9514
9623
  modes: options?.modes,
@@ -9773,7 +9882,8 @@ var TacticalDraw = class {
9773
9882
  if (!anchorPixel) continue;
9774
9883
  const box = fitLabelBoxFromFeature(feature, anchorPixel, {
9775
9884
  resolution: this.adapter.getResolution(),
9776
- bearing: this.adapter.getBearing()
9885
+ bearing: this.adapter.getBearing(),
9886
+ labelSizeBand: this.labelSizeBand
9777
9887
  });
9778
9888
  if (box) labelCandidates.push({
9779
9889
  feature,
@@ -10091,14 +10201,17 @@ function mergeSlot(base, override) {
10091
10201
  else out[k] = v;
10092
10202
  return out;
10093
10203
  }
10094
- function styleToStyleOptions(style) {
10204
+ function styleToStyleOptions(style, labelSizeBand) {
10095
10205
  const out = {};
10096
10206
  const strokeColor = style.strokeColor ?? style.color ?? DEFAULT_SYMBOL_COLOR;
10097
10207
  if (strokeColor !== void 0) out.strokeColor = strokeColor;
10098
10208
  if (style.strokeWidth !== void 0) out.strokeWidth = style.strokeWidth;
10099
10209
  if (style.strokeDash !== void 0) out.strokeDash = [...style.strokeDash];
10100
10210
  if (style.fillColor !== void 0) out.fillColor = style.fillColor;
10101
- out.text = { labelProperty: "text" };
10211
+ out.text = {
10212
+ labelProperty: "text",
10213
+ ...labelSizeBand
10214
+ };
10102
10215
  return out;
10103
10216
  }
10104
10217
  function guideToStyleOptions(style) {
@@ -10372,4 +10485,4 @@ function nearestWorldCopyPosition(position, refLng) {
10372
10485
  return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
10373
10486
  }
10374
10487
  //#endregion
10375
- export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, MarkerCapabilityRequiredError, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
10488
+ export { BaseMapAdapter, DEFAULT_LABEL_SIZE_PIXELS, DEFAULT_MARKER_SIZE, DEFAULT_PIN_PRESENTATION, DEFAULT_TEXT_SIZE_MAX_PIXELS, DEFAULT_TEXT_SIZE_MIN_PIXELS, HATCH_PATTERNS, ImageCapabilityRequiredError, MINE_PATTERN_TILE_SIZE, MarkerCapabilityRequiredError, PinPresentationStore, PointSymbolCapabilityRequiredError, PointerCallbackHub, TEXT_FADE_END_RATIO, TEXT_HALO_BREAKPOINT_PIXELS, TEXT_HALO_COLOR, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, alignPointSymbolIndicator, bindAbortable, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderOrderToVisualOrder, resizePointSymbolSize, resolveGroundTextSizePixels, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
@@ -139,13 +139,30 @@ declare function resolvePinPresentation(...patches: readonly PinPresentationPatc
139
139
  /** Replacing patches makes omitted override properties inherit again. */
140
140
  declare class PinPresentationStore {
141
141
  private state;
142
+ /** Monotonic stamp source for {@link revision}. */
143
+ private revisions;
144
+ private defaultsRevision;
145
+ private readonly overrideRevisions;
142
146
  private readonly emitter;
143
147
  getState(): PinPresentationState;
144
148
  resolve(id: string): PinPresentation;
149
+ /**
150
+ * @internal A stamp that changes whenever {@link resolve} may return a
151
+ * different presentation for `id`, so a renderer can keep reusing the pins
152
+ * whose presentation a change left alone.
153
+ */
154
+ revision(id: string): number;
145
155
  replace(state: PinPresentationState): void;
146
156
  setDefaults(patch: PinPresentationPatch): void;
147
157
  setOverride(id: string, patch: PinOverridePatch): void;
148
158
  resetOverride(id: string): void;
159
+ /**
160
+ * Set several overrides, and with `null` reset them, as one validated change
161
+ * and one `onChange` emit. Each patch replaces that id's previous patch, as
162
+ * {@link setOverride} does; ids not named keep theirs. An invalid patch
163
+ * throws and leaves every override unchanged.
164
+ */
165
+ setOverrides(patches: Readonly<Record<string, PinOverridePatch | null>>): void;
149
166
  onChange(listener: (state: PinPresentationState) => void): () => void;
150
167
  }
151
168
  //#endregion
@@ -283,9 +300,10 @@ interface StyleOptions {
283
300
  * `π − rotation`), the size anchor's `textSizeMeters` (ground) or
284
301
  * `textSizePixels` (screen) (ADR-0028), and `textAnchor` (`"start"` = text
285
302
  * begins at the label point, `"end"` = text ends there; absent = centered).
286
- * A ground-anchored label renders at
287
- * `clamp(textSizeMeters / resolution, textSizeMinPixels, textSizeMaxPixels)`;
288
- * a screen-anchored one at a constant `textSizePixels`, unclamped.
303
+ * A ground-anchored label renders at `textSizeMeters / resolution`, pinned at
304
+ * `textSizeMaxPixels` and faded out then hidden below `textSizeMinPixels`
305
+ * (`resolveTextAppearance`, ADR-0060); a screen-anchored one at a constant
306
+ * `textSizePixels`, unclamped.
289
307
  */
290
308
  interface TextStyleOptions {
291
309
  text?: string;
@@ -296,13 +314,14 @@ interface TextStyleOptions {
296
314
  strokeWidth?: number;
297
315
  rotation?: number;
298
316
  /**
299
- * Lower edge of the ground-anchored label clamp band (ADR-0028): text never
300
- * renders below this pixel size, however far the view zooms out.
301
- * @default 8
317
+ * Lower edge of the ground-anchored label band (ADR-0060): zoomed out past
318
+ * it, a label keeps shrinking with its graphic while it fades out, then
319
+ * hides, so it never outgrows the area it names.
320
+ * @default 4
302
321
  */
303
322
  textSizeMinPixels?: number;
304
323
  /**
305
- * Upper edge of the ground-anchored label clamp band (ADR-0028): text never
324
+ * Upper edge of the ground-anchored label band (ADR-0028): text never
306
325
  * renders above this pixel size, however far the view zooms in.
307
326
  * @default 24
308
327
  */
@@ -1,4 +1,4 @@
1
- import { a as LayerId, o as MapAdapter, p as PixelCoordinate } from "./map-adapter-B8zVKzWH.mjs";
1
+ import { a as LayerId, o as MapAdapter, p as PixelCoordinate } from "./map-adapter-DFqXaRgp.mjs";
2
2
  import { Feature } from "geojson";
3
3
 
4
4
  //#region src/testing/feature-group-conformance.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "Engine-agnostic draw/edit core for tactical control measures (MIL-STD-2525 / APP-6). The MapAdapter ABI and bring-your-own-engine entry point for the tactical-draw package family.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@orbat-mapper/control-measures": "^0.34.0"
42
+ "@orbat-mapper/control-measures": "^0.36.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vitest": ">=4.0.0"