@orbat-mapper/tactical-draw 0.29.0 → 0.31.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 +247 -12
- package/dist/index.mjs +947 -50
- package/dist/{map-adapter-DDQarsRQ.d.mts → map-adapter-g2v5Ok3Y.d.mts} +15 -3
- package/dist/testing.d.mts +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-
|
|
1
|
+
import { $ as PinPresentationCapability, A as PointSymbolConnector, B as isPointSymbol, C as makeFillPatternImage, D as PointSymbolAnchor, E as PointSymbol, F as PointSymbolRect, G as ResolvedEditModifiers, H as DEFAULT_EDIT_MODIFIERS, I as PointSymbolRender, J as PointerEventInfo, K as EditPointerDriver, L as PointSymbolSize, M as PointSymbolOffset, N as PointSymbolOffsetStyle, O as PointSymbolCapability, P as PointSymbolPlacement, Q as PinPresentation, R as PointSymbolStyle, S as isMinePattern, T as OffsetDragModifier, U as EditModifiers, V as resizePointSymbolSize, W as ModifierKey, X as PinFootprint, Y as DEFAULT_PIN_PRESENTATION, Z as PinOverridePatch, _ as HatchPattern, a as LayerId, at as PinRender, b as fillPatternImageDimension, c as MapEvent, ct as pinDistanceScale, d as PickHandler, et as PinPresentationPatch, f as PickOptions, g as HATCH_PATTERNS, h as TextStyleOptions, i as ImageOverlayResource, it as PinPresentationStore, j as PointSymbolGraphicModifiers, k as PointSymbolColors, l as MapEventHandler, lt as pinZoomScale, m as StyleOptions, n as HandleStyle, nt as PinPresentationStatus, o as MapAdapter, ot as combinePinScale, p as PixelCoordinate, q as PointerCallback, r as IconResource, rt as PinPresentationStatusEvent, s as MapCursor, st as isValidPinNumber, t as FeatureGroup, tt as PinPresentationState, u as PickEvent, ut as resolvePinPresentation, v as MINE_PATTERN_TILE_SIZE, w as parseColor, x as fillPatternImageId, y as Rgba, z as clonePointSymbol } from "./map-adapter-g2v5Ok3Y.mjs";
|
|
2
2
|
import { AmplifierPlacement, AmplifierPlacements, ControlMeasure, ControlMeasureKind, ControlMeasureRender, ControlMeasureStyle, HighlightAppearance, LabelFit, SymbolColors, TextAmplifiers } from "@orbat-mapper/control-measures";
|
|
3
3
|
import { Feature, Position } from "geojson";
|
|
4
4
|
|
|
@@ -470,6 +470,13 @@ interface ImageResource {
|
|
|
470
470
|
overlayUrl: string;
|
|
471
471
|
width: number;
|
|
472
472
|
height: number;
|
|
473
|
+
/**
|
|
474
|
+
* Optional sanitised SVG source of the same image (ADR-0070). Sanitising is
|
|
475
|
+
* the host's job. A Note's images prefer it over `overlayUrl` so they stay
|
|
476
|
+
* sharp at every density; the `image` kind ignores it. An SVG drawn through
|
|
477
|
+
* `<img>` can't use page web fonts, so embed them or convert text to paths.
|
|
478
|
+
*/
|
|
479
|
+
svg?: string;
|
|
473
480
|
}
|
|
474
481
|
interface ImageCapability {
|
|
475
482
|
resolve(resourceId: string): ImageResource | undefined;
|
|
@@ -545,24 +552,183 @@ interface MarkerCapability {
|
|
|
545
552
|
/** Monotonic host-owned revision; bump it when icon resolution changes. */
|
|
546
553
|
readonly generation?: number;
|
|
547
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* One `MarkerCapability` from several, such as a badge catalog and the host's
|
|
557
|
+
* own icons: each marker gets the icon of the first capability that recognises
|
|
558
|
+
* its symbol id. `generation` is the sum of the parts' generations, so it still
|
|
559
|
+
* increases when any part bumps its own.
|
|
560
|
+
*/
|
|
561
|
+
declare function composeMarkerCapabilities(...capabilities: readonly MarkerCapability[]): MarkerCapability;
|
|
548
562
|
declare function isMarker(graphic: unknown): graphic is Marker;
|
|
549
563
|
declare function cloneMarker(marker: Marker): Marker;
|
|
550
564
|
declare function markerOpacity(marker: Marker): number;
|
|
551
565
|
declare function validateMarker(marker: Marker): void;
|
|
552
566
|
declare function normalizeMarker(marker: Marker): Marker;
|
|
553
567
|
//#endregion
|
|
568
|
+
//#region src/note-graphic.d.ts
|
|
569
|
+
/**
|
|
570
|
+
* The Note graphic kind (ADR-0066): a framed box of Markdown content pinned to
|
|
571
|
+
* the ground at its centre. TacticalDraw never lays Notes out itself, and treats
|
|
572
|
+
* `content` as an opaque string; a host-supplied {@link NoteCapability} (backed by
|
|
573
|
+
* `@orbat-mapper/tactical-notes`) turns a Note into a note raster.
|
|
574
|
+
*
|
|
575
|
+
* The frame types below mirror `@orbat-mapper/tactical-notes`' model so a
|
|
576
|
+
* `NoteGraphic` is structurally assignable to its `NoteModel`, without a
|
|
577
|
+
* package dependency in either direction.
|
|
578
|
+
*/
|
|
579
|
+
/** Notes are between 2 and 60 em wide. */
|
|
580
|
+
declare const NOTE_MIN_WIDTH = 2;
|
|
581
|
+
declare const NOTE_MAX_WIDTH = 60;
|
|
582
|
+
/** Ground size of one em: the Note's scale. */
|
|
583
|
+
type NoteEmSize = {
|
|
584
|
+
value: number;
|
|
585
|
+
unit: "meters";
|
|
586
|
+
};
|
|
587
|
+
/** A stroke in em. On a frame's border, `"double"` makes `width` two rules and their gap. */
|
|
588
|
+
interface NoteStroke {
|
|
589
|
+
color: string;
|
|
590
|
+
width: number;
|
|
591
|
+
style?: "solid" | "double";
|
|
592
|
+
}
|
|
593
|
+
/** Built-in frame preset names. */
|
|
594
|
+
type NoteFramePresetId = "plate" | "card" | "alert" | "dark" | "field" | "minimal" | "friendly" | "enemy" | "title" | "site" | "narrative";
|
|
595
|
+
/** Horizontal alignment of a Note's headings within the content width. */
|
|
596
|
+
type NoteHeadingAlign = "start" | "center" | "end";
|
|
597
|
+
/** Horizontal alignment of a Note's paragraphs within the content width. */
|
|
598
|
+
type NoteBodyAlign = NoteHeadingAlign;
|
|
599
|
+
/** Font families by typographic role. */
|
|
600
|
+
interface NoteFontRoles {
|
|
601
|
+
heading: string;
|
|
602
|
+
body: string;
|
|
603
|
+
}
|
|
604
|
+
/** Overrides for a subset of the frame preset's theme tokens. Lengths are in em. */
|
|
605
|
+
interface NoteFrameTokenOverrides {
|
|
606
|
+
background?: string;
|
|
607
|
+
border?: NoteStroke | null;
|
|
608
|
+
accent?: string;
|
|
609
|
+
accentText?: string;
|
|
610
|
+
textColor?: string;
|
|
611
|
+
padding?: number;
|
|
612
|
+
cornerRadius?: number;
|
|
613
|
+
blockSpacing?: number;
|
|
614
|
+
lineHeight?: number;
|
|
615
|
+
headerBand?: number | null;
|
|
616
|
+
/** Space above and below a heading held in the header band. */
|
|
617
|
+
headerBandPadding?: number;
|
|
618
|
+
/** Where headings sit within the content width. Defaults to `"start"`. */
|
|
619
|
+
headingAlign?: NoteHeadingAlign;
|
|
620
|
+
/** Where paragraphs sit within the content width. Defaults to `"start"`; lists stay there. */
|
|
621
|
+
bodyAlign?: NoteBodyAlign;
|
|
622
|
+
/** Multiplies the heading sizes, 1.5 em for level 1 and 1.2 em for level 2. */
|
|
623
|
+
headingScale?: number;
|
|
624
|
+
/** Sets headings bold. Defaults to `true`; when false, headings are regular weight. */
|
|
625
|
+
headingBold?: boolean;
|
|
626
|
+
/** Added after each heading character, as a fraction of the heading's size. */
|
|
627
|
+
headingLetterSpacing?: number;
|
|
628
|
+
/** Sets a heading's lowercase letters as smaller capitals. */
|
|
629
|
+
headingSmallCaps?: boolean;
|
|
630
|
+
fonts?: Partial<NoteFontRoles>;
|
|
631
|
+
}
|
|
632
|
+
interface NoteFrame {
|
|
633
|
+
preset: NoteFramePresetId;
|
|
634
|
+
tokens?: NoteFrameTokenOverrides;
|
|
635
|
+
}
|
|
636
|
+
interface NoteGraphicStyle {
|
|
637
|
+
opacity?: number;
|
|
638
|
+
}
|
|
639
|
+
/** Persisted Note graphic (ADR-0066). Its height is derived from the layout and never stored. */
|
|
640
|
+
interface NoteGraphic {
|
|
641
|
+
id: string;
|
|
642
|
+
kind: "note";
|
|
643
|
+
schemaVersion: 1;
|
|
644
|
+
/** Geographic centre of the box. */
|
|
645
|
+
position: Position;
|
|
646
|
+
/** Normalized radians clockwise from geographic north. */
|
|
647
|
+
rotation: number;
|
|
648
|
+
emSize: NoteEmSize;
|
|
649
|
+
/** Total box width in em, frame included (2 to 60). */
|
|
650
|
+
width: number;
|
|
651
|
+
frame: NoteFrame;
|
|
652
|
+
/** Markdown text and images, opaque to TacticalDraw. Any string is valid, even an empty one. */
|
|
653
|
+
content: string;
|
|
654
|
+
name?: string;
|
|
655
|
+
style?: NoteGraphicStyle;
|
|
656
|
+
properties?: Record<string, unknown>;
|
|
657
|
+
}
|
|
658
|
+
/** A ready note raster: a self-contained raster data URL covering the whole box. */
|
|
659
|
+
interface NoteRaster {
|
|
660
|
+
url: string;
|
|
661
|
+
width: number;
|
|
662
|
+
height: number;
|
|
663
|
+
/**
|
|
664
|
+
* The layout's exact height in em. A pixel height is rounded up, so without
|
|
665
|
+
* this the box height is only as exact as the raster's aspect ratio.
|
|
666
|
+
*/
|
|
667
|
+
heightEm?: number;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Host-supplied note rasteriser (ADR-0066, ADR-0069). `resolve` is synchronous:
|
|
671
|
+
* it returns a cached raster for the Note at `pxPerEm`, or `"pending"` while
|
|
672
|
+
* fonts, images or the raster are still loading. When a pending raster becomes ready the
|
|
673
|
+
* capability bumps `generation`; the host then calls `render()` again.
|
|
674
|
+
*/
|
|
675
|
+
interface NoteCapability {
|
|
676
|
+
resolve(note: NoteGraphic, pxPerEm: number): NoteRaster | "pending";
|
|
677
|
+
/** Monotonic host-owned revision, bumped whenever a pending raster becomes ready. */
|
|
678
|
+
readonly generation?: number;
|
|
679
|
+
/** When note rasters fade out (ADR-0069). Each threshold has a default. */
|
|
680
|
+
readonly fade?: NoteFadeThresholds;
|
|
681
|
+
/**
|
|
682
|
+
* Raster pixels per screen pixel, typically `devicePixelRatio`. Scales the
|
|
683
|
+
* requested density so text stays sharp on high-density displays. Defaults to 1.
|
|
684
|
+
*/
|
|
685
|
+
readonly pixelRatio?: number;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Fade-out thresholds for note rasters (ADR-0069). Each fade runs over one
|
|
689
|
+
* density step: the overlay is fully opaque at the threshold and gone at a
|
|
690
|
+
* factor of two past it.
|
|
691
|
+
*/
|
|
692
|
+
interface NoteFadeThresholds {
|
|
693
|
+
/**
|
|
694
|
+
* On-screen size of one em, in CSS pixels, below which a Note fades. Defaults
|
|
695
|
+
* to 6; 0 means a Note never fades for being small.
|
|
696
|
+
*/
|
|
697
|
+
minEmPixels?: number;
|
|
698
|
+
/**
|
|
699
|
+
* How far the {@link NOTE_MAX_RASTER_PIXELS} cap may stretch a raster, as
|
|
700
|
+
* screen pixels per raster pixel, before the Note fades. Defaults to 1.
|
|
701
|
+
*/
|
|
702
|
+
maxStretch?: number;
|
|
703
|
+
}
|
|
704
|
+
/** Longest side of a note raster requested for the interactive map (ADR-0069). */
|
|
705
|
+
declare const NOTE_MAX_RASTER_PIXELS = 2048;
|
|
706
|
+
/** The render half of a Note snapshot. */
|
|
707
|
+
interface NoteRender {
|
|
708
|
+
/** Box height in em: from the layout when ready, else a placeholder heuristic. */
|
|
709
|
+
height: number;
|
|
710
|
+
available: boolean;
|
|
711
|
+
}
|
|
712
|
+
declare function isNoteGraphic(graphic: unknown): graphic is NoteGraphic;
|
|
713
|
+
declare function cloneNoteGraphic(note: NoteGraphic): NoteGraphic;
|
|
714
|
+
declare function normalizeNoteGraphic(note: NoteGraphic): NoteGraphic;
|
|
715
|
+
declare function noteOpacity(note: NoteGraphic): number;
|
|
716
|
+
/** Throws a `TypeError` naming the first malformed field. */
|
|
717
|
+
declare function validateNoteGraphic(note: NoteGraphic): void;
|
|
718
|
+
//#endregion
|
|
554
719
|
//#region src/graphic.d.ts
|
|
555
|
-
type Graphic = ControlMeasure | PointSymbol | ImageGraphic | Marker;
|
|
556
|
-
type GraphicRender = ControlMeasureRender | PointSymbolRender | ImageRender | MarkerRender;
|
|
720
|
+
type Graphic = ControlMeasure | PointSymbol | ImageGraphic | Marker | NoteGraphic;
|
|
721
|
+
type GraphicRender = ControlMeasureRender | PointSymbolRender | ImageRender | MarkerRender | NoteRender;
|
|
557
722
|
interface GraphicSnapshot<G extends Graphic = Graphic> {
|
|
558
723
|
graphic: G;
|
|
559
|
-
render: G extends PointSymbol ? PointSymbolRender : G extends ImageGraphic ? ImageRender : G extends Marker ? MarkerRender : ControlMeasureRender;
|
|
724
|
+
render: G extends PointSymbol ? PointSymbolRender : G extends ImageGraphic ? ImageRender : G extends Marker ? MarkerRender : G extends NoteGraphic ? NoteRender : ControlMeasureRender;
|
|
560
725
|
}
|
|
561
726
|
/**
|
|
562
727
|
* A graphic whose identity is one geographic anchor + size + rotation,
|
|
563
|
-
* rather than a control-point geometry: `PointSymbol`, `ImageGraphic`,
|
|
728
|
+
* rather than a control-point geometry: `PointSymbol`, `ImageGraphic`,
|
|
729
|
+
* `Marker` or `NoteGraphic`.
|
|
564
730
|
*/
|
|
565
|
-
type AnchoredGraphic = PointSymbol | ImageGraphic | Marker;
|
|
731
|
+
type AnchoredGraphic = PointSymbol | ImageGraphic | Marker | NoteGraphic;
|
|
566
732
|
declare function isAnchoredGraphic(graphic: Graphic): graphic is AnchoredGraphic;
|
|
567
733
|
/** A graphic that can take view-owned pin presentation (ADR-0056): a point symbol or marker. */
|
|
568
734
|
type PinnableGraphic = PointSymbol | Marker;
|
|
@@ -712,6 +878,8 @@ interface InteractionStyle {
|
|
|
712
878
|
activeSnapTargetHandle?: HandleStyle;
|
|
713
879
|
scaleHandle?: HandleStyle;
|
|
714
880
|
rotateHandle?: HandleStyle;
|
|
881
|
+
/** A Note's left and right edge-midpoint grips that change its width (ADR-0066). */
|
|
882
|
+
widthHandle?: HandleStyle;
|
|
715
883
|
boxOutline?: GuideStyle;
|
|
716
884
|
/**
|
|
717
885
|
* Line style for the passive, non-interactive selection highlight rendered
|
|
@@ -1562,6 +1730,14 @@ type DrawPointSymbolDraft = Pick<PointSymbol, "kind" | "sidc"> & Partial<Omit<Po
|
|
|
1562
1730
|
//#region src/tactical-draw/image-draw-controller.d.ts
|
|
1563
1731
|
type DrawImageDraft = Pick<ImageGraphic, "kind" | "resourceId" | "intrinsicSize"> & Partial<Omit<ImageGraphic, "kind" | "resourceId" | "intrinsicSize">>;
|
|
1564
1732
|
//#endregion
|
|
1733
|
+
//#region src/tactical-draw/note-draw-controller.d.ts
|
|
1734
|
+
/**
|
|
1735
|
+
* A Note to place with one click. The host supplies the content (`content`)
|
|
1736
|
+
* and `frame`; everything else defaults: `emSize` to 14 screen px at the
|
|
1737
|
+
* current resolution and `width` to 24 em (ADR-0066).
|
|
1738
|
+
*/
|
|
1739
|
+
type DrawNoteDraft = Pick<NoteGraphic, "kind" | "content" | "frame"> & Partial<Omit<NoteGraphic, "kind" | "content" | "frame">>;
|
|
1740
|
+
//#endregion
|
|
1565
1741
|
//#region src/tactical-draw/marker-draw-controller.d.ts
|
|
1566
1742
|
type DrawMarkerDraft = Pick<Marker, "kind" | "symbolId"> & Partial<Omit<Marker, "kind" | "symbolId">>;
|
|
1567
1743
|
/** Default icon height for a drawn marker when the draft omits `size`. */
|
|
@@ -1613,6 +1789,11 @@ interface TacticalDrawOptions {
|
|
|
1613
1789
|
pointSymbols?: PointSymbolCapability;
|
|
1614
1790
|
/** Synchronous host-supplied resolver for first-class Image resources. */
|
|
1615
1791
|
images?: ImageCapability;
|
|
1792
|
+
/**
|
|
1793
|
+
* Synchronous host-supplied note rasteriser for Note graphics (ADR-0066),
|
|
1794
|
+
* typically backed by `@orbat-mapper/tactical-notes`.
|
|
1795
|
+
*/
|
|
1796
|
+
notes?: NoteCapability;
|
|
1616
1797
|
/** Synchronous host-supplied icon resolver for generic Markers (ADR-0059). */
|
|
1617
1798
|
markers?: MarkerCapability;
|
|
1618
1799
|
/**
|
|
@@ -1658,9 +1839,10 @@ interface TacticalDrawOptions {
|
|
|
1658
1839
|
*/
|
|
1659
1840
|
interactionStyle?: InteractionStyle;
|
|
1660
1841
|
/**
|
|
1661
|
-
* Optional id generator for
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1842
|
+
* Optional id generator for graphics produced by `draw()` when the draft has
|
|
1843
|
+
* no `id`. Defaults to `td-${prefix}-${n}`: a random 8-hex-digit prefix per
|
|
1844
|
+
* instance plus an increasing counter, so ids from a new instance do not
|
|
1845
|
+
* collide with graphics saved from an earlier one.
|
|
1664
1846
|
*/
|
|
1665
1847
|
generateId?: () => string;
|
|
1666
1848
|
/** Optional engine-level snapping for draw and edit interactions. */
|
|
@@ -1674,7 +1856,7 @@ interface EditOptions {
|
|
|
1674
1856
|
* Called synchronously once when the edit starts, before any pointer event
|
|
1675
1857
|
* is processed. Lets a host wire commit / cancel buttons to the active edit.
|
|
1676
1858
|
*/
|
|
1677
|
-
onSession?: (session: EditSession | GraphicEditSession<PointSymbol> | GraphicEditSession<ImageGraphic> | GraphicEditSession<Marker>) => void;
|
|
1859
|
+
onSession?: (session: EditSession | GraphicEditSession<PointSymbol> | GraphicEditSession<ImageGraphic> | GraphicEditSession<NoteGraphic> | GraphicEditSession<Marker>) => void;
|
|
1678
1860
|
/**
|
|
1679
1861
|
* Default `true`. When `true`, a click on empty map (or on another graphics
|
|
1680
1862
|
* layer measure) closes the active edit. Clicks on preview / handle
|
|
@@ -1840,6 +2022,7 @@ declare class TacticalDraw {
|
|
|
1840
2022
|
private readonly currentEditModifiers;
|
|
1841
2023
|
private readonly pointSymbols;
|
|
1842
2024
|
private readonly images;
|
|
2025
|
+
private readonly notes;
|
|
1843
2026
|
private readonly markers;
|
|
1844
2027
|
private snappingOptions;
|
|
1845
2028
|
private readonly resolveSnap;
|
|
@@ -1885,7 +2068,6 @@ declare class TacticalDraw {
|
|
|
1885
2068
|
* not as a programmatic preemption.
|
|
1886
2069
|
*/
|
|
1887
2070
|
private deferredGraphicsPick;
|
|
1888
|
-
private idCounter;
|
|
1889
2071
|
private editCounter;
|
|
1890
2072
|
private transformCounter;
|
|
1891
2073
|
/** Snapshot of the host's latest authoritative Graphic membership and order. */
|
|
@@ -1920,6 +2102,9 @@ declare class TacticalDraw {
|
|
|
1920
2102
|
*/
|
|
1921
2103
|
private lastSeenPointSymbolGeneration;
|
|
1922
2104
|
private lastSeenImageGeneration;
|
|
2105
|
+
private lastSeenNoteGeneration;
|
|
2106
|
+
/** Note rasters per density step and last known Note heights (ADR-0069). */
|
|
2107
|
+
private noteResolveCache;
|
|
1923
2108
|
private lastSeenMarkerGeneration;
|
|
1924
2109
|
/**
|
|
1925
2110
|
* Ids of graphics currently carrying a passive selection-highlight outline
|
|
@@ -2038,6 +2223,7 @@ declare class TacticalDraw {
|
|
|
2038
2223
|
* resolution-independent graphics remain cache hits.
|
|
2039
2224
|
*/
|
|
2040
2225
|
private invalidateGraphicGroupCache;
|
|
2226
|
+
private forgetNoteRasters;
|
|
2041
2227
|
/** Refresh capability-dependent renders before any caller-visible state is mutated. */
|
|
2042
2228
|
private refreshCapabilityGenerations;
|
|
2043
2229
|
/** Submit one complete grouped desired state for the host stack plus overrides. */
|
|
@@ -2185,6 +2371,7 @@ declare class TacticalDraw {
|
|
|
2185
2371
|
draw(draft: DrawPointSymbolDraft, options?: DrawOptions): Promise<GraphicSnapshot<PointSymbol>>;
|
|
2186
2372
|
draw(draft: DrawImageDraft, options?: DrawOptions): Promise<GraphicSnapshot<ImageGraphic>>;
|
|
2187
2373
|
draw(draft: DrawMarkerDraft, options?: DrawOptions): Promise<GraphicSnapshot<Marker>>;
|
|
2374
|
+
draw(draft: DrawNoteDraft, options?: DrawOptions): Promise<GraphicSnapshot<NoteGraphic>>;
|
|
2188
2375
|
draw<K extends ControlMeasureKind>(draft: DrawMeasureDraft<K>, options?: DrawOptions): Promise<GraphicSnapshot<ControlMeasure<K>>>;
|
|
2189
2376
|
/**
|
|
2190
2377
|
* Start an interactive edit on a single control measure. Returns a Promise
|
|
@@ -2203,6 +2390,7 @@ declare class TacticalDraw {
|
|
|
2203
2390
|
*/
|
|
2204
2391
|
edit(graphic: PointSymbol, options?: EditOptions): Promise<GraphicSnapshot<PointSymbol>>;
|
|
2205
2392
|
edit(graphic: ImageGraphic, options?: EditOptions): Promise<GraphicSnapshot<ImageGraphic>>;
|
|
2393
|
+
edit(graphic: NoteGraphic, options?: EditOptions): Promise<GraphicSnapshot<NoteGraphic>>;
|
|
2206
2394
|
edit(graphic: Marker, options?: EditOptions): Promise<GraphicSnapshot<Marker>>;
|
|
2207
2395
|
edit(measure: ControlMeasure, options?: EditOptions): Promise<GraphicSnapshot<ControlMeasure>>;
|
|
2208
2396
|
/**
|
|
@@ -2451,6 +2639,9 @@ declare class PointSymbolCapabilityRequiredError extends Error {
|
|
|
2451
2639
|
declare class ImageCapabilityRequiredError extends Error {
|
|
2452
2640
|
constructor();
|
|
2453
2641
|
}
|
|
2642
|
+
declare class NoteCapabilityRequiredError extends Error {
|
|
2643
|
+
constructor();
|
|
2644
|
+
}
|
|
2454
2645
|
declare class MarkerCapabilityRequiredError extends Error {
|
|
2455
2646
|
constructor();
|
|
2456
2647
|
}
|
|
@@ -2509,6 +2700,50 @@ interface ImageFootprint {
|
|
|
2509
2700
|
}
|
|
2510
2701
|
declare function imageFootprint(image: ImageGraphic, render: ImageRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): ImageFootprint | null;
|
|
2511
2702
|
//#endregion
|
|
2703
|
+
//#region src/tactical-draw/note-rendering.d.ts
|
|
2704
|
+
/**
|
|
2705
|
+
* One Note's contribution to its atomic FeatureGroup (ADR-0066, ADR-0069):
|
|
2706
|
+
* the note raster as an image overlay, then a transparent pick polygon over the full box.
|
|
2707
|
+
* While pending, the polygon becomes a grey placeholder and there is no overlay.
|
|
2708
|
+
* A fully faded Note has neither, so it can't be seen or picked.
|
|
2709
|
+
*/
|
|
2710
|
+
interface NoteRenderPlan {
|
|
2711
|
+
features: Feature[];
|
|
2712
|
+
overlay?: ImageOverlayResource;
|
|
2713
|
+
render: NoteRender;
|
|
2714
|
+
}
|
|
2715
|
+
interface NoteFootprint {
|
|
2716
|
+
box: TransformBox;
|
|
2717
|
+
corners: PixelCoordinate[];
|
|
2718
|
+
}
|
|
2719
|
+
/**
|
|
2720
|
+
* Memo shared by every render of one `TacticalDraw`, so zooming within a
|
|
2721
|
+
* density step reuses the resolved raster without calling the capability, and
|
|
2722
|
+
* the 2048 px cap is sized from a Note's last known height.
|
|
2723
|
+
*/
|
|
2724
|
+
interface NoteResolveCache {
|
|
2725
|
+
/** Last ready box height in em per Note id. */
|
|
2726
|
+
readonly heights: Map<string, number>;
|
|
2727
|
+
/** Last ready raster per Note snapshot, with the density it was requested at. */
|
|
2728
|
+
readonly rasters: WeakMap<NoteGraphic, {
|
|
2729
|
+
pxPerEm: number;
|
|
2730
|
+
raster: NoteRaster;
|
|
2731
|
+
}>;
|
|
2732
|
+
}
|
|
2733
|
+
/** Screen-space box of a Note, for highlights, edit boxes and marquee hit tests. */
|
|
2734
|
+
declare function noteFootprint(note: NoteGraphic, render: NoteRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): NoteFootprint | null;
|
|
2735
|
+
/**
|
|
2736
|
+
* Resolve and render one Note. Validates the Note and the resolved raster first,
|
|
2737
|
+
* so a malformed Note or raster throws before any caller state changes.
|
|
2738
|
+
*
|
|
2739
|
+
* The density requested from the capability follows the view (ADR-0069): the
|
|
2740
|
+
* on-screen pixels per em, times the capability's pixel ratio, rounded up to a
|
|
2741
|
+
* power of two and capped so the raster's longest side stays within
|
|
2742
|
+
* {@link NOTE_MAX_RASTER_PIXELS}. The overlay fades over one step once an em
|
|
2743
|
+
* is smaller on screen than the fade threshold, or once the cap stretches it.
|
|
2744
|
+
*/
|
|
2745
|
+
declare function renderNoteForAdapter(adapter: Pick<MapAdapter, "getResolution" | "fromLonLat" | "toLonLat">, capability: NoteCapability, note: NoteGraphic, cache?: NoteResolveCache): NoteRenderPlan;
|
|
2746
|
+
//#endregion
|
|
2512
2747
|
//#region src/tactical-draw/marker-rendering.d.ts
|
|
2513
2748
|
type MarkerFootprint = Omit<PointSymbolFootprint, "connector">;
|
|
2514
2749
|
/** Resolve a marker's icon, substituting the built-in placeholder for unknown symbols. */
|
|
@@ -2530,4 +2765,4 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2530
2765
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2531
2766
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2532
2767
|
//#endregion
|
|
2533
|
-
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_EDIT_MODIFIERS, 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 EditModifiers, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type FeatureHighlightBand, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, HIGHLIGHT_BAND_SLOTS, HIGHLIGHT_CASING_OUTSET_CSS_PIXELS, HIGHLIGHT_GLOW_BANDS, type HandleStyle, type HatchPattern, type HighlightBand, type HighlightBandSlot, type HighlightCasing, 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 ModifierKey, 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 PointSymbolRect, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedEditModifiers, 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, canResetGroundSizes, cloneImageGraphic, cloneMarker, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hasHighlightCasing, highlightBandsForStyle, highlightBandsInPaintOrder, highlightCasingWidth, 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, resetGroundSizeOptions, resizePointSymbolSize, resolveGroundTextSizePixels, resolveHighlightBands, resolveHighlightCasing, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker };
|
|
2768
|
+
export { type AnchoredGraphic, BaseMapAdapter, type CombinedAbort, DEFAULT_EDIT_MODIFIERS, 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 DrawNoteDraft, type DrawOptions, type DrawPointSymbolDraft, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditModifiers, type EditOptions, type EditPointerDriver, type EditSession, type FeatureGroup, type FeatureHighlightBand, type Graphic, type GraphicEditChangeEvent, type GraphicEditSession, type GraphicGeometrySnappingOptions, type GraphicRender, type GraphicSnapshot, type GuideStyle, HATCH_PATTERNS, HIGHLIGHT_BAND_SLOTS, HIGHLIGHT_CASING_OUTSET_CSS_PIXELS, HIGHLIGHT_GLOW_BANDS, type HandleStyle, type HatchPattern, type HighlightBand, type HighlightBandSlot, type HighlightCasing, 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 ModifierKey, NOTE_MAX_RASTER_PIXELS, NOTE_MAX_WIDTH, NOTE_MIN_WIDTH, type NativeEventEntry, type NoteBodyAlign, type NoteCapability, NoteCapabilityRequiredError, type NoteEmSize, type NoteFadeThresholds, type NoteFontRoles, type NoteFootprint, type NoteFrame, type NoteFramePresetId, type NoteFrameTokenOverrides, type NoteGraphic, type NoteGraphicStyle, type NoteHeadingAlign, type NoteRaster, type NoteRender, type NoteStroke, 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 PointSymbolRect, type PointSymbolRender, type PointSymbolSize, type PointSymbolStyle, type PointSymbolView, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type ResolvedEditModifiers, 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, canResetGroundSizes, cloneImageGraphic, cloneMarker, cloneNoteGraphic, clonePointSymbol, coerceHandleStyle, combinePinScale, combineWithHostSignal, composeMarkerCapabilities, convertPointSymbolPlacement, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hasHighlightCasing, highlightBandsForStyle, highlightBandsInPaintOrder, highlightCasingWidth, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, isAnchoredGraphic, isImageGraphic, isMarker, isMinePattern, isNoteGraphic, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeImageGraphic, normalizeMarker, normalizeNoteGraphic, noteFootprint, noteOpacity, parseColor, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, renderNoteForAdapter, renderOrderToVisualOrder, resetGroundSizeOptions, resizePointSymbolSize, resolveGroundTextSizePixels, resolveHighlightBands, resolveHighlightCasing, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, scalePointSymbolLayout, tryControlMeasureIdFromFeature, validateImageGraphic, validateMarker, validateNoteGraphic };
|