@orbat-mapper/tactical-draw 0.34.0 → 0.35.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 +1897 -770
- package/dist/index.mjs +14152 -9030
- package/dist/map-adapter-De1DC6Zy.d.mts +1536 -0
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +15 -2
- package/package.json +3 -2
- package/dist/map-adapter-g2v5Ok3Y.d.mts +0 -832
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as CollocationLocate, $t as DEFAULT_PIN_PRESENTATION, A as PointSymbolColors, At as validateCollocation, B as clonePointSymbol, Bt as isMarker, C as isMinePattern, Ct as collocationOpacity, D as PointSymbol, Dt as resolveCollocationLocation, E as OffsetDragModifier, Et as patchCollocationOptions, F as PointSymbolPlacement, Ft as MarkerRender, G as Collocation, Gt as EditModifiers, H as resizePointSymbolSize, Ht as normalizeMarker, I as PointSymbolRect, It as MarkerSize, J as CollocationBracketShape, Jt as ResolvedEditModifiers, K as CollocationAreaStyle, Kt as ModifierKey, L as PointSymbolRender, Lt as MarkerStyle, M as PointSymbolGraphicModifiers, Mt as MarkerAnchor, N as PointSymbolOffset, Nt as MarkerCapability, O as PointSymbolAnchor, Ot as resolveCollocationSize, P as PointSymbolOffsetStyle, Pt as MarkerIcon, Q as CollocationHalo, Qt as PointerEventInfo, R as PointSymbolSize, Rt as cloneMarker, S as fillPatternImageId, St as collocationMemberPart, T as parseColor, Tt as normalizeCollocation, U as BuildCollocationRenderOptions, Ut as validateMarker, V as isPointSymbol, Vt as markerOpacity, W as COLLOCATION_SCREEN_RELATIVE_REACH, Wt as DEFAULT_EDIT_MODIFIERS, X as CollocationCommitChanges, Xt as EditPointerDriver, Y as CollocationBracketSide, Yt as readPickModifiers, Z as CollocationGround, Zt as PointerCallback, _ as HATCH_PATTERNS, _t as CollocationStroke, a as ImageOverlayResource, an as PinPresentationState, at as CollocationMemberOptionTypes, b as Rgba, bt as buildCollocationRender, c as MapCursor, cn as PinPresentationStore, ct as CollocationMemberRenderContext, d as PickEvent, dn as isValidPinNumber, dt as CollocationPart, en as PinFootprint, et as CollocationMarker, f as PickHandler, fn as pinDistanceScale, ft as CollocationPartDrag, g as TextStyleOptions, gt as CollocationRenderMember, h as StyleOptions, ht as CollocationRender, i as IconResource, in as PinPresentationPatch, it as CollocationMemberIcon, j as PointSymbolConnector, jt as Marker, k as PointSymbolCapability, kt as stableCollocation, l as MapEvent, ln as PinRender, lt as CollocationMemberSupport, m as PixelCoordinate, mn as resolvePinPresentation, mt as CollocationPointSymbol, n as HandleStyle, nn as PinPresentation, nt as CollocationMemberCapabilities, o as LayerId, on as PinPresentationStatus, ot as CollocationMemberOptions, p as PickOptions, pn as pinZoomScale, pt as CollocationPlate, q as CollocationBracketPlacement, qt as PickModifiers, r as IconHitLine, rn as PinPresentationCapability, rt as CollocationMemberGraphic, s as MapAdapter, sn as PinPresentationStatusEvent, st as CollocationMemberRender, t as FeatureGroup, tn as PinOverridePatch, tt as CollocationMember, u as MapEventHandler, un as combinePinScale, ut as CollocationOptions, v as HatchPattern, vt as CollocationStyle, w as makeFillPatternImage, wt as isCollocation, x as fillPatternImageDimension, xt as cloneCollocation, y as MINE_PATTERN_TILE_SIZE, yt as ResolvedCollocationMemberRender, z as PointSymbolStyle, zt as composeMarkerCapabilities } from "./map-adapter-De1DC6Zy.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
|
|
|
@@ -22,7 +22,14 @@ declare abstract class BaseMapAdapter<TLayerHandle, TEventToken, TViewToken> imp
|
|
|
22
22
|
protected featureCache: Map<string, Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[]>;
|
|
23
23
|
protected featuresChangedListeners: Map<string, Set<(features: Feature[]) => void>>;
|
|
24
24
|
protected iconResources: Map<string, IconResource>;
|
|
25
|
+
/** What each layer draws: its desired groups, or a group's previous version while held. */
|
|
25
26
|
private featureGroupState;
|
|
27
|
+
/** The groups each layer was last given. */
|
|
28
|
+
private desiredFeatureGroups;
|
|
29
|
+
/** Held groups per layer, for layers drawing at least one group's earlier version. */
|
|
30
|
+
private heldLayers;
|
|
31
|
+
/** Per held layer, the timer that draws a group that waited too long. */
|
|
32
|
+
private holdTimers;
|
|
26
33
|
private layerIconResourceIds;
|
|
27
34
|
private layerCounter;
|
|
28
35
|
private destroyed;
|
|
@@ -32,6 +39,35 @@ declare abstract class BaseMapAdapter<TLayerHandle, TEventToken, TViewToken> imp
|
|
|
32
39
|
}): LayerId;
|
|
33
40
|
removeLayer(layerId: LayerId): void;
|
|
34
41
|
setLayerFeatureGroups(layerId: LayerId, groups: readonly FeatureGroup[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Hand a layer's desired groups to the engine. A group whose drawn icons
|
|
44
|
+
* (see `isIconResourceReady`) are not all drawable yet keeps drawing earlier
|
|
45
|
+
* content, so a replacement image that loads asynchronously never leaves a
|
|
46
|
+
* frame without the group's content; `iconResourceLoaded` commits it once
|
|
47
|
+
* they are. Updates that arrive faster than their icons load don't freeze
|
|
48
|
+
* the group: it draws the newest version whose icons have loaded, and one
|
|
49
|
+
* that drew nothing newer for a second draws its desired version anyway. A
|
|
50
|
+
* group with no previous version is drawn at once.
|
|
51
|
+
*/
|
|
52
|
+
private commitFeatureGroups;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the engine can draw icon resource `id` in the next frame. Engines
|
|
55
|
+
* that register icon images asynchronously override this together with
|
|
56
|
+
* calling `iconResourceLoaded`; a resource that failed to load counts as
|
|
57
|
+
* ready, so its group is not held forever.
|
|
58
|
+
*/
|
|
59
|
+
protected isIconResourceReady(id: string): boolean;
|
|
60
|
+
/** Called by the engine once icon resource `id` became drawable: commits groups held for it. */
|
|
61
|
+
protected iconResourceLoaded(id: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Whether every icon `group` draws is drawable: the resources its features
|
|
64
|
+
* name through `iconId`, and its pin's. A listed resource nothing draws
|
|
65
|
+
* never holds the group.
|
|
66
|
+
*/
|
|
67
|
+
private iconsReady;
|
|
68
|
+
/** Commit `layerId` again when its longest-waiting held group runs out of time. */
|
|
69
|
+
private scheduleHoldTimeout;
|
|
70
|
+
private clearHoldTimer;
|
|
35
71
|
abstract onPick(layerId: LayerId, handler: PickHandler, opts?: PickOptions): () => void;
|
|
36
72
|
abstract createEditPointerDriver(): EditPointerDriver;
|
|
37
73
|
on(eventType: "click" | "pointermove" | "dblclick", handler: MapEventHandler): void;
|
|
@@ -91,6 +127,52 @@ declare function tryControlMeasureIdFromFeature(feature: Feature): string | null
|
|
|
91
127
|
*/
|
|
92
128
|
declare function bindAbortable(signal: AbortSignal | undefined, attach: () => () => void): () => void;
|
|
93
129
|
//#endregion
|
|
130
|
+
//#region src/feature-seam-fields.d.ts
|
|
131
|
+
/**
|
|
132
|
+
* Generic per-feature seam fields any `FeatureGroup` feature may carry
|
|
133
|
+
* (ADR-0063, "The MapAdapter seam"). Adapters read them through these helpers
|
|
134
|
+
* so every engine and the shared picker agree on defaults and validation.
|
|
135
|
+
*/
|
|
136
|
+
/**
|
|
137
|
+
* Feature property: optional pixel offset `[x, y]` from an icon feature's
|
|
138
|
+
* point to its resource anchor, in the icon's own resource units (right/down
|
|
139
|
+
* positive). It scales with the icon's display size (`iconScale` or ground
|
|
140
|
+
* sizing) and turns with its rotation, so the resource anchor draws at
|
|
141
|
+
* `point + rotate(offset × scale)`. With a non-zero `iconRotation` that isn't
|
|
142
|
+
* bearing-safe on MapLibre, which holds `iconRotation` on screen
|
|
143
|
+
* (`icon-rotation-alignment: viewport`) where OpenLayers and the shared
|
|
144
|
+
* picker turn it with the map; use {@link ICON_SCREEN_ROTATION_PROPERTY} for
|
|
145
|
+
* an offset icon on a map that may turn.
|
|
146
|
+
*/
|
|
147
|
+
declare const ICON_OFFSET_PROPERTY = "iconOffset";
|
|
148
|
+
/**
|
|
149
|
+
* Feature property: optional screen-space rotation of an icon feature, in
|
|
150
|
+
* radians clockwise on screen. When present it replaces `iconRotation` and the
|
|
151
|
+
* icon ignores the map bearing: it keeps this angle on screen however the map
|
|
152
|
+
* turns (OpenLayers `rotateWithView: false`, MapLibre viewport alignment).
|
|
153
|
+
* Collocation part and member images carry `0`, so they stay upright.
|
|
154
|
+
*/
|
|
155
|
+
declare const ICON_SCREEN_ROTATION_PROPERTY = "iconScreenRotation";
|
|
156
|
+
/**
|
|
157
|
+
* Feature property: `false` marks a feature as not hit area. The shared
|
|
158
|
+
* screen-space picker and every adapter's candidate collection skip it, so a
|
|
159
|
+
* pick falls through to whatever lies beneath. Any other value (or none)
|
|
160
|
+
* keeps the feature pickable.
|
|
161
|
+
*/
|
|
162
|
+
declare const HIT_AREA_PROPERTY = "hitArea";
|
|
163
|
+
/** The feature's icon pixel offset in resource units; `[0, 0]` when absent or invalid. */
|
|
164
|
+
declare function resolveIconOffset(properties: Feature["properties"] | undefined): [number, number];
|
|
165
|
+
/** The feature's screen-space icon rotation (radians), or `undefined` when it turns with the map. */
|
|
166
|
+
declare function resolveIconScreenRotation(properties: Feature["properties"] | undefined): number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* The icon resource anchor shifted by the feature's icon pixel offset: the
|
|
169
|
+
* resource coordinate that lands on the feature's point. Adapters whose engine
|
|
170
|
+
* takes an anchor (OpenLayers `anchor`, Leaflet `iconAnchor`) use it directly.
|
|
171
|
+
*/
|
|
172
|
+
declare function resolveIconAnchor(anchor: readonly [number, number], properties: Feature["properties"] | undefined): [number, number];
|
|
173
|
+
/** Whether the feature takes the pointer (false only for `hitArea: false`). */
|
|
174
|
+
declare function isHitArea(feature: Pick<Feature, "properties">): boolean;
|
|
175
|
+
//#endregion
|
|
94
176
|
//#region src/pick-candidates.d.ts
|
|
95
177
|
interface ScreenBounds {
|
|
96
178
|
minX: number;
|
|
@@ -496,75 +578,6 @@ declare function normalizeImageGraphic(image: ImageGraphic): ImageGraphic;
|
|
|
496
578
|
declare function imageOpacity(image: ImageGraphic): number;
|
|
497
579
|
declare function validateImageGraphic(image: ImageGraphic): void;
|
|
498
580
|
//#endregion
|
|
499
|
-
//#region src/marker.d.ts
|
|
500
|
-
/** Displayed icon height; same pixel/meter contract as point-symbol sizes. */
|
|
501
|
-
type MarkerSize = PointSymbolSize;
|
|
502
|
-
interface MarkerStyle {
|
|
503
|
-
/** Host-interpreted tint, handed to {@link MarkerCapability.render}. */
|
|
504
|
-
color?: string;
|
|
505
|
-
/** 0–1 display multiplier applied by TacticalDraw. */
|
|
506
|
-
opacity?: number;
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Persisted generic marker (e.g. a pin) whose icon is supplied by the
|
|
510
|
-
* host application. TacticalDraw treats `symbolId` as opaque (ADR-0059).
|
|
511
|
-
*/
|
|
512
|
-
interface Marker {
|
|
513
|
-
id: string;
|
|
514
|
-
kind: "marker";
|
|
515
|
-
/** Host-defined icon identifier resolved by the {@link MarkerCapability}. */
|
|
516
|
-
symbolId: string;
|
|
517
|
-
position: Position;
|
|
518
|
-
/** Normalized radians clockwise from geographic north, around the icon anchor. */
|
|
519
|
-
rotation: number;
|
|
520
|
-
size: MarkerSize;
|
|
521
|
-
/** Optional text; the capability decides whether and how to draw it. */
|
|
522
|
-
label?: string;
|
|
523
|
-
style?: MarkerStyle;
|
|
524
|
-
properties?: Record<string, unknown>;
|
|
525
|
-
schemaVersion: 1;
|
|
526
|
-
}
|
|
527
|
-
interface MarkerAnchor {
|
|
528
|
-
x: number;
|
|
529
|
-
y: number;
|
|
530
|
-
}
|
|
531
|
-
/** Host-prepared marker icon in canonical SVG units. */
|
|
532
|
-
interface MarkerIcon {
|
|
533
|
-
/**
|
|
534
|
-
* Content-derived identity for adapter-wide icon reuse: equal ids must mean
|
|
535
|
-
* identical SVG. Include anything that changes the drawing (symbol, color, label).
|
|
536
|
-
*/
|
|
537
|
-
resourceId: string;
|
|
538
|
-
/** Self-contained SVG markup. Producing safe content is the host's responsibility. */
|
|
539
|
-
svg: string;
|
|
540
|
-
width: number;
|
|
541
|
-
height: number;
|
|
542
|
-
/** Point placed at `Marker.position` (e.g. a pin's tip); rotation and scale pivot here. */
|
|
543
|
-
anchor: MarkerAnchor;
|
|
544
|
-
}
|
|
545
|
-
interface MarkerRender extends MarkerIcon {
|
|
546
|
-
/** False when the capability did not recognize `symbolId` and a placeholder is shown. */
|
|
547
|
-
available: boolean;
|
|
548
|
-
}
|
|
549
|
-
interface MarkerCapability {
|
|
550
|
-
/** Return `undefined` for an unknown `symbolId`; TacticalDraw renders a placeholder. */
|
|
551
|
-
render(marker: Marker): MarkerIcon | undefined;
|
|
552
|
-
/** Monotonic host-owned revision; bump it when icon resolution changes. */
|
|
553
|
-
readonly generation?: number;
|
|
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;
|
|
562
|
-
declare function isMarker(graphic: unknown): graphic is Marker;
|
|
563
|
-
declare function cloneMarker(marker: Marker): Marker;
|
|
564
|
-
declare function markerOpacity(marker: Marker): number;
|
|
565
|
-
declare function validateMarker(marker: Marker): void;
|
|
566
|
-
declare function normalizeMarker(marker: Marker): Marker;
|
|
567
|
-
//#endregion
|
|
568
581
|
//#region src/note-graphic.d.ts
|
|
569
582
|
/**
|
|
570
583
|
* The Note graphic kind (ADR-0066): a framed box of Markdown content pinned to
|
|
@@ -752,11 +765,20 @@ declare function noteOpacity(note: NoteGraphic): number;
|
|
|
752
765
|
declare function validateNoteGraphic(note: NoteGraphic): void;
|
|
753
766
|
//#endregion
|
|
754
767
|
//#region src/graphic.d.ts
|
|
755
|
-
type Graphic = ControlMeasure | PointSymbol | ImageGraphic | Marker | NoteGraphic;
|
|
756
|
-
type GraphicRender = ControlMeasureRender | PointSymbolRender | ImageRender | MarkerRender | NoteRender;
|
|
768
|
+
type Graphic = ControlMeasure | PointSymbol | ImageGraphic | Marker | NoteGraphic | Collocation;
|
|
769
|
+
type GraphicRender = ControlMeasureRender | PointSymbolRender | ImageRender | MarkerRender | NoteRender | CollocationRender;
|
|
757
770
|
interface GraphicSnapshot<G extends Graphic = Graphic> {
|
|
758
771
|
graphic: G;
|
|
759
|
-
render: G extends PointSymbol ? PointSymbolRender : G extends ImageGraphic ? ImageRender : G extends Marker ? MarkerRender : G extends NoteGraphic ? NoteRender : ControlMeasureRender;
|
|
772
|
+
render: G extends PointSymbol ? PointSymbolRender : G extends ImageGraphic ? ImageRender : G extends Marker ? MarkerRender : G extends NoteGraphic ? NoteRender : G extends Collocation ? CollocationRender : ControlMeasureRender;
|
|
773
|
+
/**
|
|
774
|
+
* What a transform session's commit changed in a collocation since the
|
|
775
|
+
* session took it up (#764), in the shape a collocation edit step reports.
|
|
776
|
+
* Set only on a collocation's snapshot that a transform session commits
|
|
777
|
+
* (`onCommit`, `close()`, `setGraphics`' removed members, the `editMany`
|
|
778
|
+
* promise); absent everywhere else. Only the keys the transform changed are
|
|
779
|
+
* present, so a transform that changed nothing reports `{}`.
|
|
780
|
+
*/
|
|
781
|
+
changes?: CollocationCommitChanges;
|
|
760
782
|
}
|
|
761
783
|
/**
|
|
762
784
|
* A graphic whose identity is one geographic anchor + size + rotation,
|
|
@@ -765,10 +787,410 @@ interface GraphicSnapshot<G extends Graphic = Graphic> {
|
|
|
765
787
|
*/
|
|
766
788
|
type AnchoredGraphic = PointSymbol | ImageGraphic | Marker | NoteGraphic;
|
|
767
789
|
declare function isAnchoredGraphic(graphic: Graphic): graphic is AnchoredGraphic;
|
|
790
|
+
/**
|
|
791
|
+
* A graphic that is a control measure: neither an anchored graphic (point
|
|
792
|
+
* symbol, image, Marker) nor a collocation.
|
|
793
|
+
*/
|
|
794
|
+
declare function isControlMeasureGraphic(graphic: Graphic): graphic is ControlMeasure;
|
|
768
795
|
/** A graphic that can take view-owned pin presentation (ADR-0056): a point symbol or marker. */
|
|
769
796
|
type PinnableGraphic = PointSymbol | Marker;
|
|
770
797
|
declare function isPinnableGraphic(graphic: Graphic): graphic is PinnableGraphic;
|
|
771
798
|
//#endregion
|
|
799
|
+
//#region src/collocation-transform.d.ts
|
|
800
|
+
/**
|
|
801
|
+
* A ground move handed to {@link ResolveCollocationTransform} (ADR-0063,
|
|
802
|
+
* "Gestures and pick result"). A location-handle drag passes `rotation: 0`
|
|
803
|
+
* and `scale: 1`; a group transform passes its box's rotation and scale.
|
|
804
|
+
*/
|
|
805
|
+
interface CollocationTransform {
|
|
806
|
+
/** Where the move takes a lon/lat position. */
|
|
807
|
+
map(position: Position): Position;
|
|
808
|
+
/** Clockwise screen rotation in radians. */
|
|
809
|
+
rotation: number;
|
|
810
|
+
/** Uniform scale factor. */
|
|
811
|
+
scale: number;
|
|
812
|
+
/**
|
|
813
|
+
* The size the collocation's members were drawn at when the gesture began:
|
|
814
|
+
* its `size`, or the capability default when it has none
|
|
815
|
+
* (`resolveCollocationSize`). A scale applies to this.
|
|
816
|
+
*/
|
|
817
|
+
size: PointSymbolSize;
|
|
818
|
+
/**
|
|
819
|
+
* Present for a partial collocation target: the ids of the collocation
|
|
820
|
+
* members the move applies to. Absent for the whole collocation.
|
|
821
|
+
*/
|
|
822
|
+
members?: readonly string[];
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* The host's rule for what a ground move changes in a collocation: pure and
|
|
826
|
+
* synchronous. The engine calls it on every preview move and once at commit,
|
|
827
|
+
* always with the collocation as it stood when the gesture began.
|
|
828
|
+
*/
|
|
829
|
+
type ResolveCollocationTransform = (collocation: Collocation, transform: CollocationTransform) => Collocation;
|
|
830
|
+
/**
|
|
831
|
+
* The default {@link ResolveCollocationTransform} (ADR-0063, #629 §7–8).
|
|
832
|
+
*
|
|
833
|
+
* For the whole collocation: `map` moves `position` if given, otherwise every
|
|
834
|
+
* positioned member; ground part placements are mapped, screen-relative ones
|
|
835
|
+
* rotated by `rotation` and multiplied by `scale`, a Bracket's `via` bend
|
|
836
|
+
* with them; a scale other than 1 sets
|
|
837
|
+
* `size` to `transform.size` times `scale`, with the point-symbol size floor.
|
|
838
|
+
* Members' set-aside `size`, `offset` and `rotation` are untouched and parts
|
|
839
|
+
* stay upright.
|
|
840
|
+
*
|
|
841
|
+
* For a partial target (`members` given): only the listed members that have a
|
|
842
|
+
* position move; `position`, `size` and part placements stay, so a derived
|
|
843
|
+
* location follows. Never modifies its input.
|
|
844
|
+
*/
|
|
845
|
+
declare function transformCollocation(collocation: Collocation, transform: CollocationTransform): Collocation;
|
|
846
|
+
/**
|
|
847
|
+
* Some of a collocation's members taken into a group transform alongside
|
|
848
|
+
* other graphics (ADR-0063). Only those members' positions move;
|
|
849
|
+
* members without a position are dropped from the target.
|
|
850
|
+
*/
|
|
851
|
+
interface PartialCollocationTarget {
|
|
852
|
+
graphic: Collocation;
|
|
853
|
+
/** Member ids, unique within the collocation. */
|
|
854
|
+
members: readonly string[];
|
|
855
|
+
}
|
|
856
|
+
/** What `editMany` and `TransformSession.setGraphics` accept for each member. */
|
|
857
|
+
type TransformTarget = Graphic | PartialCollocationTarget;
|
|
858
|
+
declare function isPartialCollocationTarget(target: unknown): target is PartialCollocationTarget;
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/collocation-layout.d.ts
|
|
861
|
+
/** Staff–Bracket clearance, CSS px at collocation scale 1 (fixed, #634). */
|
|
862
|
+
declare const COLLOCATION_CLEARANCE = 12;
|
|
863
|
+
/**
|
|
864
|
+
* Default `bracket.padding` everywhere but the spine side, where it follows
|
|
865
|
+
* `bracket.cap`: CSS px at collocation scale 1. Also the Staff plate's padding.
|
|
866
|
+
*/
|
|
867
|
+
declare const COLLOCATION_BRACKET_OVERHANG = 4;
|
|
868
|
+
/** How much wider than the line its halo is by default, CSS px at collocation scale 1. */
|
|
869
|
+
declare const COLLOCATION_HALO_EXTRA = 3;
|
|
870
|
+
type LocationMark = "ring" | "dot" | "cross";
|
|
871
|
+
type MemberMark = "dot" | "cross";
|
|
872
|
+
/** A part plate with its defaults filled in, shown or not. */
|
|
873
|
+
interface ResolvedCollocationPlate {
|
|
874
|
+
show: boolean;
|
|
875
|
+
fillColor: string;
|
|
876
|
+
fillOpacity: number;
|
|
877
|
+
/** `strokeWidth` in px at scale 1. */
|
|
878
|
+
border: {
|
|
879
|
+
show: boolean;
|
|
880
|
+
strokeColor: string;
|
|
881
|
+
strokeWidth: number;
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
/** A line's stroke with its defaults filled in; widths and dashes in px at scale 1. */
|
|
885
|
+
interface ResolvedCollocationStroke {
|
|
886
|
+
strokeColor: string;
|
|
887
|
+
strokeWidth: number;
|
|
888
|
+
strokeDash: number[];
|
|
889
|
+
}
|
|
890
|
+
/** {@link CollocationOptions} with every default filled in and out-of-range numbers replaced. */
|
|
891
|
+
interface ResolvedCollocationOptions {
|
|
892
|
+
parts: "role" | CollocationPart;
|
|
893
|
+
locate: "bounds-center" | "centroid" | "first";
|
|
894
|
+
gap: {
|
|
895
|
+
x: number;
|
|
896
|
+
y: number;
|
|
897
|
+
};
|
|
898
|
+
staff: {
|
|
899
|
+
tail: number; /** Px at scale 1, or `"frame"`: the lowest flag's frame stroke. */
|
|
900
|
+
strokeWidth: number | "frame"; /** A color, or `"frame"`: the lowest flag's frame color. */
|
|
901
|
+
strokeColor: string;
|
|
902
|
+
plate: ResolvedCollocationPlate;
|
|
903
|
+
};
|
|
904
|
+
bracket: {
|
|
905
|
+
defaultOffset: PixelCoordinate;
|
|
906
|
+
columns: number;
|
|
907
|
+
align: "left" | "center";
|
|
908
|
+
cap: number;
|
|
909
|
+
tick: number;
|
|
910
|
+
shape: CollocationBracketShape;
|
|
911
|
+
side: CollocationBracketSide;
|
|
912
|
+
attach: "middle" | "top";
|
|
913
|
+
plate: ResolvedCollocationPlate;
|
|
914
|
+
/**
|
|
915
|
+
* Each axis as set, or `null` unset: then the spine side follows `cap`
|
|
916
|
+
* and the other sides are {@link COLLOCATION_BRACKET_OVERHANG}.
|
|
917
|
+
*/
|
|
918
|
+
padding: {
|
|
919
|
+
x: number | null;
|
|
920
|
+
y: number | null;
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
line: {
|
|
924
|
+
strokeColor: string;
|
|
925
|
+
strokeWidth: number; /** `strokeWidth`: px wider than each line it backs, at scale 1. */
|
|
926
|
+
halo: {
|
|
927
|
+
show: boolean;
|
|
928
|
+
strokeColor: string;
|
|
929
|
+
strokeWidth: number;
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
leader: ResolvedCollocationStroke & {
|
|
933
|
+
show: boolean;
|
|
934
|
+
};
|
|
935
|
+
ground: {
|
|
936
|
+
/** `"auto"`: none where a Staff foot or leader ends at the location, else a ring. */location: {
|
|
937
|
+
mark: LocationMark | "auto" | "none";
|
|
938
|
+
color: string;
|
|
939
|
+
size: number;
|
|
940
|
+
};
|
|
941
|
+
memberPositions: {
|
|
942
|
+
mark: MemberMark | "none";
|
|
943
|
+
color: string;
|
|
944
|
+
size: number;
|
|
945
|
+
};
|
|
946
|
+
ties: ResolvedCollocationStroke & {
|
|
947
|
+
show: boolean;
|
|
948
|
+
};
|
|
949
|
+
spread: {
|
|
950
|
+
shape: "none" | "hull" | "concave" | "circle" | "box";
|
|
951
|
+
padding: number;
|
|
952
|
+
style: CollocationSpreadStyle;
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
/** Resolved spread-area style; `fillOpacity` defaults to 0.1, whatever `fillColor` is. */
|
|
957
|
+
interface CollocationSpreadStyle extends CollocationAreaStyle {
|
|
958
|
+
strokeColor: string;
|
|
959
|
+
strokeWidth: number;
|
|
960
|
+
strokeDash: number[];
|
|
961
|
+
fillColor: string;
|
|
962
|
+
fillOpacity: number;
|
|
963
|
+
}
|
|
964
|
+
/** Fill every {@link CollocationOptions} default (ADR-0063, #634). */
|
|
965
|
+
declare function resolveCollocationOptions(options?: CollocationOptions): ResolvedCollocationOptions;
|
|
966
|
+
/**
|
|
967
|
+
* The collocation scale (#633): the share of full size of the collocation's
|
|
968
|
+
* size ({@link resolveCollocationSize}). 1 when it is screen-sized or has no
|
|
969
|
+
* `maxPixels`, else `max(value / resolution, minPixels) / maxPixels`, capped
|
|
970
|
+
* at 1. Every member is drawn at that size, so they all shrink alike.
|
|
971
|
+
*/
|
|
972
|
+
/**
|
|
973
|
+
* A part's in-image strokes drawn in the leader style, as polylines in the
|
|
974
|
+
* layout's px. A leader that ends where the tick starts comes back joined to
|
|
975
|
+
* it as one polyline (location → tick root → spine), so the bend is a true
|
|
976
|
+
* join and its dashes run on through it. Without `withLeader` (a leader drawn
|
|
977
|
+
* elsewhere), only the tick.
|
|
978
|
+
*/
|
|
979
|
+
declare function collocationLeaderStrokes(part: Pick<CollocationPartLayout, "tick" | "leader">, withLeader?: boolean): PixelCoordinate[][];
|
|
980
|
+
declare function collocationScale(size: PointSymbolSize, resolution: number | undefined): number;
|
|
981
|
+
/** One member placed in its part. Pixel geometry is CSS px relative to the part's anchor point, y down. */
|
|
982
|
+
interface CollocationMemberLayout {
|
|
983
|
+
memberId: string;
|
|
984
|
+
part: CollocationPart;
|
|
985
|
+
render: ResolvedCollocationMemberRender;
|
|
986
|
+
highlight: boolean;
|
|
987
|
+
/** Display px per canonical unit: the member's effective size over its size reference. */
|
|
988
|
+
iconScale: number;
|
|
989
|
+
/** Where the icon's top-left (canonical 0, 0) is drawn. */
|
|
990
|
+
topLeft: PixelCoordinate;
|
|
991
|
+
/**
|
|
992
|
+
* The seam's `iconOffset` (ADR-0063, #639) for a member icon resource
|
|
993
|
+
* anchored at its top-left [0, 0], placed at the part's anchor point. In
|
|
994
|
+
* canonical resource units; for a resource anchored at canonical (ax, ay),
|
|
995
|
+
* add (ax, ay).
|
|
996
|
+
*/
|
|
997
|
+
iconOffset: [number, number];
|
|
998
|
+
box: PointSymbolRect;
|
|
999
|
+
extent: PointSymbolRect;
|
|
1000
|
+
registration: PixelCoordinate;
|
|
1001
|
+
attachment: PixelCoordinate;
|
|
1002
|
+
/** Engine-drawn Highlight casing around the box, when the capability can't draw Highlight. */
|
|
1003
|
+
highlightCasing?: PointSymbolRect;
|
|
1004
|
+
}
|
|
1005
|
+
/** One part (Staff or Bracket) laid out for one resolution. */
|
|
1006
|
+
interface CollocationPartLayout {
|
|
1007
|
+
part: CollocationPart;
|
|
1008
|
+
/**
|
|
1009
|
+
* `"default"`: at its default spot. `"screen-relative"` / `"ground"`: from
|
|
1010
|
+
* its part placement.
|
|
1011
|
+
*/
|
|
1012
|
+
mode: "default" | "screen-relative" | "ground";
|
|
1013
|
+
/** The ground point the part image and member icons are anchored at. */
|
|
1014
|
+
anchor: Position;
|
|
1015
|
+
/** CSS px from the anchor point to the part's registration (tick root or staff foot). */
|
|
1016
|
+
offset: PixelCoordinate;
|
|
1017
|
+
/**
|
|
1018
|
+
* CSS px from the anchor point to the point a screen-relative placement of
|
|
1019
|
+
* the part holds, which an editor turns into one: its registration, except
|
|
1020
|
+
* for an auto Bracket, where it is the members' middle (a ground placement
|
|
1021
|
+
* always holds the registration, {@link offset}). A screen-relative placement written from
|
|
1022
|
+
* it for an auto Bracket must record `side` (see
|
|
1023
|
+
* {@link CollocationBracketPlacement}), which marks it as holding that
|
|
1024
|
+
* middle; without `side` a placement holds the tick root.
|
|
1025
|
+
*/
|
|
1026
|
+
placedAt: PixelCoordinate;
|
|
1027
|
+
/**
|
|
1028
|
+
* CSS px a screen-relative Bracket placement was moved sideways to keep the
|
|
1029
|
+
* Bracket clear of a Staff standing on the location, as its default spot
|
|
1030
|
+
* is. Absent when it wasn't moved. An editor adds it (over the collocation
|
|
1031
|
+
* scale) to the placement's offset, so what it stores is what is drawn.
|
|
1032
|
+
*/
|
|
1033
|
+
staffClearance?: PixelCoordinate;
|
|
1034
|
+
/**
|
|
1035
|
+
* The side an auto Bracket stands on now (`bracket.side: "auto"` only).
|
|
1036
|
+
* Record it as the Bracket placement's `side`: the layout keeps a recorded
|
|
1037
|
+
* side, and a part drag turns it ({@link autoBracketSide}).
|
|
1038
|
+
*/
|
|
1039
|
+
side?: "left" | "top" | "bottom";
|
|
1040
|
+
/** Part line work as polylines, CSS px relative to the anchor point. */
|
|
1041
|
+
lines: PixelCoordinate[][];
|
|
1042
|
+
/** Width of {@link lines}: scaled, floored at 1 px. */
|
|
1043
|
+
lineWidth: number;
|
|
1044
|
+
/**
|
|
1045
|
+
* Width of {@link lines} in px at collocation scale 1, before flooring:
|
|
1046
|
+
* `line.strokeWidth` for the Bracket; `staff.strokeWidth` for the Staff, resolved to the
|
|
1047
|
+
* lowest flag's frame stroke for `"frame"`.
|
|
1048
|
+
*/
|
|
1049
|
+
baseLineWidth: number;
|
|
1050
|
+
/**
|
|
1051
|
+
* Color of {@link lines}: `line.strokeColor` for the Bracket; `staff.strokeColor` for
|
|
1052
|
+
* the Staff, resolved to the lowest flag's frame color for `"frame"`.
|
|
1053
|
+
*/
|
|
1054
|
+
lineColor: string;
|
|
1055
|
+
/**
|
|
1056
|
+
* The Bracket's tick, registration → spine, CSS px relative to the anchor:
|
|
1057
|
+
* part of the part image like {@link lines}, but stroked in the leader style
|
|
1058
|
+
* ({@link leaderWidth}, {@link leaderDash}, `leader.strokeColor`) since it carries
|
|
1059
|
+
* the leader into the Bracket. Absent while leaders are hidden.
|
|
1060
|
+
*/
|
|
1061
|
+
tick?: PixelCoordinate[];
|
|
1062
|
+
/**
|
|
1063
|
+
* Where a leader drawn as a separate line meets the tick: a ground
|
|
1064
|
+
* placement's tick root, CSS px relative to the anchor. The ground leader
|
|
1065
|
+
* and the in-image tick can't be one stroke, so the part image fills the
|
|
1066
|
+
* corner with a round joint, the leader's width across.
|
|
1067
|
+
*/
|
|
1068
|
+
joint?: PixelCoordinate;
|
|
1069
|
+
/**
|
|
1070
|
+
* The part's plate (`staff.plate`, `bracket.plate`) while shown: closed
|
|
1071
|
+
* rings, CSS px relative to the anchor, filled beneath the line work, with
|
|
1072
|
+
* its border's width scaled and floored at 1 px. Never hit area.
|
|
1073
|
+
*/
|
|
1074
|
+
plate?: {
|
|
1075
|
+
rings: PixelCoordinate[][];
|
|
1076
|
+
fillColor: string;
|
|
1077
|
+
fillOpacity: number;
|
|
1078
|
+
border?: {
|
|
1079
|
+
strokeColor: string;
|
|
1080
|
+
strokeWidth: number;
|
|
1081
|
+
};
|
|
1082
|
+
};
|
|
1083
|
+
/**
|
|
1084
|
+
* In-image leader, location → registration, CSS px: for a screen-relative
|
|
1085
|
+
* placement (through its `via` bend when it has one), and for a part at its
|
|
1086
|
+
* default spot off the location.
|
|
1087
|
+
*/
|
|
1088
|
+
leader?: PixelCoordinate[];
|
|
1089
|
+
/** Width of the in-image leader and tick: `leader.strokeWidth` scaled, floored at 1 px. */
|
|
1090
|
+
leaderWidth: number;
|
|
1091
|
+
/** Dash pattern of the in-image leader and tick, scaled like its width; `[]` is solid. */
|
|
1092
|
+
leaderDash: number[];
|
|
1093
|
+
/**
|
|
1094
|
+
* With `line.halo` shown: px the halo is wider than each line it backs
|
|
1095
|
+
* (`line.halo.strokeWidth`, scaled), so a line's halo is `lineWidth +
|
|
1096
|
+
* haloExtra` and the leader's `leaderWidth + haloExtra`.
|
|
1097
|
+
*/
|
|
1098
|
+
haloExtra?: number;
|
|
1099
|
+
/** With `line.halo` shown: its color. */
|
|
1100
|
+
haloColor?: string;
|
|
1101
|
+
/** Members in host order. */
|
|
1102
|
+
members: CollocationMemberLayout[];
|
|
1103
|
+
/** Bounds of the line work, tick and leader, stroke and halo included, CSS px relative to the anchor. */
|
|
1104
|
+
lineBounds?: PointSymbolRect;
|
|
1105
|
+
/** Pick shapes, CSS px relative to the anchor; ground marks are never hit area. */
|
|
1106
|
+
pick: {
|
|
1107
|
+
members: {
|
|
1108
|
+
memberId: string;
|
|
1109
|
+
rect: PointSymbolRect;
|
|
1110
|
+
}[]; /** Line work, tick and in-image leader; hit within the caller's tolerance plus half `lineWidth`. */
|
|
1111
|
+
lines: PixelCoordinate[][];
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
interface CollocationGroundMark<M extends string> {
|
|
1115
|
+
position: Position;
|
|
1116
|
+
mark: M;
|
|
1117
|
+
color: string;
|
|
1118
|
+
/** Diameter in CSS px, shrinking with the collocation scale. */
|
|
1119
|
+
size: number;
|
|
1120
|
+
/** Stroke width of rings and crosses: `line.strokeWidth`, scaled like {@link size}. */
|
|
1121
|
+
strokeWidth: number;
|
|
1122
|
+
/**
|
|
1123
|
+
* The mark's shape in CSS px around `position`, y down: for a ring (stroked,
|
|
1124
|
+
* white-filled) or a dot (filled) one closed circle whose first point is not
|
|
1125
|
+
* repeated, for a cross two strokes forming an upright `+`.
|
|
1126
|
+
*/
|
|
1127
|
+
paths: PixelCoordinate[][];
|
|
1128
|
+
}
|
|
1129
|
+
/** Ground features, each in its fixed draw order bottom to top (spread, ties, marks, leaders, location). */
|
|
1130
|
+
interface CollocationGroundLayout {
|
|
1131
|
+
/** Closed lon/lat ring, or undefined when there is none. */
|
|
1132
|
+
spread?: {
|
|
1133
|
+
ring: Position[];
|
|
1134
|
+
style: CollocationSpreadStyle;
|
|
1135
|
+
};
|
|
1136
|
+
ties: {
|
|
1137
|
+
memberId: string;
|
|
1138
|
+
coordinates: [Position, Position];
|
|
1139
|
+
color: string;
|
|
1140
|
+
width: number;
|
|
1141
|
+
dash: number[]; /** Drawn because the member is highlighted; draw in the Highlight appearance. */
|
|
1142
|
+
highlight: boolean;
|
|
1143
|
+
}[];
|
|
1144
|
+
memberPositions: (CollocationGroundMark<MemberMark> & {
|
|
1145
|
+
memberId: string;
|
|
1146
|
+
highlight: boolean;
|
|
1147
|
+
})[];
|
|
1148
|
+
leaders: {
|
|
1149
|
+
part: CollocationPart; /** Location → registration, through a Bracket placement's `via` bend when it has one. */
|
|
1150
|
+
coordinates: Position[];
|
|
1151
|
+
color: string; /** Unscaled line width, CSS px. */
|
|
1152
|
+
width: number; /** Unscaled dash pattern, CSS px; `[]` is solid. */
|
|
1153
|
+
dash: number[];
|
|
1154
|
+
/**
|
|
1155
|
+
* With `line.halo` shown: px the halo is wider than the leader
|
|
1156
|
+
* (`line.halo.strokeWidth`, unscaled like the leader), so its halo is
|
|
1157
|
+
* `width + haloExtra`.
|
|
1158
|
+
*/
|
|
1159
|
+
haloExtra?: number; /** With `line.halo` shown: its color. */
|
|
1160
|
+
haloColor?: string;
|
|
1161
|
+
}[];
|
|
1162
|
+
location?: CollocationGroundMark<LocationMark>;
|
|
1163
|
+
}
|
|
1164
|
+
/** The output of {@link layoutCollocation}. */
|
|
1165
|
+
interface CollocationLayout {
|
|
1166
|
+
/** Undefined when the collocation has no location: nothing is drawn or picked. */
|
|
1167
|
+
location?: Position;
|
|
1168
|
+
scale: number;
|
|
1169
|
+
options: ResolvedCollocationOptions;
|
|
1170
|
+
parts: {
|
|
1171
|
+
staff?: CollocationPartLayout;
|
|
1172
|
+
bracket?: CollocationPartLayout;
|
|
1173
|
+
};
|
|
1174
|
+
ground: CollocationGroundLayout;
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* The shared collocation layout (ADR-0063, #641): turns a
|
|
1178
|
+
* {@link CollocationRender} into each part's pixel geometry, pick shapes and
|
|
1179
|
+
* member placement, plus the ground marks and spread area, for one
|
|
1180
|
+
* resolution (Web Mercator m/px, the same the members size with).
|
|
1181
|
+
*
|
|
1182
|
+
* Pure: rendering, CPU picking and the map sheet all call it, and adapters
|
|
1183
|
+
* never lay out. Parts are screen-upright; all pixel geometry is CSS px at
|
|
1184
|
+
* the part's `anchor` point, y down. Ground output is lon/lat.
|
|
1185
|
+
*/
|
|
1186
|
+
declare function layoutCollocation(collocationRender: CollocationRender, resolution: number | undefined): CollocationLayout;
|
|
1187
|
+
/**
|
|
1188
|
+
* {@link layoutCollocation} of the collocation's {@link buildCollocationRender}
|
|
1189
|
+
* snapshot: the whole pipeline at one resolution, for callers that keep
|
|
1190
|
+
* neither.
|
|
1191
|
+
*/
|
|
1192
|
+
declare function buildCollocationLayout(collocation: Collocation, capabilities: CollocationMemberCapabilities, resolution: number | undefined, options?: BuildCollocationRenderOptions): CollocationLayout;
|
|
1193
|
+
//#endregion
|
|
772
1194
|
//#region src/tactical-draw/abort.d.ts
|
|
773
1195
|
/**
|
|
774
1196
|
* AbortPlumbing for the TacticalDraw façade.
|
|
@@ -818,57 +1240,53 @@ interface CombinedAbort {
|
|
|
818
1240
|
*/
|
|
819
1241
|
declare function combineWithHostSignal(hostSignal?: AbortSignal): CombinedAbort;
|
|
820
1242
|
//#endregion
|
|
821
|
-
//#region src/
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
*/
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
*/
|
|
862
|
-
declare function resetGroundSizeOptions(measure: Pick<ControlMeasure, "kind" | "options">, scale: Pick<MapAdapter, "getResolution">): ControlMeasure["options"] | undefined;
|
|
1243
|
+
//#region src/point-symbol-offset.d.ts
|
|
1244
|
+
/** Read-only layout needs forward projection only. Coordinates are CSS pixels. */
|
|
1245
|
+
type PointSymbolProjection = Pick<MapAdapter, "getPixelFromCoordinate" | "getBearing" | "getResolution">;
|
|
1246
|
+
/** Editing may also require inverse projection (notably ground placement). */
|
|
1247
|
+
type PointSymbolView = Pick<MapAdapter, "getPixelFromCoordinate" | "getCoordinateFromPixel" | "getBearing" | "getResolution">;
|
|
1248
|
+
interface PointSymbolOffsetLayout {
|
|
1249
|
+
/** Selected ordinary or detached body render, with canonical SVG dimensions. */
|
|
1250
|
+
render: PointSymbolRender;
|
|
1251
|
+
/** Selected body resource; dimensions and anchor remain in canonical SVG units. */
|
|
1252
|
+
resource: IconResource;
|
|
1253
|
+
/** Body opacity after applying the overall multiplier. */
|
|
1254
|
+
bodyOpacity: number;
|
|
1255
|
+
/** Clockwise radians in the projection plane. */
|
|
1256
|
+
rotation: number;
|
|
1257
|
+
actual: PixelCoordinate;
|
|
1258
|
+
/** Body registration, including natural HQ displacement in ordinary placement. */
|
|
1259
|
+
display: PixelCoordinate;
|
|
1260
|
+
/** Coordinate at which the chosen image's resource anchor is painted. */
|
|
1261
|
+
imageAnchor: PixelCoordinate;
|
|
1262
|
+
ordinaryDisplay: PixelCoordinate;
|
|
1263
|
+
attachment?: PixelCoordinate;
|
|
1264
|
+
junction?: PixelCoordinate;
|
|
1265
|
+
direction?: PixelCoordinate;
|
|
1266
|
+
path: PixelCoordinate[];
|
|
1267
|
+
kind: "ordinary" | "direct" | "indicator-only" | "with-extension";
|
|
1268
|
+
status: "ok" | "unsupported-presentation";
|
|
1269
|
+
scale: number;
|
|
1270
|
+
/** Resolved connector styling in CSS pixels. */
|
|
1271
|
+
connectorStyle: Required<PointSymbolOffsetStyle>;
|
|
1272
|
+
}
|
|
1273
|
+
/** Pure layout: projection input/output is in CSS pixels, including document contexts. */
|
|
1274
|
+
declare function resolvePointSymbolOffset(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolProjection): PointSymbolOffsetLayout | null;
|
|
1275
|
+
/** Set body placement without changing the authoritative coordinate. */
|
|
1276
|
+
declare function placePointSymbol(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, display: PixelCoordinate, mode?: PointSymbolPlacement["mode"]): PointSymbol;
|
|
1277
|
+
declare function convertPointSymbolPlacement(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, mode: PointSymbolPlacement["mode"]): PointSymbol;
|
|
1278
|
+
/** Explicit alignment, also used with hysteresis by pointer editing. */
|
|
1279
|
+
declare function alignPointSymbolIndicator(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView): PointSymbol;
|
|
1280
|
+
declare function movePointSymbolLocation(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, position: Position): PointSymbol;
|
|
1281
|
+
/** Canonical resource metadata shared by native adapters and external exporters. */
|
|
1282
|
+
declare function pointSymbolResource(render: PointSymbolRender): IconResource;
|
|
863
1283
|
/**
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
* (e.g. via a fragile key-name heuristic). Accepts the minimal `{ kind, options }`
|
|
869
|
-
* shape, mirroring [[measureUsesAdapterResolution]].
|
|
1284
|
+
* Convert a resolved CSS-pixel layout to output units (e.g. 25.4 / 96 for mm).
|
|
1285
|
+
* Scales positions, body scale, line width and dashes together, including the
|
|
1286
|
+
* already-resolved offset and padding. Canonical resources, direction, rotation
|
|
1287
|
+
* and opacity stay unchanged. Does not mutate the input or authored symbol.
|
|
870
1288
|
*/
|
|
871
|
-
declare function
|
|
1289
|
+
declare function scalePointSymbolLayout(layout: PointSymbolOffsetLayout, factor: number): PointSymbolOffsetLayout;
|
|
872
1290
|
//#endregion
|
|
873
1291
|
//#region src/tactical-draw/handles.d.ts
|
|
874
1292
|
/**
|
|
@@ -915,10 +1333,17 @@ interface InteractionStyle {
|
|
|
915
1333
|
rotateHandle?: HandleStyle;
|
|
916
1334
|
/** A Note's left and right edge-midpoint grips that change its width (ADR-0066). */
|
|
917
1335
|
widthHandle?: HandleStyle;
|
|
1336
|
+
/**
|
|
1337
|
+
* A hollow ring around a collocation's location mark while it is edited
|
|
1338
|
+
* (ADR-0063): the mark is the grip, so the ring shows it can be dragged
|
|
1339
|
+
* without covering it. `pointRadius` is a minimum; the ring grows to clear
|
|
1340
|
+
* a larger mark. Without a location mark, `vertexHandle` is drawn instead.
|
|
1341
|
+
*/
|
|
1342
|
+
locationRingHandle?: HandleStyle;
|
|
918
1343
|
boxOutline?: GuideStyle;
|
|
919
1344
|
/**
|
|
920
1345
|
* Line style for the passive, non-interactive selection highlight rendered
|
|
921
|
-
* by {@link TacticalDraw.
|
|
1346
|
+
* by {@link TacticalDraw.setPassiveOutlines}. A dashed, muted variant of
|
|
922
1347
|
* `boxOutline` so a locked/highlighted selection reads as visually distinct
|
|
923
1348
|
* from an active edit's oriented transform box. Delivered per-feature via
|
|
924
1349
|
* `properties.style` on the highlight outline `LineString`, resolved through
|
|
@@ -945,7 +1370,19 @@ interface InteractionStyle {
|
|
|
945
1370
|
* remove) but no midpoints or box, and the edit controller deletes the tapped
|
|
946
1371
|
* vertex instead of dragging it.
|
|
947
1372
|
*/
|
|
948
|
-
type EditMode = "reshape" | "transform" | "labeldrag" | "delete" | "offset"
|
|
1373
|
+
type EditMode = "reshape" | "transform" | "labeldrag" | "delete" | "offset" /** Collocations only: the location handle (ADR-0063). */ | "location" /** Collocations only: part drags (ADR-0063). */ | "parts" /** Collocations only, opt-in: drag a positioned collocation member's ground position. */ | "member-positions" /** Collocations only, opt-in: a grip on the Bracket's far edge that sets `bracket.columns` (#758). */ | "columns" /** Collocations only, opt-in: a corner on the Bracket that sets the collocation's `size` (#758). */ | "size"
|
|
1374
|
+
/**
|
|
1375
|
+
* Collocations only, opt-in: a grip where the leader meets the Bracket's
|
|
1376
|
+
* tick that bends the leader along the tick's line, writing the Bracket
|
|
1377
|
+
* placement's `via`.
|
|
1378
|
+
*/
|
|
1379
|
+
| "bend"
|
|
1380
|
+
/**
|
|
1381
|
+
* Collocations only, opt-in: drag a member's image to rearrange
|
|
1382
|
+
* the members or move it to the other part, or off the stack to hand its
|
|
1383
|
+
* removal to the host (#759).
|
|
1384
|
+
*/
|
|
1385
|
+
| "rearrange";
|
|
949
1386
|
//#endregion
|
|
950
1387
|
//#region src/tactical-draw/session-events.d.ts
|
|
951
1388
|
/** A gesture's phase within a stream of {@link TransientChangeEvent}s. */
|
|
@@ -987,7 +1424,13 @@ interface TransientChangeEvent {
|
|
|
987
1424
|
type SettleReason = "close" | "error" | TacticalDrawAbortReason;
|
|
988
1425
|
//#endregion
|
|
989
1426
|
//#region src/tactical-draw/session-history.d.ts
|
|
990
|
-
|
|
1427
|
+
/**
|
|
1428
|
+
* Why a session's working graphic changed. A collocation edit reports its
|
|
1429
|
+
* gestures as `"part-drag"`, `"location-move"`, `"member-drag"`,
|
|
1430
|
+
* `"columns-drag"`, `"size-drag"`, `"bend-drag"` and `"reorder-drag"`
|
|
1431
|
+
* (ADR-0063) instead of `"gesture"`.
|
|
1432
|
+
*/
|
|
1433
|
+
type SessionChangeSource = "gesture" | "undo" | "redo" | "programmatic" | "part-drag" | "location-move" | "member-drag" | "columns-drag" | "size-drag" | "bend-drag" | "reorder-drag";
|
|
991
1434
|
interface SessionHistoryState {
|
|
992
1435
|
readonly canUndo: boolean;
|
|
993
1436
|
readonly canRedo: boolean;
|
|
@@ -1002,202 +1445,900 @@ interface SessionHistory {
|
|
|
1002
1445
|
subscribe(listener: (state: SessionHistoryState) => void): () => void;
|
|
1003
1446
|
}
|
|
1004
1447
|
//#endregion
|
|
1005
|
-
//#region src/tactical-draw/edit-session.d.ts
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1448
|
+
//#region src/tactical-draw/graphic-edit-session.d.ts
|
|
1449
|
+
interface PointSymbolOffsetControls {
|
|
1450
|
+
readonly layout: PointSymbolOffsetLayout | null;
|
|
1451
|
+
readonly connectors: readonly PointSymbolConnector[];
|
|
1452
|
+
setPlacement(mode: PointSymbolPlacement["mode"]): void;
|
|
1453
|
+
setConnector(connector: PointSymbolConnector): void;
|
|
1454
|
+
align(): void;
|
|
1455
|
+
reset(): void;
|
|
1456
|
+
}
|
|
1457
|
+
interface GraphicEditChangeEvent<G extends Graphic = Graphic> {
|
|
1458
|
+
readonly source: SessionChangeSource;
|
|
1459
|
+
readonly graphic: GraphicSnapshot<G>;
|
|
1460
|
+
readonly previous: GraphicSnapshot<G>;
|
|
1461
|
+
readonly session: GraphicEditSession<G>;
|
|
1462
|
+
reject(): void;
|
|
1463
|
+
close(): void;
|
|
1464
|
+
abort(): void;
|
|
1465
|
+
}
|
|
1466
|
+
/** Common selection/editing contract shared by control measures and point symbols. */
|
|
1467
|
+
interface GraphicEditSession<G extends Graphic = Graphic> {
|
|
1017
1468
|
readonly history: SessionHistory;
|
|
1469
|
+
/** Present on point-symbol sessions; all commands participate in session history. */
|
|
1470
|
+
readonly offset?: PointSymbolOffsetControls;
|
|
1018
1471
|
/** Immutable edit-start input. */
|
|
1019
|
-
readonly graphic:
|
|
1020
|
-
/**
|
|
1021
|
-
|
|
1022
|
-
* metadata, e.g. `standardIdentity`/`colorMode`) is session-owned like every
|
|
1023
|
-
* other working field: it starts at the edit-start value, is replaced
|
|
1024
|
-
* wholesale by [[updateGraphic]], survives every subsequent gesture/setter
|
|
1025
|
-
* call and in-session undo/redo, and is rolled back by `event.reject()`
|
|
1026
|
-
* (issue #354). Absent when the edit-start measure carried none and
|
|
1027
|
-
* [[updateGraphic]] has not set any since.
|
|
1028
|
-
*/
|
|
1029
|
-
readonly workingGraphic: ControlMeasure;
|
|
1030
|
-
/** Live working state. Copy on read. */
|
|
1031
|
-
readonly controlPoints: readonly Position[];
|
|
1032
|
-
/** Live working options. Copy on read. */
|
|
1033
|
-
readonly options: ControlMeasure["options"];
|
|
1034
|
-
/** Live working style. Copy on read. */
|
|
1035
|
-
readonly style: ControlMeasureStyle | undefined;
|
|
1036
|
-
/**
|
|
1037
|
-
* Live working text amplifiers (MIL-STD-2525E Appendix L Table L-II). Copy
|
|
1038
|
-
* on read. `undefined` when the edit-start measure carried none and none
|
|
1039
|
-
* have been set since. Keys are stored as given — canonicalisation to
|
|
1040
|
-
* doctrinal field codes happens in the core render seam, not here.
|
|
1041
|
-
*/
|
|
1042
|
-
readonly textAmplifiers: TextAmplifiers | undefined;
|
|
1043
|
-
/** Live user-adjusted anchors for individually rendered text amplifiers. */
|
|
1044
|
-
readonly amplifierPlacements: AmplifierPlacements | undefined;
|
|
1045
|
-
/** `true` after the first working-copy mutation; back to `false` within tolerance. */
|
|
1472
|
+
readonly graphic: G;
|
|
1473
|
+
/** Live working graphic. Copy on read. */
|
|
1474
|
+
readonly workingGraphic: G;
|
|
1046
1475
|
readonly dirty: boolean;
|
|
1047
1476
|
readonly modes: readonly EditMode[];
|
|
1477
|
+
close(): GraphicSnapshot<G> | undefined;
|
|
1478
|
+
abort(): void;
|
|
1479
|
+
setModes(modes: readonly EditMode[]): void;
|
|
1480
|
+
/** Atomically replace any part of the live working graphic. */
|
|
1481
|
+
updateGraphic(updater: (graphic: G) => G): void;
|
|
1482
|
+
onChange(listener: (event: GraphicEditChangeEvent<G>) => void): () => void;
|
|
1483
|
+
onCommit(handler: (snapshot: GraphicSnapshot<G>) => void): () => void;
|
|
1484
|
+
onSettled(handler: (reason: SettleReason) => void): () => void;
|
|
1048
1485
|
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1486
|
+
* Present on point-symbol sessions: the continuous stream of a drag, for a
|
|
1487
|
+
* host that follows the symbol while it moves (a range ring, a viewshed).
|
|
1488
|
+
* `start` fires on the first move of a gesture, `move` on each one after,
|
|
1489
|
+
* and `end` exactly once per started gesture, before that gesture's
|
|
1490
|
+
* [[onChange]], or when the session settles mid-gesture. `points` holds the
|
|
1491
|
+
* one live position; `pointIndex` is `null`. A body, location or pin drag
|
|
1492
|
+
* moves it; a rotate or scale streams it unchanged. Returns an unsubscribe
|
|
1493
|
+
* function; registering after the session has settled returns a no-op.
|
|
1053
1494
|
*/
|
|
1054
|
-
|
|
1495
|
+
onTransientChange?(listener: (event: TransientChangeEvent) => void): () => void;
|
|
1496
|
+
}
|
|
1497
|
+
//#endregion
|
|
1498
|
+
//#region src/tactical-draw/snapping.d.ts
|
|
1499
|
+
type SnapInteraction = "draw" | "reshape" | "translate" | "label-drag";
|
|
1500
|
+
interface SnapCandidateRequest {
|
|
1501
|
+
coordinate: Position;
|
|
1502
|
+
pixel: PixelCoordinate;
|
|
1503
|
+
interaction: SnapInteraction;
|
|
1504
|
+
graphicId?: string;
|
|
1055
1505
|
/**
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* Arrow's selected flow (ADR-0065): the part most recently added to
|
|
1059
|
-
* [[selectedParts]]. Hosts read it to edit the part's own settings. Starts
|
|
1060
|
-
* at `0`; pressing a point or midpoint, or clicking the graphic's body,
|
|
1061
|
-
* selects the part under the pointer alone, and an edit or undo that removes
|
|
1062
|
-
* the selected part falls back to `0`. Dragging a point or midpoint of a part
|
|
1063
|
-
* that is already selected keeps the selection; a click on it without a drag
|
|
1064
|
-
* selects it alone. `undefined` for graphics without parts.
|
|
1506
|
+
* Every graphic a multi-selection moves together; candidates of any of them
|
|
1507
|
+
* are skipped, so the group never snaps onto itself. Set instead of `graphicId`.
|
|
1065
1508
|
*/
|
|
1066
|
-
readonly
|
|
1509
|
+
graphicIds?: readonly string[];
|
|
1510
|
+
controlPointIndex?: number;
|
|
1511
|
+
originalEvent?: unknown;
|
|
1512
|
+
}
|
|
1513
|
+
interface SnapCandidate {
|
|
1514
|
+
id: string;
|
|
1515
|
+
coordinate: Position;
|
|
1516
|
+
kind: string;
|
|
1517
|
+
graphicId?: string;
|
|
1518
|
+
controlPointIndex?: number;
|
|
1519
|
+
priority?: number;
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Host snap candidates near `request`. A provider that leaves out the moving
|
|
1523
|
+
* graphic's own candidates should check `request.graphicIds` (a multi-selection)
|
|
1524
|
+
* as well as `request.graphicId`. A move or scale that tests several
|
|
1525
|
+
* points of a graphic (a control measure's control points, a Note's or an
|
|
1526
|
+
* Image's corners and centre) asks once per tested point on each pointer move,
|
|
1527
|
+
* so keep it cheap: return only candidates near `request.pixel`.
|
|
1528
|
+
*/
|
|
1529
|
+
type SnapCandidateProvider = (request: SnapCandidateRequest) => readonly SnapCandidate[];
|
|
1530
|
+
/**
|
|
1531
|
+
* A snap the host answers later, such as one to terrain it has to sample
|
|
1532
|
+
* first. Asked on every reshape and translate move of a control-measure edit,
|
|
1533
|
+
* at the position the other sources snapped it to (for a translate, the moved
|
|
1534
|
+
* first control point). Return `null` to have no say in this move, and the
|
|
1535
|
+
* drag follows the pointer at once; otherwise the drag holds where it was
|
|
1536
|
+
* until the promise settles, then lands at the position it resolves to, or at
|
|
1537
|
+
* the pointer for `null`. An answer lands unless a later move's landed first,
|
|
1538
|
+
* so a drag keeps up while answers are slow. A release waits for the answer
|
|
1539
|
+
* to where it was let go before committing, so the gesture is still one
|
|
1540
|
+
* change. `signal` aborts once the drag is over or the edit settles.
|
|
1541
|
+
*
|
|
1542
|
+
* The host decides how far it reaches: neither `enabled` nor
|
|
1543
|
+
* `tolerancePixels` applies. `bypass` does.
|
|
1544
|
+
*/
|
|
1545
|
+
type DeferredSnapProvider = (request: SnapCandidateRequest, signal: AbortSignal) => Promise<Position | null> | null;
|
|
1546
|
+
interface SnapResult {
|
|
1547
|
+
coordinate: Position;
|
|
1548
|
+
pixel: PixelCoordinate;
|
|
1549
|
+
candidate: SnapCandidate;
|
|
1550
|
+
distancePixels: number;
|
|
1551
|
+
}
|
|
1552
|
+
interface GraphicGeometrySnappingOptions {
|
|
1553
|
+
/** Snap to the nearest point along generated linework and polygon boundaries. Default `true`. */
|
|
1554
|
+
edges?: boolean;
|
|
1555
|
+
/** Snap to generated geometry vertices. Default `false`. */
|
|
1556
|
+
vertices?: boolean;
|
|
1557
|
+
}
|
|
1558
|
+
interface SnappingOptions {
|
|
1559
|
+
enabled?: boolean;
|
|
1560
|
+
tolerancePixels?: number;
|
|
1561
|
+
sources?: {
|
|
1562
|
+
graphics?: boolean;
|
|
1563
|
+
/**
|
|
1564
|
+
* Snap to generated control-measure geometry. `true` enables edges with
|
|
1565
|
+
* vertices disabled; pass an object to select either candidate type.
|
|
1566
|
+
* Text/label point features and the active graphic are excluded.
|
|
1567
|
+
*/
|
|
1568
|
+
graphicGeometry?: boolean | GraphicGeometrySnappingOptions;
|
|
1569
|
+
external?: SnapCandidateProvider;
|
|
1570
|
+
deferred?: DeferredSnapProvider;
|
|
1571
|
+
};
|
|
1572
|
+
bypass?: (originalEvent: unknown) => boolean;
|
|
1573
|
+
/** Called for each resolution attempt; `null` clears a host-rendered indicator. */
|
|
1574
|
+
onSnap?: (result: SnapResult | null) => void;
|
|
1575
|
+
}
|
|
1576
|
+
/** The closest of several snap tests: the request that won, and its snap. */
|
|
1577
|
+
interface ClosestSnap {
|
|
1578
|
+
request: SnapCandidateRequest;
|
|
1579
|
+
result: SnapResult;
|
|
1580
|
+
}
|
|
1581
|
+
/** Internal controller seam supplied by the TacticalDraw façade. */
|
|
1582
|
+
interface SnapResolver {
|
|
1583
|
+
/** Snap one point, reporting the result through `onSnap`. */
|
|
1584
|
+
(request: SnapCandidateRequest): SnapResult | null;
|
|
1067
1585
|
/**
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
* part
|
|
1073
|
-
*
|
|
1586
|
+
* Test several points of one graphic, such as a box's corners and centre,
|
|
1587
|
+
* and report only the closest snap through `onSnap`, so the host's
|
|
1588
|
+
* indicator shows the winner rather than whichever point was tested last.
|
|
1589
|
+
* With `cursor`, the snap whose target is nearest the cursor wins, so the
|
|
1590
|
+
* part of the graphic being dragged near snaps before a far one; without it,
|
|
1591
|
+
* the shortest snap does. Points snapping to the same target, equally near
|
|
1592
|
+
* the cursor, go to the shortest snap; other ties to the earlier request.
|
|
1074
1593
|
*/
|
|
1075
|
-
|
|
1594
|
+
closest(requests: readonly SnapCandidateRequest[], cursor?: PixelCoordinate): ClosestSnap | null;
|
|
1595
|
+
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/tactical-draw/collocation-edit-controller.d.ts
|
|
1598
|
+
/**
|
|
1599
|
+
* Part commands on a collocation edit session (ADR-0063), mirroring
|
|
1600
|
+
* `session.offset` on point symbols. Both take part in session history.
|
|
1601
|
+
*/
|
|
1602
|
+
interface CollocationPartControls {
|
|
1603
|
+
/**
|
|
1604
|
+
* Hold `part` as a ground or screen-relative part placement without moving
|
|
1605
|
+
* it on screen. A no-op for a part with no members or a collocation with no
|
|
1606
|
+
* location.
|
|
1607
|
+
*/
|
|
1608
|
+
setPlacement(part: CollocationPart, mode: PointSymbolPlacement["mode"]): void;
|
|
1609
|
+
/** Return `part` to its default spot. No collocation member moves. */
|
|
1610
|
+
reset(part: CollocationPart): void;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* One tick of a collocation location move (#755) or member drag. `points`
|
|
1614
|
+
* holds the live location and `pointIndex` is `null`, as for a point symbol;
|
|
1615
|
+
* `members` holds each positioned member's live position, so a host can keep
|
|
1616
|
+
* per-member analyses following the drag.
|
|
1617
|
+
*/
|
|
1618
|
+
interface CollocationTransientChangeEvent extends TransientChangeEvent {
|
|
1619
|
+
readonly members: readonly {
|
|
1620
|
+
readonly memberId: string;
|
|
1621
|
+
readonly position: Position;
|
|
1622
|
+
}[];
|
|
1623
|
+
}
|
|
1624
|
+
/** A collocation edit step: the change source, its history label and what it changed. */
|
|
1625
|
+
interface CollocationCommit {
|
|
1626
|
+
source: SessionChangeSource;
|
|
1627
|
+
/** The step's history label, as `history.state.undoLabel` shows it. */
|
|
1628
|
+
label: string;
|
|
1629
|
+
changes: CollocationCommitChanges;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* A collocation edit's change event. `commit` says what the step changed
|
|
1633
|
+
* relative to `previous`; for an undo or redo, what that step changed back
|
|
1634
|
+
* or again, under the undone or redone step's label.
|
|
1635
|
+
*/
|
|
1636
|
+
interface CollocationEditChangeEvent extends GraphicEditChangeEvent<Collocation> {
|
|
1637
|
+
readonly commit: CollocationCommit;
|
|
1638
|
+
readonly session: CollocationEditSession;
|
|
1639
|
+
}
|
|
1640
|
+
/** The session of a single collocation edit. */
|
|
1641
|
+
interface CollocationEditSession extends GraphicEditSession<Collocation> {
|
|
1642
|
+
readonly parts: CollocationPartControls;
|
|
1643
|
+
onChange(listener: (event: CollocationEditChangeEvent) => void): () => void;
|
|
1644
|
+
/**
|
|
1645
|
+
* The continuous stream of a location move or member drag: `start` on its
|
|
1646
|
+
* first move, `move` on each one after, and `end` exactly once per started
|
|
1647
|
+
* move, before its `onChange`, or when the session settles mid-move. Part
|
|
1648
|
+
* drags move no member and don't stream. Returns an unsubscribe function; registering
|
|
1649
|
+
* after the session has settled returns a no-op.
|
|
1650
|
+
*/
|
|
1651
|
+
onTransientChange(listener: (event: CollocationTransientChangeEvent) => void): () => void;
|
|
1652
|
+
/** How a dragged part is stored: `EditOptions.partDrag`, or the last {@link setPartDrag}. */
|
|
1653
|
+
readonly partDrag: CollocationPartDrag;
|
|
1654
|
+
/** Change how parts dragged from now on are stored; a no-op once settled. */
|
|
1655
|
+
setPartDrag(partDrag: CollocationPartDrag): void;
|
|
1656
|
+
}
|
|
1657
|
+
interface CollocationEditControllerOptions {
|
|
1658
|
+
adapter: MapAdapter;
|
|
1659
|
+
capabilities: CollocationMemberCapabilities;
|
|
1660
|
+
collocation: Collocation;
|
|
1661
|
+
graphicsLayer: LayerId;
|
|
1662
|
+
previewLayer: LayerId;
|
|
1663
|
+
handlesLayer: LayerId;
|
|
1664
|
+
signal?: AbortSignal;
|
|
1665
|
+
closeOnClickAway?: boolean;
|
|
1666
|
+
modes?: readonly EditMode[];
|
|
1667
|
+
interactionStyle?: InteractionStyle;
|
|
1668
|
+
onSession?: (session: CollocationEditSession) => void;
|
|
1669
|
+
handleIdPrefix: string;
|
|
1670
|
+
settleToGraphics: (collocation?: Collocation) => void;
|
|
1671
|
+
publishWorkingGraphic: (group: FeatureGroup) => void;
|
|
1672
|
+
wasOnGraphicsLayer: boolean;
|
|
1673
|
+
onSettled?: () => void;
|
|
1674
|
+
onClickAwayGraphicsPick?: (event: PickEvent) => void;
|
|
1675
|
+
/** The façade's live Highlight appearance. */
|
|
1676
|
+
highlight: () => HighlightAppearance | undefined;
|
|
1677
|
+
/** The host's ground-move rule (`transformCollocation` by default). */
|
|
1678
|
+
resolveTransform: ResolveCollocationTransform;
|
|
1679
|
+
snap?: SnapResolver;
|
|
1680
|
+
deferredSnap?: DeferredSnapProvider;
|
|
1681
|
+
/** Called after every repaint of the working collocation, previews included. */
|
|
1682
|
+
onRepaint?: () => void;
|
|
1683
|
+
/**
|
|
1684
|
+
* The host's removal of a member a `"rearrange"` drag dropped well clear of
|
|
1685
|
+
* both parts (#759). Without it such a drop changes nothing.
|
|
1686
|
+
*/
|
|
1687
|
+
onRemoveMember?: (memberId: string) => void;
|
|
1688
|
+
/** How a dragged part is stored; default `"keep"`. */
|
|
1689
|
+
partDrag?: CollocationPartDrag;
|
|
1690
|
+
/** `EditOptions.screenRelativeReach`; default {@link COLLOCATION_SCREEN_RELATIVE_REACH}. */
|
|
1691
|
+
screenRelativeReach?: number;
|
|
1692
|
+
}
|
|
1693
|
+
interface CollocationEditHandle {
|
|
1694
|
+
readonly promise: Promise<GraphicSnapshot<Collocation>>;
|
|
1695
|
+
readonly settled: boolean;
|
|
1696
|
+
readonly usesGraphicStack: boolean;
|
|
1697
|
+
readonly measureId: string;
|
|
1698
|
+
readonly graphicKind: "collocation";
|
|
1699
|
+
/** The live working collocation, previews included. Copy on read. */
|
|
1700
|
+
readonly workingGraphic: Collocation;
|
|
1701
|
+
refreshPresentation(): void;
|
|
1702
|
+
abort(reason: TacticalDrawAbortReason, cause?: unknown): void;
|
|
1703
|
+
syncHostMembership(present: boolean): void;
|
|
1076
1704
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
* from `EditOptions.sizeAnchor` and mutated by [[setSizeAnchor]].
|
|
1705
|
+
* Whether a pick on the edited collocation still reaches the host: a click
|
|
1706
|
+
* on a member or part (#629 §2), unless this pointer cycle was a drag.
|
|
1080
1707
|
*/
|
|
1081
|
-
|
|
1708
|
+
passesPick(event: PickEvent): boolean;
|
|
1709
|
+
/** The layout of the last repaint, previews included; `null` before the first. */
|
|
1710
|
+
readonly layout: CollocationLayout | null;
|
|
1711
|
+
}
|
|
1712
|
+
/** Whether an active edit handle is a collocation edit. */
|
|
1713
|
+
declare function isCollocationEditHandle(handle: object | null): handle is CollocationEditHandle;
|
|
1714
|
+
/**
|
|
1715
|
+
* Default `["location", "parts"]`; `"member-positions"`, `"columns"`,
|
|
1716
|
+
* `"size"`, `"bend"` and `"rearrange"` are opt-in and `[]` locks everything.
|
|
1717
|
+
* Any other mode throws.
|
|
1718
|
+
*/
|
|
1719
|
+
declare function normaliseCollocationModes(input?: readonly EditMode[]): readonly EditMode[];
|
|
1720
|
+
/**
|
|
1721
|
+
* A single collocation edit (ADR-0063, "Gestures and pick result"): part
|
|
1722
|
+
* drags (a plain drag on a member, a part's lines or its leader), a
|
|
1723
|
+
* location handle and, opt-in, a handle on each positioned member's ground
|
|
1724
|
+
* position. No transform box. A location move runs the host's
|
|
1725
|
+
* `resolveTransform` on every preview move and at commit, then rewrites each
|
|
1726
|
+
* part's placement so its registration keeps its screen position.
|
|
1727
|
+
*/
|
|
1728
|
+
declare function runCollocationEdit(opts: CollocationEditControllerOptions): CollocationEditHandle;
|
|
1729
|
+
//#endregion
|
|
1730
|
+
//#region src/tactical-draw/transform-box.d.ts
|
|
1731
|
+
/**
|
|
1732
|
+
* The Excalidraw/Felt-style transform box: the oriented bounding box drawn
|
|
1733
|
+
* around a selection, with 4 corner scale handles, a rotate grip above the
|
|
1734
|
+
* top edge, and drag-anywhere-inside-the-box translate. This module is the
|
|
1735
|
+
* single source of truth for box *placement* (`fitTransformBox`,
|
|
1736
|
+
* `boxCorners`, `rotateGripPixel`) AND box *picking* (`pointInBox`,
|
|
1737
|
+
* `pickBoxHandle`) — mirroring the ADR-0016 discipline that keeps
|
|
1738
|
+
* `handles.ts` owning vertex/midpoint placement/pick. Everything here is pure
|
|
1739
|
+
* pixel-space math: no projection, no rendering, no session state.
|
|
1740
|
+
*
|
|
1741
|
+
* **Angle convention**: `angle` is in radians, measured in screen pixel space
|
|
1742
|
+
* (y grows downward). A positive angle rotates the box clockwise as drawn on
|
|
1743
|
+
* screen — the same convention `rotatePointsAround` (`handle-drag.ts`) uses,
|
|
1744
|
+
* so box rotation and control-point rotation stay in lockstep.
|
|
1745
|
+
*
|
|
1746
|
+
* **Corner ordering**: `boxCorners` always returns
|
|
1747
|
+
* `[topLeft, topRight, bottomRight, bottomLeft]` in the box's own (unrotated)
|
|
1748
|
+
* local frame, then rotated into place. "Top" means the smaller-y edge before
|
|
1749
|
+
* rotation — i.e. the edge the rotate grip floats above. The order is stable
|
|
1750
|
+
* across calls so a scale handle's `index` (0–3) always means the same
|
|
1751
|
+
* corner, and its opposite corner is always `(index + 2) % 4`.
|
|
1752
|
+
*/
|
|
1753
|
+
interface TransformBox {
|
|
1754
|
+
/** Box center, pixel space. */
|
|
1755
|
+
center: PixelCoordinate;
|
|
1756
|
+
/** Half-width along the box's local x-axis (pre-rotation), in pixels. */
|
|
1757
|
+
halfWidth: number;
|
|
1758
|
+
/** Half-height along the box's local y-axis (pre-rotation), in pixels. */
|
|
1759
|
+
halfHeight: number;
|
|
1760
|
+
/** Radians, screen space, positive = clockwise on screen. */
|
|
1761
|
+
angle: number;
|
|
1762
|
+
}
|
|
1763
|
+
//#endregion
|
|
1764
|
+
//#region src/tactical-draw/collocation-rendering.d.ts
|
|
1765
|
+
interface CollocationGroupRender {
|
|
1766
|
+
features: Feature[];
|
|
1767
|
+
iconResources: IconResource[];
|
|
1768
|
+
/** The input snapshot the group was drawn from. */
|
|
1769
|
+
render: CollocationRender;
|
|
1770
|
+
layout: CollocationLayout;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Draw a collocation as the contents of one atomic feature group (ADR-0063,
|
|
1774
|
+
* "The MapAdapter seam"), in canonical order: ground marks and ground leaders
|
|
1775
|
+
* (never hit area), one SVG line-work image per part, then each member as an
|
|
1776
|
+
* icon placed through the seam's icon pixel offset. Every pixel measure comes
|
|
1777
|
+
* from the shared layout; nothing here reads the camera beyond `resolution`.
|
|
1778
|
+
*
|
|
1779
|
+
* Zoom changes numbers, not images (ADR-0063 amendments): part line work is
|
|
1780
|
+
* drawn at collocation scale 1 and shown at the collocation scale through the
|
|
1781
|
+
* feature's `iconScale`, and member icons keep their resources, so a
|
|
1782
|
+
* resolution re-render of a ground-sized collocation mints no new image. When
|
|
1783
|
+
* its size has a `maxPixels` cap, every icon feature also carries the native
|
|
1784
|
+
* ground-size fields, so an engine that scales ground-sized point symbols
|
|
1785
|
+
* natively tracks zoom animations itself.
|
|
1786
|
+
*/
|
|
1787
|
+
declare function renderCollocationGroup(collocation: Collocation, capabilities: CollocationMemberCapabilities, options: {
|
|
1788
|
+
resolution: number | undefined;
|
|
1789
|
+
highlight?: HighlightAppearance;
|
|
1790
|
+
/**
|
|
1791
|
+
* While a part or the location is dragged: draw screen-relative leaders as
|
|
1792
|
+
* ground lines through the current view instead of baking them into the
|
|
1793
|
+
* part image, so the images (and their resources) hold still mid-drag.
|
|
1794
|
+
*/
|
|
1795
|
+
liveLeaders?: LiveLeaderView;
|
|
1796
|
+
/**
|
|
1797
|
+
* A member laid out but not drawn, image or Highlight casing: its slot
|
|
1798
|
+
* stays empty, as while it is dragged to rearrange the collocation (#759)
|
|
1799
|
+
* or several are dropped into it (#760). Its ground position mark and tie
|
|
1800
|
+
* still draw.
|
|
1801
|
+
*/
|
|
1802
|
+
hiddenMembers?: readonly string[];
|
|
1803
|
+
}): CollocationGroupRender;
|
|
1804
|
+
/** The view a live leader is drawn through. */
|
|
1805
|
+
interface LiveLeaderView {
|
|
1806
|
+
toPixel(position: Position): PixelCoordinate | null;
|
|
1807
|
+
fromPixel(pixel: PixelCoordinate): Position | null;
|
|
1808
|
+
}
|
|
1809
|
+
/** The pick result a collocation feature reports, read from its properties. */
|
|
1810
|
+
declare function collocationPickTarget(feature: Feature): {
|
|
1811
|
+
part: CollocationPart;
|
|
1812
|
+
memberId?: string;
|
|
1813
|
+
} | undefined;
|
|
1814
|
+
/**
|
|
1815
|
+
* One collocation member's outline (ADR-0063): a screen-aligned box around
|
|
1816
|
+
* its extent in its part, padded by `padding`, and a ring at its ground
|
|
1817
|
+
* position, each a `LineString` in `style` with `properties` added. Drawn by
|
|
1818
|
+
* passive member outlines and by an edit's member link. `[]` while the member
|
|
1819
|
+
* isn't drawn or its box doesn't project; the ring is left out when the
|
|
1820
|
+
* member has no position or the ring doesn't project.
|
|
1821
|
+
*/
|
|
1822
|
+
declare function collocationMemberOutlineFeatures(collocation: Collocation, layout: CollocationLayout, memberId: string, view: {
|
|
1823
|
+
toPixel: (position: Position) => PixelCoordinate | null;
|
|
1824
|
+
fromPixel: (pixel: PixelCoordinate) => Position | null | undefined;
|
|
1825
|
+
}, options: {
|
|
1826
|
+
featureId: string;
|
|
1827
|
+
padding: number;
|
|
1828
|
+
style?: GuideStyle;
|
|
1829
|
+
properties?: Record<string, unknown>;
|
|
1830
|
+
}): Feature[];
|
|
1831
|
+
/**
|
|
1832
|
+
* The screen pixels a laid-out collocation covers: each part's line work and
|
|
1833
|
+
* member extents, and its ground marks, ties, leaders and spread area. Fits
|
|
1834
|
+
* transform boxes and passive outlines around the whole collocation.
|
|
1835
|
+
*/
|
|
1836
|
+
declare function collocationFootprintPixels(layout: CollocationLayout, toPixel: (position: Position) => PixelCoordinate | null): PixelCoordinate[];
|
|
1837
|
+
/** A screen rectangle of a collocation footprint: upright, so `box.angle` is 0. */
|
|
1838
|
+
interface CollocationFootprintRect {
|
|
1839
|
+
box: TransformBox;
|
|
1840
|
+
corners: PixelCoordinate[];
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Where a collocation is on screen (#755), in the box-and-corners shape of
|
|
1844
|
+
* `pointSymbolFootprint` and the other footprints. Parts stay upright, so
|
|
1845
|
+
* every box has `angle` 0.
|
|
1846
|
+
*/
|
|
1847
|
+
interface CollocationFootprint extends CollocationFootprintRect {
|
|
1848
|
+
/** The location on screen. */
|
|
1849
|
+
location: PixelCoordinate;
|
|
1850
|
+
/** Each part's line work, leader and members. */
|
|
1851
|
+
parts: (CollocationFootprintRect & {
|
|
1852
|
+
part: CollocationPart;
|
|
1853
|
+
})[];
|
|
1854
|
+
/** Each drawn member's extent, labels included: the area a click picks it by. */
|
|
1855
|
+
members: (CollocationFootprintRect & {
|
|
1856
|
+
memberId: string;
|
|
1857
|
+
part: CollocationPart;
|
|
1858
|
+
})[];
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* A collocation's screen footprint for host hit tests (marquee, lasso,
|
|
1862
|
+
* context menus, fit to selection): the location, a rectangle per part and
|
|
1863
|
+
* per drawn member, and the box around everything it draws, ground marks
|
|
1864
|
+
* included. Pass the capabilities TacticalDraw was given, so members lay out
|
|
1865
|
+
* as they are drawn. `null` when the collocation has no location or its
|
|
1866
|
+
* location doesn't project.
|
|
1867
|
+
*/
|
|
1868
|
+
declare function collocationFootprint(collocation: Collocation, capabilities: CollocationMemberCapabilities, view: PointSymbolProjection, options?: BuildCollocationRenderOptions): CollocationFootprint | null;
|
|
1869
|
+
//#endregion
|
|
1870
|
+
//#region src/collocation-reorder.d.ts
|
|
1871
|
+
/**
|
|
1872
|
+
* Where a member dragged to rearrange the collocation (#759) lands: `index`
|
|
1873
|
+
* counts the other members of `part`, in host order, that it goes before.
|
|
1874
|
+
*/
|
|
1875
|
+
interface CollocationDropSlot {
|
|
1876
|
+
part: CollocationPart;
|
|
1877
|
+
index: number;
|
|
1878
|
+
}
|
|
1879
|
+
/** A drop slot, or the removal cue of a member dragged well clear of both parts. */
|
|
1880
|
+
type CollocationDropTarget = CollocationDropSlot | {
|
|
1881
|
+
remove: true;
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* CSS px a dragged member must be from every part's members before its drop
|
|
1885
|
+
* reads as a removal.
|
|
1886
|
+
*/
|
|
1887
|
+
declare const COLLOCATION_REMOVE_DISTANCE = 48;
|
|
1888
|
+
interface CollocationDropTargetOptions {
|
|
1082
1889
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1890
|
+
* Px from both parts at which a drop reads as a removal; default
|
|
1891
|
+
* {@link COLLOCATION_REMOVE_DISTANCE}. `Infinity` never removes: the nearest
|
|
1892
|
+
* slot is taken however far away the pointer is.
|
|
1085
1893
|
*/
|
|
1086
|
-
|
|
1894
|
+
removeDistance?: number;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Where a member dragged to `pixel` lands (#759), read from `layout` as it
|
|
1898
|
+
* was drawn before the drag, so the answer never feeds back on itself.
|
|
1899
|
+
*
|
|
1900
|
+
* The nearest part's members (the Bracket's on a tie: it draws on top) take
|
|
1901
|
+
* it; within that part, it goes beside the member whose middle is nearest,
|
|
1902
|
+
* before or after it by the axis the members run along: across for a
|
|
1903
|
+
* Bracket grid of more than one column (filled in reading order whichever
|
|
1904
|
+
* side it stands on), else down. Farther than `removeDistance` from every
|
|
1905
|
+
* part, it is `{ remove: true }`.
|
|
1906
|
+
*
|
|
1907
|
+
* `memberId` need not be laid out: a symbol dropped into the collocation from
|
|
1908
|
+
* outside (#760) aims the same way, and its slot counts every member of the
|
|
1909
|
+
* part. Farther than `removeDistance` from every part, such a drop has no
|
|
1910
|
+
* target: `null`, as for a collocation with no member laid out.
|
|
1911
|
+
*/
|
|
1912
|
+
declare function collocationDropTarget(layout: CollocationLayout, memberId: string, pixel: PixelCoordinate, toPixel: (position: Position) => PixelCoordinate | null, options?: CollocationDropTargetOptions): CollocationDropTarget | null;
|
|
1913
|
+
/**
|
|
1914
|
+
* `collocation` with `memberId` moved to `slot` (#759): the member goes
|
|
1915
|
+
* before the slot's member of that part in `members`, or right after the
|
|
1916
|
+
* part's last one (staying where it is when the part has no other member).
|
|
1917
|
+
* A member that changes part gets `part` set, or cleared when the new part is
|
|
1918
|
+
* the one it would get anyway (from its role and `options.parts`); one that
|
|
1919
|
+
* stays in its part keeps its `part` as it is.
|
|
1920
|
+
*/
|
|
1921
|
+
declare function moveCollocationMember(collocation: Collocation, memberId: string, slot: CollocationDropSlot, capabilities?: CollocationMemberCapabilities): Collocation;
|
|
1922
|
+
/**
|
|
1923
|
+
* `collocation` with `members` joined at `slot` (#760), in the order given:
|
|
1924
|
+
* before the slot's member of that part in `members`, or right after the
|
|
1925
|
+
* part's last one (at the end when the part has none). Each joining member
|
|
1926
|
+
* gets `part` set when the slot's part isn't the one it would get anyway
|
|
1927
|
+
* (from its role and `options.parts`), and cleared when it is. A member whose
|
|
1928
|
+
* id is already in the collocation, or earlier in `members`, is left out.
|
|
1929
|
+
*/
|
|
1930
|
+
declare function insertCollocationMembers(collocation: Collocation, members: readonly CollocationMember[], slot: CollocationDropSlot, capabilities?: CollocationMemberCapabilities): Collocation;
|
|
1931
|
+
//#endregion
|
|
1932
|
+
//#region src/tactical-draw/offset-drop.d.ts
|
|
1933
|
+
/** Where an offset drag released over a collocation drops its symbols (#760). */
|
|
1934
|
+
interface OffsetDrop {
|
|
1935
|
+
/** The collocation they join. */
|
|
1936
|
+
targetId: string;
|
|
1937
|
+
/** Where in it they go; see {@link insertCollocationMembers}. */
|
|
1938
|
+
slot: CollocationDropSlot;
|
|
1939
|
+
/** The dragged symbols' ids, in the order they join. */
|
|
1940
|
+
memberIds: string[];
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* A host's drop of point symbols into a collocation with an offset drag
|
|
1944
|
+
* (#760), on a point-symbol edit or a group transform of point symbols and
|
|
1945
|
+
* Markers. While the pointer is over a collocation `targetAt` returns, the
|
|
1946
|
+
* drag previews the symbols joined at the slot under the pointer, in place of
|
|
1947
|
+
* that collocation; on release there, `commit` is called instead of the
|
|
1948
|
+
* offset change or `offsetDrag.commit`. The engine changes no membership and
|
|
1949
|
+
* records no step of the session's own: the host owns which symbols make up a
|
|
1950
|
+
* collocation. Away from every target the drag does what it does without it.
|
|
1951
|
+
*/
|
|
1952
|
+
interface OffsetDropHandler {
|
|
1953
|
+
/**
|
|
1954
|
+
* The collocation a drop at `pixel` would join, or null. The host refuses
|
|
1955
|
+
* here what it won't join: another Layer, a locked collocation, one that
|
|
1956
|
+
* already holds a dragged symbol. Member ids are only unique within a
|
|
1957
|
+
* collocation, so the engine can't tell that last one by id: a dragged
|
|
1958
|
+
* symbol whose id a member already uses is previewed under another, and
|
|
1959
|
+
* the host's commit decides what id it joins with.
|
|
1960
|
+
*
|
|
1961
|
+
* The target is laid out once and reused while `targetAt` keeps returning
|
|
1962
|
+
* it: the same object, or an equal copy with the same id. Return a new
|
|
1963
|
+
* object for a changed collocation; one changed in place mid-drag keeps the
|
|
1964
|
+
* layout it had, as the render cache does.
|
|
1965
|
+
*/
|
|
1966
|
+
targetAt(pixel: PixelCoordinate): Collocation | null;
|
|
1967
|
+
commit(drop: OffsetDrop): void;
|
|
1968
|
+
}
|
|
1969
|
+
/** One offset drag's aim at drop targets: the preview to draw, and the drop it would make. */
|
|
1970
|
+
interface OffsetDropAim {
|
|
1971
|
+
/** Aim at `pixel`: the drop a release there makes, or null away from every target. */
|
|
1972
|
+
aim(pixel: PixelCoordinate): OffsetDrop | null;
|
|
1973
|
+
/** The last aim's preview: the target joined, ghosts and ties; null without a target. */
|
|
1974
|
+
readonly group: FeatureGroup | null;
|
|
1975
|
+
/** Stop aiming: the hidden target draws again. Safe to call twice. */
|
|
1976
|
+
end(): void;
|
|
1977
|
+
/** Hand `drop` to the host; call after {@link end} and after the members draw again. */
|
|
1978
|
+
commit(drop: OffsetDrop): void;
|
|
1979
|
+
}
|
|
1980
|
+
/** What the façade binds once per session; the controller adds the dragged members. */
|
|
1981
|
+
interface OffsetDropContext {
|
|
1982
|
+
handler: OffsetDropHandler;
|
|
1983
|
+
capabilities: CollocationMemberCapabilities;
|
|
1984
|
+
highlight?: () => HighlightAppearance | undefined;
|
|
1985
|
+
/** Draw nothing in a host graphic's slot until {@link revealGraphic}. */
|
|
1986
|
+
hideGraphic(id: string): void;
|
|
1987
|
+
revealGraphic(id: string): void;
|
|
1988
|
+
/** Style of the tie from a ghost to its symbol's ground position. */
|
|
1989
|
+
tieStyle?: GuideStyle;
|
|
1990
|
+
}
|
|
1991
|
+
interface OffsetDropView {
|
|
1992
|
+
toPixel(position: Position): PixelCoordinate | null;
|
|
1993
|
+
fromPixel(pixel: PixelCoordinate): Position;
|
|
1994
|
+
/** The map's resolution, read on every aim: a zoom mid-drag lays the target out afresh. */
|
|
1995
|
+
readonly resolution: number | undefined;
|
|
1996
|
+
/** The preview group's id, held for the whole drag so the layer doesn't rebuild per frame. */
|
|
1997
|
+
groupId: string;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Aim an offset drag of `members` at the host's drop targets (#760). The
|
|
2001
|
+
* target's slot is read from its layout as drawn when the pointer reached it,
|
|
2002
|
+
* so the preview never feeds back on the aim, as a reorder drag's (#759).
|
|
2003
|
+
*/
|
|
2004
|
+
declare function beginOffsetDrop(context: OffsetDropContext, members: readonly CollocationMemberGraphic[], view: OffsetDropView): OffsetDropAim;
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region src/tactical-draw/collocation-support.d.ts
|
|
2007
|
+
/** Options for {@link createCollocationSupport}. */
|
|
2008
|
+
interface CollocationSupportOptions {
|
|
1087
2009
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
* and
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
2010
|
+
* What a ground move of a collocation changes (ADR-0063): a location-handle
|
|
2011
|
+
* drag and every group transform that carries a collocation. Pure and
|
|
2012
|
+
* synchronous; called on every preview move and once at commit with the
|
|
2013
|
+
* collocation as it stood when the gesture began. Defaults to
|
|
2014
|
+
* `transformCollocation`.
|
|
1092
2015
|
*/
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
2016
|
+
resolveTransform?: ResolveCollocationTransform;
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* The collocation layout, rendering and editing code `TacticalDraw` reaches
|
|
2020
|
+
* for, bundled so it is opt-in and tree-shakable (ADR-0063). Create one with
|
|
2021
|
+
* {@link createCollocationSupport} and pass it as `TacticalDrawOptions.collocations`;
|
|
2022
|
+
* a host never calls its members. Without it, `TacticalDraw` throws
|
|
2023
|
+
* `CollocationSupportRequiredError` on a Collocation.
|
|
2024
|
+
*
|
|
2025
|
+
* @internal Every member is an implementation detail shared with `TacticalDraw`
|
|
2026
|
+
* and its group-transform controller. It may change without a major release.
|
|
2027
|
+
*/
|
|
2028
|
+
interface CollocationSupport {
|
|
2029
|
+
/** @internal Draw a collocation's features, icons and layout. */
|
|
2030
|
+
renderGroup: typeof renderCollocationGroup;
|
|
2031
|
+
/** @internal Warn once about duplicate member ids and capability fallbacks. */
|
|
2032
|
+
warn(collocation: Collocation, capabilities: CollocationMemberCapabilities): void;
|
|
2033
|
+
/** @internal The layout a collocation draws with. */
|
|
2034
|
+
layout: typeof buildCollocationLayout;
|
|
2035
|
+
/** @internal The screen pixels a laid-out collocation covers. */
|
|
2036
|
+
footprintPixels: typeof collocationFootprintPixels;
|
|
2037
|
+
/** @internal The passive outline of one member. */
|
|
2038
|
+
memberOutlineFeatures: typeof collocationMemberOutlineFeatures;
|
|
2039
|
+
/** @internal The part and member a picked collocation feature reports. */
|
|
2040
|
+
pickTarget: typeof collocationPickTarget;
|
|
2041
|
+
/** @internal What live view state a collocation's render reads. */
|
|
2042
|
+
viewDependence(collocation: Collocation, capabilities: CollocationMemberCapabilities): "none" | "resolution";
|
|
2043
|
+
/** @internal The size every member is drawn at. */
|
|
2044
|
+
resolveSize: typeof resolveCollocationSize;
|
|
2045
|
+
/** @internal A collocation's render description. */
|
|
2046
|
+
buildRender: typeof buildCollocationRender;
|
|
2047
|
+
/** @internal What a ground move of a collocation changes. */
|
|
2048
|
+
resolveTransform: ResolveCollocationTransform;
|
|
2049
|
+
/** @internal Run a single collocation edit. */
|
|
2050
|
+
runEdit: typeof runCollocationEdit;
|
|
2051
|
+
/** @internal Whether an active edit handle is a collocation edit. */
|
|
2052
|
+
isEditHandle: typeof isCollocationEditHandle;
|
|
2053
|
+
/** @internal Validate and default a collocation edit's modes. */
|
|
2054
|
+
normaliseModes: typeof normaliseCollocationModes;
|
|
2055
|
+
/** @internal Aim an offset drag at the host's drop targets (#760). */
|
|
2056
|
+
beginOffsetDrop: typeof beginOffsetDrop;
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Opt in to Collocations (ADR-0063) for a `TacticalDraw` instance:
|
|
2060
|
+
* `new TacticalDraw(adapter, { collocations: createCollocationSupport() })`.
|
|
2061
|
+
* Hosts that never draw a collocation leave it out and their bundle drops the
|
|
2062
|
+
* collocation layout, rendering and editing code.
|
|
2063
|
+
*/
|
|
2064
|
+
declare function createCollocationSupport(options?: CollocationSupportOptions): CollocationSupport;
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/tactical-draw/measure-options.d.ts
|
|
2067
|
+
declare const DEFAULT_LABEL_SIZE_PIXELS = 14;
|
|
2068
|
+
/**
|
|
2069
|
+
* Where a control measure's size is anchored (ADR-0020). `ground` (the
|
|
2070
|
+
* default) means a meter size fixed to the terrain — static, never re-rendered
|
|
2071
|
+
* on zoom. `screen` means a pixel size held constant on screen — re-rendered
|
|
2072
|
+
* against the live `metersPerPixel` on every view change. A draw/edit drawn in
|
|
2073
|
+
* pixels resolves (`bakes`) to a `ground` anchor on commit unless the caller
|
|
2074
|
+
* asks to stay `screen`. Edits of uniformly sized symbols retain their authored
|
|
2075
|
+
* unit by default (ADR-0052).
|
|
2076
|
+
*/
|
|
2077
|
+
type SizeAnchor = "ground" | "screen";
|
|
2078
|
+
/**
|
|
2079
|
+
* Whether `kind` has at least one size that can be restored to its normal
|
|
2080
|
+
* pixel-authored appearance at the given resolution. Kept inside
|
|
2081
|
+
* tactical-draw using the core metadata catalog so hosts never need to
|
|
2082
|
+
* infer option names or special-case captured labels.
|
|
2083
|
+
*
|
|
2084
|
+
* `scale` only needs `getResolution()` (Web Mercator meters per CSS pixel), so
|
|
2085
|
+
* a host without a live map can pass a fixed one:
|
|
2086
|
+
* `canResetGroundSizes(measure, { getResolution: () => resolution })`.
|
|
2087
|
+
*/
|
|
2088
|
+
declare function canResetGroundSizes(measure: Pick<ControlMeasure, "kind">, scale: Pick<MapAdapter, "getResolution">): boolean;
|
|
2089
|
+
/**
|
|
2090
|
+
* Return the complete option record produced by resetting every known size
|
|
2091
|
+
* pair to its default on-screen appearance at the given resolution. Pixel
|
|
2092
|
+
* keys are removed and meter keys are written, so the result remains
|
|
2093
|
+
* ground-anchored. A pair that inherits another pair's size is cleared so it
|
|
2094
|
+
* follows again. Unrelated options are preserved. This is the rule
|
|
2095
|
+
* `EditSession.resetGroundSizes()` applies; hosts resetting graphics outside
|
|
2096
|
+
* an edit session call it directly, passing a fixed resolution such as
|
|
2097
|
+
* `{ getResolution: () => resolution }`.
|
|
2098
|
+
*
|
|
2099
|
+
* A pair's default is its own `defaultValue` when its `defaultUnit` is `"px"`,
|
|
2100
|
+
* else the kind's default pixel option.
|
|
2101
|
+
*
|
|
2102
|
+
* Returns options for any kind with size pairs, even when nothing changes;
|
|
2103
|
+
* compare with the input (e.g. structurally) to detect a no-op. Returns
|
|
2104
|
+
* `undefined` when the kind has no resettable sizes or the resolution is not
|
|
2105
|
+
* usable.
|
|
2106
|
+
*/
|
|
2107
|
+
declare function resetGroundSizeOptions(measure: Pick<ControlMeasure, "kind" | "options">, scale: Pick<MapAdapter, "getResolution">): ControlMeasure["options"] | undefined;
|
|
2108
|
+
/**
|
|
2109
|
+
* The [[SizeAnchor]] a measure currently encodes (ADR-0020): `screen` when it
|
|
2110
|
+
* carries its kind's pixel-denominated size option, `ground` otherwise. Keys off
|
|
2111
|
+
* the same metadata size pairs as the bake, so a consumer deciding how to
|
|
2112
|
+
* re-edit a graphic never has to re-derive the per-kind pixel-option knowledge
|
|
2113
|
+
* (e.g. via a fragile key-name heuristic). Accepts the minimal `{ kind, options }`
|
|
2114
|
+
* shape, mirroring [[measureUsesAdapterResolution]].
|
|
2115
|
+
*/
|
|
2116
|
+
declare function getSizeAnchor(measure: Pick<ControlMeasure, "kind" | "options">): SizeAnchor;
|
|
2117
|
+
//#endregion
|
|
2118
|
+
//#region src/tactical-draw/note-rendering.d.ts
|
|
2119
|
+
/**
|
|
2120
|
+
* One Note's contribution to its atomic FeatureGroup (ADR-0066, ADR-0069):
|
|
2121
|
+
* the note raster as an image overlay, then a transparent pick polygon over the full box.
|
|
2122
|
+
* While pending, the polygon becomes a grey placeholder and there is no overlay.
|
|
2123
|
+
* A fully faded Note has neither, so it can't be seen or picked.
|
|
2124
|
+
*/
|
|
2125
|
+
interface NoteRenderPlan {
|
|
2126
|
+
features: Feature[];
|
|
2127
|
+
overlay?: ImageOverlayResource;
|
|
2128
|
+
render: NoteRender;
|
|
2129
|
+
}
|
|
2130
|
+
interface NoteFootprint {
|
|
2131
|
+
box: TransformBox;
|
|
2132
|
+
corners: PixelCoordinate[];
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Memo shared by every render of one `TacticalDraw`, so zooming within a
|
|
2136
|
+
* density step reuses the resolved raster without calling the capability, and
|
|
2137
|
+
* the 2048 px cap is sized from a Note's last known height.
|
|
2138
|
+
*/
|
|
2139
|
+
interface NoteResolveCache {
|
|
2140
|
+
/** Last ready box height in em per Note id. */
|
|
2141
|
+
readonly heights: Map<string, number>;
|
|
2142
|
+
/** Last ready raster per Note snapshot, with the density it was requested at. */
|
|
2143
|
+
readonly rasters: WeakMap<NoteGraphic, {
|
|
2144
|
+
pxPerEm: number;
|
|
2145
|
+
raster: NoteRaster;
|
|
2146
|
+
}>;
|
|
2147
|
+
}
|
|
2148
|
+
/** Screen-space box of a Note, for highlights, edit boxes and marquee hit tests. */
|
|
2149
|
+
declare function noteFootprint(note: NoteGraphic, render: NoteRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): NoteFootprint | null;
|
|
2150
|
+
/**
|
|
2151
|
+
* Resolve and render one Note. Validates the Note and the resolved raster first,
|
|
2152
|
+
* so a malformed Note or raster throws before any caller state changes.
|
|
2153
|
+
*
|
|
2154
|
+
* The density requested from the capability follows the view (ADR-0069): the
|
|
2155
|
+
* on-screen pixels per em, times the capability's pixel ratio, rounded up to a
|
|
2156
|
+
* power of two and capped so the raster's longest side stays within
|
|
2157
|
+
* {@link NOTE_MAX_RASTER_PIXELS}. The overlay fades over one step once an em
|
|
2158
|
+
* is smaller on screen than the fade threshold, or once the cap stretches it.
|
|
2159
|
+
*/
|
|
2160
|
+
declare function renderNoteForAdapter(adapter: Pick<MapAdapter, "getResolution" | "fromLonLat" | "toLonLat">, capability: NoteCapability, note: NoteGraphic, cache?: NoteResolveCache): NoteRenderPlan;
|
|
2161
|
+
//#endregion
|
|
2162
|
+
//#region src/tactical-draw/transform-session.d.ts
|
|
2163
|
+
/**
|
|
2164
|
+
* Surface delivered via `td.editMany(graphics, opts).onSession` and
|
|
2165
|
+
* synchronously available from `td.activeTransformSession` while the group
|
|
2166
|
+
* transform is live. The group sibling of `EditSession` (`edit-session.ts`):
|
|
2167
|
+
* no reshape, no per-measure `setOptions`/`setStyle` — only the shared
|
|
2168
|
+
* transform box's corner-scale / rotate / body-translate gestures, applied to
|
|
2169
|
+
* every member at once. See the Phase 3 ("Multi-select") slice of ADR-0017.
|
|
2170
|
+
*
|
|
2171
|
+
* Typed on `Graphic` (ADR-0032): a member is either a `ControlMeasure` or a
|
|
2172
|
+
* point symbol, and the two coexist in one session. Hosts narrow with
|
|
2173
|
+
* `isPointSymbol`. `controlPointsFor` is a control-measure accessor and returns
|
|
2174
|
+
* `undefined` for a point-symbol id.
|
|
2175
|
+
*
|
|
2176
|
+
* The member set is mutable via [[setGraphics]] (#187): members can join or
|
|
2177
|
+
* leave a live session without a session boundary — point symbols exactly like
|
|
2178
|
+
* measures. Because membership changes over the session's lifetime, snapshot
|
|
2179
|
+
* arrays are keyed by **graphic id**, not by index — a snapshot's identity is
|
|
2180
|
+
* `snapshot.graphic.id`. `graphics` is a live view of the current members'
|
|
2181
|
+
* join-time inputs; a `TransformChangeEvent`'s arrays are index-aligned with
|
|
2182
|
+
* `session.graphics` *as of that emission*. After the session settles (`close`
|
|
2183
|
+
* / `abort` / an emptying `setGraphics`), every method is a silent no-op
|
|
2184
|
+
* (except [[onSettled]] — late registration still delivers, asynchronously).
|
|
2185
|
+
*/
|
|
2186
|
+
interface TransformSession {
|
|
2187
|
+
/** Undo/redo for completed gestures within the current membership baseline. */
|
|
2188
|
+
readonly history: SessionHistory;
|
|
1096
2189
|
/**
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1101
|
-
* is rejected with `TypeError`.
|
|
2190
|
+
* Live view of the current members' join-time input graphics — a fresh array
|
|
2191
|
+
* on each read, in current membership order. Grows/shrinks as [[setGraphics]]
|
|
2192
|
+
* adds or removes members. Not stable across membership changes: key
|
|
2193
|
+
* snapshots by `snapshot.graphic.id` rather than relying on index alignment.
|
|
1102
2194
|
*/
|
|
1103
|
-
|
|
2195
|
+
readonly graphics: readonly Graphic[];
|
|
1104
2196
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
2197
|
+
* Live view of the current members' working graphics — a fresh array on each
|
|
2198
|
+
* read, in current membership order, reflecting every gesture applied so far.
|
|
2199
|
+
* Measures carry their working control points (and any transform-frozen
|
|
2200
|
+
* options); point symbols carry their working position, size value, and
|
|
2201
|
+
* rotation. Copy on read.
|
|
1107
2202
|
*/
|
|
1108
|
-
|
|
2203
|
+
readonly workingGraphics: readonly Graphic[];
|
|
1109
2204
|
/**
|
|
1110
|
-
*
|
|
1111
|
-
* or
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
* history entry. A no-op for a part the working graphic doesn't have, for
|
|
1115
|
-
* graphics without parts, and after settlement.
|
|
2205
|
+
* Live working control points for the control-measure member whose id is
|
|
2206
|
+
* `graphicId`, or `undefined` when no such member carries that id — including
|
|
2207
|
+
* when `graphicId` names a point symbol (which has no control points; read
|
|
2208
|
+
* its working `position` from [[workingGraphics]] instead). Copy on read.
|
|
1116
2209
|
*/
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
2210
|
+
controlPointsFor(graphicId: string): readonly Position[] | undefined;
|
|
2211
|
+
/** `true` when any member's working state differs from its edit-start input beyond tolerance. */
|
|
2212
|
+
readonly dirty: boolean;
|
|
1120
2213
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
2214
|
+
* Live size anchor, applied group-wide to the **control-measure** members
|
|
2215
|
+
* only (ADR-0020). `"ground"` bakes each measure's pixel size to meters on
|
|
2216
|
+
* commit; `"screen"` keeps it zoom-aware. A point symbol's persisted
|
|
2217
|
+
* pixel/meter size is its own anchor and is never rewritten by this setting.
|
|
2218
|
+
* Initialised from `EditManyOptions.sizeAnchor` and mutated by [[setSizeAnchor]].
|
|
1125
2219
|
*/
|
|
1126
|
-
|
|
2220
|
+
readonly sizeAnchor: SizeAnchor;
|
|
1127
2221
|
/**
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
* neither doesn't notify. Returns an unsubscribe function; registering
|
|
1132
|
-
* after settlement is a no-op.
|
|
2222
|
+
* Switch the group's size anchor (ADR-0020) for its control-measure members.
|
|
2223
|
+
* Takes effect on the next emitted snapshot and on `close()`. Point-symbol
|
|
2224
|
+
* members are unaffected.
|
|
1133
2225
|
*/
|
|
1134
|
-
|
|
1135
|
-
/** Atomically replace the live working graphic while preserving id and kind. */
|
|
1136
|
-
updateGraphic(updater: (graphic: ControlMeasure) => ControlMeasure): void;
|
|
1137
|
-
/** Shallow-merge per-measure generator options into the live working copy. */
|
|
1138
|
-
setOptions(partial: ControlMeasure["options"]): void;
|
|
2226
|
+
setSizeAnchor(anchor: SizeAnchor): void;
|
|
1139
2227
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1143
|
-
* screen-locked symbol stays screen-locked until commit.
|
|
1144
|
-
*
|
|
1145
|
-
* `options` shallow-merges a size-option patch in the *same* mutation, as
|
|
1146
|
-
* [[setOptions]] would. Changing a measure's size mode means moving its value
|
|
1147
|
-
* between the pixel and meter halves of a size pair *and* re-anchoring, and
|
|
1148
|
-
* the halves are only meaningful together: options carrying a pixel size
|
|
1149
|
-
* under a `"ground"` anchor bake that size away on commit, so a host that
|
|
1150
|
-
* emitted the two as separate mutations would leave an undo step parked on a
|
|
1151
|
-
* state whose committed size mode contradicts its own options. Passed here
|
|
1152
|
-
* they are one change event and one history entry, which undo cannot land
|
|
1153
|
-
* inside.
|
|
2228
|
+
* Whether each member is outlined inside the group box. Initialised from
|
|
2229
|
+
* `EditManyOptions.memberOutlines` (default `true`) and mutated by
|
|
2230
|
+
* [[setMemberOutlines]].
|
|
1154
2231
|
*/
|
|
1155
|
-
|
|
2232
|
+
readonly memberOutlines: boolean;
|
|
1156
2233
|
/**
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
* No-op when [[canResetGroundSizes]] is false or after settlement.
|
|
2234
|
+
* Show or hide the per-member outlines inside the group box, leaving the box
|
|
2235
|
+
* and its handles as they are. A host turns them off when the members read
|
|
2236
|
+
* as one object (a group selected whole) rather than as separate picks.
|
|
1161
2237
|
*/
|
|
1162
|
-
|
|
1163
|
-
/** Shallow-merge per-measure style into the live working copy. */
|
|
1164
|
-
setStyle(partial: ControlMeasureStyle): void;
|
|
2238
|
+
setMemberOutlines(visible: boolean): void;
|
|
1165
2239
|
/**
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
2240
|
+
* Whether a press at `pixel` would grab the group box's body, and so start
|
|
2241
|
+
* a move (or, with the offset-drag key, the host's offset drag), rather
|
|
2242
|
+
* than a handle or nothing. Lets a host route a modifier press that it
|
|
2243
|
+
* would otherwise take for a map gesture, such as a lasso.
|
|
1170
2244
|
*/
|
|
1171
|
-
|
|
2245
|
+
bodyAt(pixel: PixelCoordinate): boolean;
|
|
1172
2246
|
/**
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
2247
|
+
* Replace the member set in place — the primitive behind shift-click toggle,
|
|
2248
|
+
* marquee replace, and single-edit → group folding, without tearing the
|
|
2249
|
+
* session down (#187). Members (measures and point symbols alike) are matched
|
|
2250
|
+
* to the current set by graphic id:
|
|
2251
|
+
*
|
|
2252
|
+
* - **Retained** members (id in both the current and next sets) carry their
|
|
2253
|
+
* current working state forward; the passed graphic object is ignored for
|
|
2254
|
+
* them. Their `dirty` baseline stays their original join-time input, so a
|
|
2255
|
+
* session that has already moved things stays dirty across the call.
|
|
2256
|
+
* - **Removed** members (id in the current set, absent from the next) are
|
|
2257
|
+
* committed at their current working state.
|
|
2258
|
+
* - **Added** members (id only in the next set) join at their passed input
|
|
2259
|
+
* state and use their host-provided Graphic-stack slot when present.
|
|
2260
|
+
*
|
|
2261
|
+
* The transform box re-derives from the next member set at the session's
|
|
2262
|
+
* current box angle. Session-scoped state (`sizeAnchor`, box angle,
|
|
2263
|
+
* non-geometry dirty) is unchanged.
|
|
2264
|
+
*
|
|
2265
|
+
* Calling this establishes a new session-history baseline: both undo and
|
|
2266
|
+
* redo are cleared after retained members carry their working state
|
|
2267
|
+
* forward. Membership changes and already-emitted exit snapshots are not
|
|
2268
|
+
* undoable within the live session.
|
|
2269
|
+
*
|
|
2270
|
+
* **Return value** — the committed exit snapshots of the members removed *by
|
|
2271
|
+
* this call*, built exactly like [[close]]'s snapshots (a measure's pixel
|
|
2272
|
+
* size baked to ground unless `sizeAnchor` is `"screen"`, a point symbol's
|
|
2273
|
+
* size left untouched, then cloned and rendered); an empty array when nothing
|
|
2274
|
+
* was removed. The outer `editMany` promise resolves with the snapshots of
|
|
2275
|
+
* the members in the set **at close time only**. Removed members are NOT
|
|
2276
|
+
* retained in its Graphic-stack slot until the host acknowledges it by
|
|
2277
|
+
* folding the returned snapshot into its document and calling `td.render()`,
|
|
2278
|
+
* the same contract as [[close]]. A removed member's exit snapshot is also
|
|
2279
|
+
* delivered through [[onCommit]] — the recommended channel, since it covers
|
|
2280
|
+
* this return value and the close-time promise resolution through a single
|
|
2281
|
+
* subscription.
|
|
2282
|
+
* Returns `undefined` (a silent no-op) after the session has settled.
|
|
2283
|
+
*
|
|
2284
|
+
* `setGraphics([])` on a live session delegates to [[close]]: it commits every
|
|
2285
|
+
* current member, resolves the promise with their snapshots, and returns that
|
|
2286
|
+
* same array. Duplicate ids in `graphics` throw `TypeError` synchronously,
|
|
2287
|
+
* without mutating session state. A point-symbol member entering a session
|
|
2288
|
+
* whose controller was created without a point-symbol capability throws
|
|
2289
|
+
* `PointSymbolCapabilityRequiredError` synchronously, also without mutating
|
|
2290
|
+
* session state.
|
|
2291
|
+
*
|
|
2292
|
+
* A collocation may join whole or as a partial collocation target
|
|
2293
|
+
* (`{ graphic, members }`, ADR-0063); a retained collocation takes the
|
|
2294
|
+
* member scope of the passed target.
|
|
1179
2295
|
*/
|
|
1180
|
-
|
|
2296
|
+
setGraphics(graphics: readonly TransformTarget[]): GraphicSnapshot[] | undefined;
|
|
1181
2297
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
2298
|
+
* Commit: returns the members' `GraphicSnapshot[]` (the members in the set at
|
|
2299
|
+
* close time) and resolves the outer `editMany` promise with the same value
|
|
2300
|
+
* (the same reference — no double-bake of ground-anchored measure sizes). A
|
|
2301
|
+
* member removed mid-session via [[setGraphics]] is not included here; its exit
|
|
2302
|
+
* snapshot was returned from that `setGraphics` call (and delivered to
|
|
2303
|
+
* [[onCommit]] at that time). Returns `undefined` after the session has
|
|
2304
|
+
* settled (idempotent no-op).
|
|
2305
|
+
*/
|
|
2306
|
+
close(): GraphicSnapshot[] | undefined;
|
|
2307
|
+
/** Reject the outer `editMany` promise with reason `"session"`. */
|
|
2308
|
+
abort(): void;
|
|
2309
|
+
/**
|
|
2310
|
+
* Subscribe to working-copy changes. The listener receives a
|
|
2311
|
+
* [[TransformChangeEvent]] for each completed group gesture (corner scale,
|
|
2312
|
+
* rotate, or body-translate drag end) — never on rubber-band ticks. All
|
|
2313
|
+
* currently-registered listeners receive the same event instance, in
|
|
2314
|
+
* registration order.
|
|
1186
2315
|
*
|
|
1187
2316
|
* Listener exceptions are collected; after every listener has run, they are
|
|
1188
2317
|
* rethrown (one if single, aggregated otherwise). `event.reject()` /
|
|
1189
2318
|
* `event.close()` / `event.abort()` take effect only after all listeners
|
|
1190
|
-
* have run.
|
|
1191
|
-
*/
|
|
1192
|
-
onChange(listener: (event:
|
|
1193
|
-
/**
|
|
1194
|
-
* Subscribe to
|
|
1195
|
-
* `GraphicSnapshot
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
2319
|
+
* have run — mirrors `EditSession.onChange` (issue #49).
|
|
2320
|
+
*/
|
|
2321
|
+
onChange(listener: (event: TransformChangeEvent) => void): () => void;
|
|
2322
|
+
/**
|
|
2323
|
+
* Subscribe to committed exit-snapshot batches — the single delivery channel
|
|
2324
|
+
* for every `GraphicSnapshot[]` this session ever commits (#191). Fires
|
|
2325
|
+
* exactly once per batch:
|
|
2326
|
+
*
|
|
2327
|
+
* - The members [[setGraphics]] removes, but only when that call actually
|
|
2328
|
+
* removed at least one member.
|
|
2329
|
+
* - The close-time members on any commit path: [[close]], `setGraphics([])`,
|
|
2330
|
+
* a click-away close, or `TransformChangeEvent.close()`.
|
|
2331
|
+
*
|
|
2332
|
+
* Never fires on an abort/reject path — pair it with [[onSettled]] to also
|
|
2333
|
+
* observe abort settles. Fires synchronously from within the
|
|
2334
|
+
* `setGraphics`/`close` call that produced the batch, before that call
|
|
2335
|
+
* returns, and the array delivered here is the same reference that call
|
|
2336
|
+
* returns (and, for the close batch, the same reference the `editMany`
|
|
2337
|
+
* promise resolves with). This is the recommended single fold path for exit
|
|
2338
|
+
* state — subscribe once in `onSession` and every committed snapshot, from
|
|
2339
|
+
* either delivery site, arrives here exactly once; the `setGraphics` return
|
|
2340
|
+
* value and the promise resolution are unchanged and remain valid for
|
|
2341
|
+
* backward compatibility.
|
|
1201
2342
|
*
|
|
1202
2343
|
* Listener exceptions are collected; after every listener has run, they are
|
|
1203
2344
|
* rethrown (one if single, `AggregateError` otherwise) — mirrors
|
|
@@ -1205,21 +2346,21 @@ interface EditSession {
|
|
|
1205
2346
|
* session has settled returns a no-op unsubscribe and the listener never
|
|
1206
2347
|
* fires.
|
|
1207
2348
|
*/
|
|
1208
|
-
onCommit(handler: (
|
|
2349
|
+
onCommit(handler: (snapshots: GraphicSnapshot[]) => void): () => void;
|
|
1209
2350
|
/**
|
|
1210
2351
|
* Subscribe to the session's settlement — the lifecycle complement of
|
|
1211
2352
|
* [[onCommit]]: `onCommit` delivers *what* was committed, `onSettled` says
|
|
1212
|
-
* the session is *over* and why (#
|
|
1213
|
-
*
|
|
1214
|
-
* settles by any path, commit or abort, with a `SettleReason`.
|
|
2353
|
+
* the session is *over* and why (#194). Fires exactly once, when the
|
|
2354
|
+
* session settles by any path, commit or abort, with a [[SettleReason]].
|
|
1215
2355
|
*
|
|
1216
|
-
* - On
|
|
1217
|
-
* listener that clears selection state observes a document
|
|
1218
|
-
* contains the
|
|
1219
|
-
* - On every path it fires **after** the facade has already cleared
|
|
1220
|
-
* `td.
|
|
2356
|
+
* - On commit paths it fires **after** the close batch's `onCommit`
|
|
2357
|
+
* emission, so a listener that clears selection state observes a document
|
|
2358
|
+
* that already contains the exit snapshots.
|
|
2359
|
+
* - On every path it fires **after** the facade has already cleared its
|
|
2360
|
+
* slot — `td.activeTransformSession` is `null`, so fold-then-render works
|
|
2361
|
+
* from inside the handler.
|
|
1221
2362
|
* - `reason` distinguishes commit from abort but is deliberately coarse —
|
|
1222
|
-
* no payload;
|
|
2363
|
+
* no payload; snapshots were already delivered through [[onCommit]].
|
|
1223
2364
|
*
|
|
1224
2365
|
* Registering after the session has already settled is **not** a no-op
|
|
1225
2366
|
* (unlike [[onChange]] / [[onCommit]]): the handler is invoked
|
|
@@ -1231,50 +2372,32 @@ interface EditSession {
|
|
|
1231
2372
|
* [[onChange]] / [[onCommit]]. Returns an unsubscribe function.
|
|
1232
2373
|
*/
|
|
1233
2374
|
onSettled(handler: (reason: SettleReason) => void): () => void;
|
|
1234
|
-
/**
|
|
1235
|
-
* Subscribe to the continuous stream of in-flight geometry mutations —
|
|
1236
|
-
* vertex/midpoint drags and box scale/rotate/translate gestures — fired
|
|
1237
|
-
* throughout the gesture rather than once at its end (contrast
|
|
1238
|
-
* [[onChange]]). `start` fires at gesture begin, `move` on every pointer
|
|
1239
|
-
* tick, and `end` fires exactly once when the gesture finishes by any
|
|
1240
|
-
* path: commit, a click-slop no-op (a box body click that never becomes a
|
|
1241
|
-
* drag), or session abort/teardown mid-drag. `end` fires **before** the
|
|
1242
|
-
* gesture's [[onChange]] emission (and, on the commit path, before
|
|
1243
|
-
* [[onCommit]]/[[onSettled]] too), so a listener observing both channels
|
|
1244
|
-
* sees the transient stream close first.
|
|
1245
|
-
*
|
|
1246
|
-
* Label-placement drags (`labeldrag` mode) do not fire this — they move
|
|
1247
|
-
* amplifier placements, not control points.
|
|
1248
|
-
*
|
|
1249
|
-
* Listener exceptions are collected; after every listener has run, they
|
|
1250
|
-
* are rethrown (one if single, `AggregateError` otherwise) — mirrors
|
|
1251
|
-
* [[onChange]]. Returns an unsubscribe function; registering after the
|
|
1252
|
-
* session has settled returns a no-op unsubscribe and the listener never
|
|
1253
|
-
* fires.
|
|
1254
|
-
*/
|
|
1255
|
-
onTransientChange(listener: (event: TransientChangeEvent) => void): () => void;
|
|
1256
2375
|
}
|
|
1257
2376
|
/**
|
|
1258
|
-
* Delivered to `
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
2377
|
+
* Delivered to `TransformSession.onChange` listeners once per completed group
|
|
2378
|
+
* gesture. Both `graphics` and `previous` are index-aligned with
|
|
2379
|
+
* `session.graphics` *as of this emission*. Key by `graphic.id` rather than
|
|
2380
|
+
* relying on index alignment across emissions. A `setGraphics` call from within
|
|
2381
|
+
* a listener takes effect immediately and supersedes this emission's
|
|
2382
|
+
* `reject()` (the rollback baseline no longer matches the member set);
|
|
2383
|
+
* `close()` and `abort()` still apply, against the new membership. See
|
|
2384
|
+
* `EditChangeEvent` for the identical emission contract this mirrors.
|
|
1264
2385
|
*/
|
|
1265
|
-
interface
|
|
2386
|
+
interface TransformChangeEvent {
|
|
1266
2387
|
/** How this working-copy transition was initiated. */
|
|
1267
2388
|
readonly source: SessionChangeSource;
|
|
1268
|
-
/** Working state after the completed gesture. */
|
|
1269
|
-
readonly
|
|
1270
|
-
/** State immediately before this gesture. */
|
|
1271
|
-
readonly previous: GraphicSnapshot
|
|
2389
|
+
/** Working state after the completed gesture, index-aligned with `session.graphics` as of this emission. */
|
|
2390
|
+
readonly graphics: GraphicSnapshot[];
|
|
2391
|
+
/** State immediately before this gesture, index-aligned with `session.graphics` as of this emission. */
|
|
2392
|
+
readonly previous: GraphicSnapshot[];
|
|
1272
2393
|
/** The session the event belongs to. */
|
|
1273
|
-
readonly session:
|
|
2394
|
+
readonly session: TransformSession;
|
|
1274
2395
|
/**
|
|
1275
|
-
* Roll
|
|
1276
|
-
* Multiple calls collapse to a single rollback.
|
|
1277
|
-
* `abort()` if either is also called during this
|
|
2396
|
+
* Roll every member's working preview back to `previous` after all
|
|
2397
|
+
* listeners have run. Multiple calls collapse to a single rollback.
|
|
2398
|
+
* Overridden by `close()` or `abort()` if either is also called during this
|
|
2399
|
+
* emission, and dropped if a listener called `session.setGraphics` (the
|
|
2400
|
+
* rollback baseline no longer matches the member set).
|
|
1278
2401
|
*/
|
|
1279
2402
|
reject(): void;
|
|
1280
2403
|
/** Shortcut for `event.session.close()`, deferred until the emission ends. */
|
|
@@ -1283,273 +2406,221 @@ interface EditChangeEvent {
|
|
|
1283
2406
|
abort(): void;
|
|
1284
2407
|
}
|
|
1285
2408
|
//#endregion
|
|
1286
|
-
//#region src/
|
|
1287
|
-
/**
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
interface PointSymbolOffsetLayout {
|
|
1292
|
-
/** Selected ordinary or detached body render, with canonical SVG dimensions. */
|
|
1293
|
-
render: PointSymbolRender;
|
|
1294
|
-
/** Selected body resource; dimensions and anchor remain in canonical SVG units. */
|
|
1295
|
-
resource: IconResource;
|
|
1296
|
-
/** Body opacity after applying the overall multiplier. */
|
|
1297
|
-
bodyOpacity: number;
|
|
1298
|
-
/** Clockwise radians in the projection plane. */
|
|
1299
|
-
rotation: number;
|
|
1300
|
-
actual: PixelCoordinate;
|
|
1301
|
-
/** Body registration, including natural HQ displacement in ordinary placement. */
|
|
1302
|
-
display: PixelCoordinate;
|
|
1303
|
-
/** Coordinate at which the chosen image's resource anchor is painted. */
|
|
1304
|
-
imageAnchor: PixelCoordinate;
|
|
1305
|
-
ordinaryDisplay: PixelCoordinate;
|
|
1306
|
-
attachment?: PixelCoordinate;
|
|
1307
|
-
junction?: PixelCoordinate;
|
|
1308
|
-
direction?: PixelCoordinate;
|
|
1309
|
-
path: PixelCoordinate[];
|
|
1310
|
-
kind: "ordinary" | "direct" | "indicator-only" | "with-extension";
|
|
1311
|
-
status: "ok" | "unsupported-presentation";
|
|
1312
|
-
scale: number;
|
|
1313
|
-
/** Resolved connector styling in CSS pixels. */
|
|
1314
|
-
connectorStyle: Required<PointSymbolOffsetStyle>;
|
|
2409
|
+
//#region src/tactical-draw/transform-controller.d.ts
|
|
2410
|
+
/** Where a group offset drag started and where it is now, in lon/lat. */
|
|
2411
|
+
interface GroupOffsetDrag {
|
|
2412
|
+
from: Position;
|
|
2413
|
+
to: Position;
|
|
1315
2414
|
}
|
|
1316
|
-
/** Pure layout: projection input/output is in CSS pixels, including document contexts. */
|
|
1317
|
-
declare function resolvePointSymbolOffset(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolProjection): PointSymbolOffsetLayout | null;
|
|
1318
|
-
/** Set body placement without changing the authoritative coordinate. */
|
|
1319
|
-
declare function placePointSymbol(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, display: PixelCoordinate, mode?: PointSymbolPlacement["mode"]): PointSymbol;
|
|
1320
|
-
declare function convertPointSymbolPlacement(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, mode: PointSymbolPlacement["mode"]): PointSymbol;
|
|
1321
|
-
/** Explicit alignment, also used with hysteresis by pointer editing. */
|
|
1322
|
-
declare function alignPointSymbolIndicator(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView): PointSymbol;
|
|
1323
|
-
declare function movePointSymbolLocation(symbol: PointSymbol, render: PointSymbolRender, view: PointSymbolView, position: Position): PointSymbol;
|
|
1324
|
-
/** Canonical resource metadata shared by native adapters and external exporters. */
|
|
1325
|
-
declare function pointSymbolResource(render: PointSymbolRender): IconResource;
|
|
1326
2415
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
1330
|
-
* and
|
|
2416
|
+
* A host's own gesture for a group body drag with the offset-drag key held,
|
|
2417
|
+
* as a point symbol's offset drag moves where it is drawn rather than where
|
|
2418
|
+
* it is: the members never move. `preview` is called for each painted frame
|
|
2419
|
+
* and returns a collocation to draw in place of the members, or null to draw
|
|
2420
|
+
* them as they are; `commit` is called once on release. The gesture records
|
|
2421
|
+
* no step of the session's own: what the host commits is its own change.
|
|
1331
2422
|
*/
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
interface PointSymbolOffsetControls {
|
|
1336
|
-
readonly layout: PointSymbolOffsetLayout | null;
|
|
1337
|
-
readonly connectors: readonly PointSymbolConnector[];
|
|
1338
|
-
setPlacement(mode: PointSymbolPlacement["mode"]): void;
|
|
1339
|
-
setConnector(connector: PointSymbolConnector): void;
|
|
1340
|
-
align(): void;
|
|
1341
|
-
reset(): void;
|
|
1342
|
-
}
|
|
1343
|
-
interface GraphicEditChangeEvent<G extends Graphic = Graphic> {
|
|
1344
|
-
readonly source: SessionChangeSource;
|
|
1345
|
-
readonly graphic: GraphicSnapshot<G>;
|
|
1346
|
-
readonly previous: GraphicSnapshot<G>;
|
|
1347
|
-
readonly session: GraphicEditSession<G>;
|
|
1348
|
-
reject(): void;
|
|
1349
|
-
close(): void;
|
|
1350
|
-
abort(): void;
|
|
1351
|
-
}
|
|
1352
|
-
/** Common selection/editing contract shared by control measures and point symbols. */
|
|
1353
|
-
interface GraphicEditSession<G extends Graphic = Graphic> {
|
|
1354
|
-
readonly history: SessionHistory;
|
|
1355
|
-
/** Present on point-symbol sessions; all commands participate in session history. */
|
|
1356
|
-
readonly offset?: PointSymbolOffsetControls;
|
|
1357
|
-
/** Immutable edit-start input. */
|
|
1358
|
-
readonly graphic: G;
|
|
1359
|
-
/** Live working graphic. Copy on read. */
|
|
1360
|
-
readonly workingGraphic: G;
|
|
1361
|
-
readonly dirty: boolean;
|
|
1362
|
-
readonly modes: readonly EditMode[];
|
|
1363
|
-
close(): GraphicSnapshot<G> | undefined;
|
|
1364
|
-
abort(): void;
|
|
1365
|
-
setModes(modes: readonly EditMode[]): void;
|
|
1366
|
-
/** Atomically replace any part of the live working graphic. */
|
|
1367
|
-
updateGraphic(updater: (graphic: G) => G): void;
|
|
1368
|
-
onChange(listener: (event: GraphicEditChangeEvent<G>) => void): () => void;
|
|
1369
|
-
onCommit(handler: (snapshot: GraphicSnapshot<G>) => void): () => void;
|
|
1370
|
-
onSettled(handler: (reason: SettleReason) => void): () => void;
|
|
1371
|
-
/**
|
|
1372
|
-
* Present on point-symbol sessions: the continuous stream of a drag, for a
|
|
1373
|
-
* host that follows the symbol while it moves (a range ring, a viewshed).
|
|
1374
|
-
* `start` fires on the first move of a gesture, `move` on each one after,
|
|
1375
|
-
* and `end` exactly once per started gesture, before that gesture's
|
|
1376
|
-
* [[onChange]], or when the session settles mid-gesture. `points` holds the
|
|
1377
|
-
* one live position; `pointIndex` is `null`. A body, location or pin drag
|
|
1378
|
-
* moves it; a rotate or scale streams it unchanged. Returns an unsubscribe
|
|
1379
|
-
* function; registering after the session has settled returns a no-op.
|
|
1380
|
-
*/
|
|
1381
|
-
onTransientChange?(listener: (event: TransientChangeEvent) => void): () => void;
|
|
2423
|
+
interface GroupOffsetDragHandler {
|
|
2424
|
+
preview(drag: GroupOffsetDrag): Collocation | null;
|
|
2425
|
+
commit(drag: GroupOffsetDrag): void;
|
|
1382
2426
|
}
|
|
1383
2427
|
//#endregion
|
|
1384
|
-
//#region src/tactical-draw/
|
|
2428
|
+
//#region src/tactical-draw/edit-session.d.ts
|
|
1385
2429
|
/**
|
|
1386
|
-
* Surface delivered via `td.
|
|
1387
|
-
*
|
|
1388
|
-
* transform is live. The group sibling of `EditSession` (`edit-session.ts`):
|
|
1389
|
-
* no reshape, no per-measure `setOptions`/`setStyle` — only the shared
|
|
1390
|
-
* transform box's corner-scale / rotate / body-translate gestures, applied to
|
|
1391
|
-
* every member at once. See the Phase 3 ("Multi-select") slice of ADR-0017.
|
|
1392
|
-
*
|
|
1393
|
-
* Typed on `Graphic` (ADR-0032): a member is either a `ControlMeasure` or a
|
|
1394
|
-
* point symbol, and the two coexist in one session. Hosts narrow with
|
|
1395
|
-
* `isPointSymbol`. `controlPointsFor` is a control-measure accessor and returns
|
|
1396
|
-
* `undefined` for a point-symbol id.
|
|
2430
|
+
* Surface delivered via `td.edit(measure, opts).onSession` and synchronously
|
|
2431
|
+
* available from `td.activeSession` while the edit is live.
|
|
1397
2432
|
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1402
|
-
* `snapshot.graphic.id`. `graphics` is a live view of the current members'
|
|
1403
|
-
* join-time inputs; a `TransformChangeEvent`'s arrays are index-aligned with
|
|
1404
|
-
* `session.graphics` *as of that emission*. After the session settles (`close`
|
|
1405
|
-
* / `abort` / an emptying `setGraphics`), every method is a silent no-op
|
|
1406
|
-
* (except [[onSettled]] — late registration still delivers, asynchronously).
|
|
2433
|
+
* `measure` is the immutable edit-start input. `controlPoints` is live working
|
|
2434
|
+
* state. After the session settles (`close` / `abort`), every method is a
|
|
2435
|
+
* silent no-op (except [[onSettled]] — late registration still delivers,
|
|
2436
|
+
* asynchronously).
|
|
1407
2437
|
*/
|
|
1408
|
-
interface
|
|
1409
|
-
/** Undo/redo for completed
|
|
2438
|
+
interface EditSession {
|
|
2439
|
+
/** Undo/redo for completed mutations within this live session. */
|
|
1410
2440
|
readonly history: SessionHistory;
|
|
2441
|
+
/** Immutable edit-start input. */
|
|
2442
|
+
readonly graphic: ControlMeasure;
|
|
1411
2443
|
/**
|
|
1412
|
-
* Live
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
2444
|
+
* Live complete working graphic. Copy on read. `properties` (host-owned
|
|
2445
|
+
* metadata, e.g. `standardIdentity`/`colorMode`) is session-owned like every
|
|
2446
|
+
* other working field: it starts at the edit-start value, is replaced
|
|
2447
|
+
* wholesale by [[updateGraphic]], survives every subsequent gesture/setter
|
|
2448
|
+
* call and in-session undo/redo, and is rolled back by `event.reject()`
|
|
2449
|
+
* (issue #354). Absent when the edit-start measure carried none and
|
|
2450
|
+
* [[updateGraphic]] has not set any since.
|
|
2451
|
+
*/
|
|
2452
|
+
readonly workingGraphic: ControlMeasure;
|
|
2453
|
+
/** Live working state. Copy on read. */
|
|
2454
|
+
readonly controlPoints: readonly Position[];
|
|
2455
|
+
/** Live working options. Copy on read. */
|
|
2456
|
+
readonly options: ControlMeasure["options"];
|
|
2457
|
+
/** Live working style. Copy on read. */
|
|
2458
|
+
readonly style: ControlMeasureStyle | undefined;
|
|
2459
|
+
/**
|
|
2460
|
+
* Live working text amplifiers (MIL-STD-2525E Appendix L Table L-II). Copy
|
|
2461
|
+
* on read. `undefined` when the edit-start measure carried none and none
|
|
2462
|
+
* have been set since. Keys are stored as given — canonicalisation to
|
|
2463
|
+
* doctrinal field codes happens in the core render seam, not here.
|
|
2464
|
+
*/
|
|
2465
|
+
readonly textAmplifiers: TextAmplifiers | undefined;
|
|
2466
|
+
/** Live user-adjusted anchors for individually rendered text amplifiers. */
|
|
2467
|
+
readonly amplifierPlacements: AmplifierPlacements | undefined;
|
|
2468
|
+
/** `true` after the first working-copy mutation; back to `false` within tolerance. */
|
|
2469
|
+
readonly dirty: boolean;
|
|
2470
|
+
readonly modes: readonly EditMode[];
|
|
2471
|
+
/**
|
|
2472
|
+
* Whether reshape mode shows the measure's detail handles: fine-adjustment
|
|
2473
|
+
* option handles such as the per-vertex width grips on arrow shafts.
|
|
2474
|
+
* Initialised from `EditOptions.detailHandles` and mutated by
|
|
2475
|
+
* [[setDetailHandles]].
|
|
1416
2476
|
*/
|
|
1417
|
-
readonly
|
|
2477
|
+
readonly detailHandles: boolean;
|
|
1418
2478
|
/**
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
2479
|
+
* The primary sub-selected part of a graphic whose definition divides it
|
|
2480
|
+
* into parts (`ControlMeasureTopology.partOf`), e.g. the index of the Flow
|
|
2481
|
+
* Arrow's selected flow (ADR-0065): the part most recently added to
|
|
2482
|
+
* [[selectedParts]]. Hosts read it to edit the part's own settings. Starts
|
|
2483
|
+
* at `0`; pressing a point or midpoint, or clicking the graphic's body,
|
|
2484
|
+
* selects the part under the pointer alone, and an edit or undo that removes
|
|
2485
|
+
* the selected part falls back to `0`. Dragging a point or midpoint of a part
|
|
2486
|
+
* that is already selected keeps the selection; a click on it without a drag
|
|
2487
|
+
* selects it alone. `undefined` for graphics without parts.
|
|
1424
2488
|
*/
|
|
1425
|
-
readonly
|
|
2489
|
+
readonly selectedPart: number | undefined;
|
|
1426
2490
|
/**
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
2491
|
+
* Every sub-selected part, [[selectedPart]] included, ascending. Reshape
|
|
2492
|
+
* mode shows the option grips of each. Never empty while the graphic has
|
|
2493
|
+
* parts; empty for graphics without parts. An edit or undo drops parts the
|
|
2494
|
+
* graphic no longer has (promoting the primary if it went), and when the
|
|
2495
|
+
* part count changes the set collapses to its primary, since parts are
|
|
2496
|
+
* indices and the ones after a removed part shift.
|
|
1431
2497
|
*/
|
|
1432
|
-
|
|
1433
|
-
/** `true` when any member's working state differs from its edit-start input beyond tolerance. */
|
|
1434
|
-
readonly dirty: boolean;
|
|
2498
|
+
readonly selectedParts: readonly number[];
|
|
1435
2499
|
/**
|
|
1436
|
-
* Live size anchor
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1439
|
-
* pixel/meter size is its own anchor and is never rewritten by this setting.
|
|
1440
|
-
* Initialised from `EditManyOptions.sizeAnchor` and mutated by [[setSizeAnchor]].
|
|
2500
|
+
* Live size anchor for the measure under edit (ADR-0020). `"ground"` bakes a
|
|
2501
|
+
* pixel size to meters on commit; `"screen"` keeps it zoom-aware. Initialised
|
|
2502
|
+
* from `EditOptions.sizeAnchor` and mutated by [[setSizeAnchor]].
|
|
1441
2503
|
*/
|
|
1442
2504
|
readonly sizeAnchor: SizeAnchor;
|
|
1443
2505
|
/**
|
|
1444
|
-
*
|
|
1445
|
-
*
|
|
1446
|
-
* members are unaffected.
|
|
2506
|
+
* Whether this ground-anchored measure has one or more sizes that can be
|
|
2507
|
+
* restored at the adapter's current resolution.
|
|
1447
2508
|
*/
|
|
1448
|
-
|
|
2509
|
+
readonly canResetGroundSizes: boolean;
|
|
1449
2510
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
2511
|
+
* Commit: returns the `GraphicSnapshot<ControlMeasure>` of the current working state
|
|
2512
|
+
* and resolves the outer `edit` promise with the same value (the same
|
|
2513
|
+
* reference — no double-bake of ground-anchored sizes). Returns `undefined`
|
|
2514
|
+
* after the session has settled (idempotent no-op).
|
|
1453
2515
|
*/
|
|
1454
|
-
|
|
2516
|
+
close(): GraphicSnapshot<ControlMeasure> | undefined;
|
|
2517
|
+
/** Reject the outer `edit` promise with reason `"session"`. */
|
|
2518
|
+
abort(): void;
|
|
1455
2519
|
/**
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
2520
|
+
* Switch the active edit-mode set. `"reshape"` produces vertex/midpoint
|
|
2521
|
+
* handles; `"transform"` renders the oriented selection box (corner scale
|
|
2522
|
+
* handles, rotate grip, body translate — ADR-0017); `"delete"` is exclusive
|
|
2523
|
+
* (vertex-tap removal) and collapses the set to delete-only. An unknown mode
|
|
2524
|
+
* is rejected with `TypeError`.
|
|
1459
2525
|
*/
|
|
1460
|
-
|
|
2526
|
+
setModes(modes: readonly EditMode[]): void;
|
|
1461
2527
|
/**
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
*
|
|
2528
|
+
* Show or hide the detail handles (see [[detailHandles]]). View state only:
|
|
2529
|
+
* no change event, no history entry. A silent no-op after settlement.
|
|
2530
|
+
*/
|
|
2531
|
+
setDetailHandles(visible: boolean): void;
|
|
2532
|
+
/**
|
|
2533
|
+
* Select `part` alone (see [[selectedPart]]), or with `extend` toggle it in
|
|
2534
|
+
* or out of [[selectedParts]]: a part toggled in becomes primary; toggling
|
|
2535
|
+
* the primary out promotes the most recently added remaining part; toggling
|
|
2536
|
+
* out the last part is a no-op. View state only: no change event, no
|
|
2537
|
+
* history entry. A no-op for a part the working graphic doesn't have, for
|
|
2538
|
+
* graphics without parts, and after settlement.
|
|
2539
|
+
*/
|
|
2540
|
+
selectPart(part: number, opts?: {
|
|
2541
|
+
extend?: boolean;
|
|
2542
|
+
}): void;
|
|
2543
|
+
/**
|
|
2544
|
+
* Replace [[selectedParts]] (e.g. "All flows"), ignoring parts the graphic
|
|
2545
|
+
* doesn't have. `primary`, when it is among them, becomes [[selectedPart]];
|
|
2546
|
+
* otherwise the last listed part does. View state only, like
|
|
2547
|
+
* [[selectPart]]; a no-op without a valid part.
|
|
2548
|
+
*/
|
|
2549
|
+
selectParts(parts: readonly number[], primary?: number): void;
|
|
2550
|
+
/**
|
|
2551
|
+
* Subscribe to part selection changes, from the pointer, [[selectPart]],
|
|
2552
|
+
* [[selectParts]] or the reconcile after an edit or undo. Called once per
|
|
2553
|
+
* effective change with the primary and the full set; a call that changes
|
|
2554
|
+
* neither doesn't notify. Returns an unsubscribe function; registering
|
|
2555
|
+
* after settlement is a no-op.
|
|
2556
|
+
*/
|
|
2557
|
+
onPartSelect(listener: (part: number | undefined, parts: readonly number[]) => void): () => void;
|
|
2558
|
+
/** Atomically replace the live working graphic while preserving id and kind. */
|
|
2559
|
+
updateGraphic(updater: (graphic: ControlMeasure) => ControlMeasure): void;
|
|
2560
|
+
/** Shallow-merge per-measure generator options into the live working copy. */
|
|
2561
|
+
setOptions(partial: ControlMeasure["options"]): void;
|
|
2562
|
+
/**
|
|
2563
|
+
* Flip the size anchor (ADR-0020). Takes effect on the next emitted snapshot
|
|
2564
|
+
* and on `close()`. A no-op for measures with no pixel-denominated size. The
|
|
2565
|
+
* in-flight preview is unaffected (it renders from the working options), so a
|
|
2566
|
+
* screen-locked symbol stays screen-locked until commit.
|
|
1498
2567
|
*
|
|
1499
|
-
* `
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
2568
|
+
* `options` shallow-merges a size-option patch in the *same* mutation, as
|
|
2569
|
+
* [[setOptions]] would. Changing a measure's size mode means moving its value
|
|
2570
|
+
* between the pixel and meter halves of a size pair *and* re-anchoring, and
|
|
2571
|
+
* the halves are only meaningful together: options carrying a pixel size
|
|
2572
|
+
* under a `"ground"` anchor bake that size away on commit, so a host that
|
|
2573
|
+
* emitted the two as separate mutations would leave an undo step parked on a
|
|
2574
|
+
* state whose committed size mode contradicts its own options. Passed here
|
|
2575
|
+
* they are one change event and one history entry, which undo cannot land
|
|
2576
|
+
* inside.
|
|
1506
2577
|
*/
|
|
1507
|
-
|
|
2578
|
+
setSizeAnchor(anchor: SizeAnchor, options?: ControlMeasure["options"]): void;
|
|
1508
2579
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1513
|
-
* snapshot was returned from that `setGraphics` call (and delivered to
|
|
1514
|
-
* [[onCommit]] at that time). Returns `undefined` after the session has
|
|
1515
|
-
* settled (idempotent no-op).
|
|
2580
|
+
* Reset every geometry and label size to its default on-screen appearance at
|
|
2581
|
+
* the current map resolution, persisted in meters. The measure stays
|
|
2582
|
+
* ground-anchored and the reset is one undoable programmatic mutation.
|
|
2583
|
+
* No-op when [[canResetGroundSizes]] is false or after settlement.
|
|
1516
2584
|
*/
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
|
|
2585
|
+
resetGroundSizes(): void;
|
|
2586
|
+
/** Shallow-merge per-measure style into the live working copy. */
|
|
2587
|
+
setStyle(partial: ControlMeasureStyle): void;
|
|
1520
2588
|
/**
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
|
|
2589
|
+
* Shallow-merge into the live working text amplifiers. A value of
|
|
2590
|
+
* `undefined` or an empty/whitespace-only string deletes that key; the
|
|
2591
|
+
* working record collapses back to `undefined` once it holds no keys. A
|
|
2592
|
+
* silent no-op after the session has settled (like [[setOptions]]).
|
|
2593
|
+
*/
|
|
2594
|
+
setTextAmplifiers(partial: Record<string, string | undefined>): void;
|
|
2595
|
+
/**
|
|
2596
|
+
* Merge field-keyed label overrides (position and/or rotation). The merge is
|
|
2597
|
+
* **field-wise per key**: a bare `Position` value means `{ position }`;
|
|
2598
|
+
* fields absent from the incoming value (e.g. `rotation` when only
|
|
2599
|
+
* `position` is supplied) are preserved from the existing entry; an
|
|
2600
|
+
* explicit `undefined` value deletes the key entirely — a full reset to the
|
|
2601
|
+
* doctrinal placement (both position and rotation).
|
|
2602
|
+
*/
|
|
2603
|
+
setAmplifierPlacements(partial: Record<string, AmplifierPlacement | undefined>): void;
|
|
2604
|
+
/**
|
|
2605
|
+
* Subscribe to working-copy changes. The listener receives an
|
|
2606
|
+
* [[EditChangeEvent]] for each completed gesture (drag end, insert/delete
|
|
2607
|
+
* via handle) — never on rubber-band ticks. All currently-registered
|
|
2608
|
+
* listeners receive the same event instance in registration order.
|
|
1526
2609
|
*
|
|
1527
2610
|
* Listener exceptions are collected; after every listener has run, they are
|
|
1528
2611
|
* rethrown (one if single, aggregated otherwise). `event.reject()` /
|
|
1529
2612
|
* `event.close()` / `event.abort()` take effect only after all listeners
|
|
1530
|
-
* have run
|
|
2613
|
+
* have run.
|
|
1531
2614
|
*/
|
|
1532
|
-
onChange(listener: (event:
|
|
2615
|
+
onChange(listener: (event: EditChangeEvent) => void): () => void;
|
|
1533
2616
|
/**
|
|
1534
|
-
* Subscribe to committed
|
|
1535
|
-
*
|
|
1536
|
-
* exactly once
|
|
1537
|
-
*
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
* a click-away close, or `TransformChangeEvent.close()`.
|
|
1542
|
-
*
|
|
1543
|
-
* Never fires on an abort/reject path — pair it with [[onSettled]] to also
|
|
1544
|
-
* observe abort settles. Fires synchronously from within the
|
|
1545
|
-
* `setGraphics`/`close` call that produced the batch, before that call
|
|
1546
|
-
* returns, and the array delivered here is the same reference that call
|
|
1547
|
-
* returns (and, for the close batch, the same reference the `editMany`
|
|
1548
|
-
* promise resolves with). This is the recommended single fold path for exit
|
|
1549
|
-
* state — subscribe once in `onSession` and every committed snapshot, from
|
|
1550
|
-
* either delivery site, arrives here exactly once; the `setGraphics` return
|
|
1551
|
-
* value and the promise resolution are unchanged and remain valid for
|
|
1552
|
-
* backward compatibility.
|
|
2617
|
+
* Subscribe to the committed snapshot — the single delivery channel for the
|
|
2618
|
+
* `GraphicSnapshot<ControlMeasure>` this session ever commits (#197, mirroring
|
|
2619
|
+
* `TransformSession.onCommit` #191). Fires exactly once, synchronously from
|
|
2620
|
+
* within the [[close]] call that produced it (`session.close()`,
|
|
2621
|
+
* `event.close()` from [[onChange]], a click-away close, or a click on
|
|
2622
|
+
* another graphics-layer measure), with the same reference [[close]]
|
|
2623
|
+
* returns and the outer `edit` promise resolves with. Never fires on abort.
|
|
1553
2624
|
*
|
|
1554
2625
|
* Listener exceptions are collected; after every listener has run, they are
|
|
1555
2626
|
* rethrown (one if single, `AggregateError` otherwise) — mirrors
|
|
@@ -1557,21 +2628,21 @@ interface TransformSession {
|
|
|
1557
2628
|
* session has settled returns a no-op unsubscribe and the listener never
|
|
1558
2629
|
* fires.
|
|
1559
2630
|
*/
|
|
1560
|
-
onCommit(handler: (
|
|
2631
|
+
onCommit(handler: (snapshot: GraphicSnapshot<ControlMeasure>) => void): () => void;
|
|
1561
2632
|
/**
|
|
1562
2633
|
* Subscribe to the session's settlement — the lifecycle complement of
|
|
1563
2634
|
* [[onCommit]]: `onCommit` delivers *what* was committed, `onSettled` says
|
|
1564
|
-
* the session is *over* and why (#
|
|
1565
|
-
*
|
|
2635
|
+
* the session is *over* and why (#197, mirroring
|
|
2636
|
+
* `TransformSession.onSettled` #194). Fires exactly once, when the session
|
|
2637
|
+
* settles by any path, commit or abort, with a `SettleReason`.
|
|
1566
2638
|
*
|
|
1567
|
-
* - On commit
|
|
1568
|
-
*
|
|
1569
|
-
*
|
|
1570
|
-
* - On every path it fires **after** the facade has already cleared
|
|
1571
|
-
*
|
|
1572
|
-
* from inside the handler.
|
|
2639
|
+
* - On the commit path it fires **after** [[onCommit]]'s emission, so a
|
|
2640
|
+
* listener that clears selection state observes a document that already
|
|
2641
|
+
* contains the committed snapshot.
|
|
2642
|
+
* - On every path it fires **after** the facade has already cleared
|
|
2643
|
+
* `td.activeSession` — so fold-then-render works from inside the handler.
|
|
1573
2644
|
* - `reason` distinguishes commit from abort but is deliberately coarse —
|
|
1574
|
-
* no payload;
|
|
2645
|
+
* no payload; the snapshot was already delivered through [[onCommit]].
|
|
1575
2646
|
*
|
|
1576
2647
|
* Registering after the session has already settled is **not** a no-op
|
|
1577
2648
|
* (unlike [[onChange]] / [[onCommit]]): the handler is invoked
|
|
@@ -1583,32 +2654,50 @@ interface TransformSession {
|
|
|
1583
2654
|
* [[onChange]] / [[onCommit]]. Returns an unsubscribe function.
|
|
1584
2655
|
*/
|
|
1585
2656
|
onSettled(handler: (reason: SettleReason) => void): () => void;
|
|
2657
|
+
/**
|
|
2658
|
+
* Subscribe to the continuous stream of in-flight geometry mutations —
|
|
2659
|
+
* vertex/midpoint drags and box scale/rotate/translate gestures — fired
|
|
2660
|
+
* throughout the gesture rather than once at its end (contrast
|
|
2661
|
+
* [[onChange]]). `start` fires at gesture begin, `move` on every pointer
|
|
2662
|
+
* tick, and `end` fires exactly once when the gesture finishes by any
|
|
2663
|
+
* path: commit, a click-slop no-op (a box body click that never becomes a
|
|
2664
|
+
* drag), or session abort/teardown mid-drag. `end` fires **before** the
|
|
2665
|
+
* gesture's [[onChange]] emission (and, on the commit path, before
|
|
2666
|
+
* [[onCommit]]/[[onSettled]] too), so a listener observing both channels
|
|
2667
|
+
* sees the transient stream close first.
|
|
2668
|
+
*
|
|
2669
|
+
* Label-placement drags (`labeldrag` mode) do not fire this — they move
|
|
2670
|
+
* amplifier placements, not control points.
|
|
2671
|
+
*
|
|
2672
|
+
* Listener exceptions are collected; after every listener has run, they
|
|
2673
|
+
* are rethrown (one if single, `AggregateError` otherwise) — mirrors
|
|
2674
|
+
* [[onChange]]. Returns an unsubscribe function; registering after the
|
|
2675
|
+
* session has settled returns a no-op unsubscribe and the listener never
|
|
2676
|
+
* fires.
|
|
2677
|
+
*/
|
|
2678
|
+
onTransientChange(listener: (event: TransientChangeEvent) => void): () => void;
|
|
1586
2679
|
}
|
|
1587
2680
|
/**
|
|
1588
|
-
* Delivered to `
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1594
|
-
* `close()` and `abort()` still apply, against the new membership. See
|
|
1595
|
-
* `EditChangeEvent` for the identical emission contract this mirrors.
|
|
2681
|
+
* Delivered to `EditSession.onChange` listeners once per completed gesture.
|
|
2682
|
+
*
|
|
2683
|
+
* Listeners see the *same* event instance in registration order. Per-gesture
|
|
2684
|
+
* effects (`reject`, `close`, `abort`) are recorded during emission and
|
|
2685
|
+
* applied after every listener has run, so a downstream listener cannot
|
|
2686
|
+
* observe partial state. See PRD #40 user-stories 23–24.
|
|
1596
2687
|
*/
|
|
1597
|
-
interface
|
|
2688
|
+
interface EditChangeEvent {
|
|
1598
2689
|
/** How this working-copy transition was initiated. */
|
|
1599
2690
|
readonly source: SessionChangeSource;
|
|
1600
|
-
/** Working state after the completed gesture
|
|
1601
|
-
readonly
|
|
1602
|
-
/** State immediately before this gesture
|
|
1603
|
-
readonly previous: GraphicSnapshot
|
|
2691
|
+
/** Working state after the completed gesture. */
|
|
2692
|
+
readonly graphic: GraphicSnapshot<ControlMeasure>;
|
|
2693
|
+
/** State immediately before this gesture. */
|
|
2694
|
+
readonly previous: GraphicSnapshot<ControlMeasure>;
|
|
1604
2695
|
/** The session the event belongs to. */
|
|
1605
|
-
readonly session:
|
|
2696
|
+
readonly session: EditSession;
|
|
1606
2697
|
/**
|
|
1607
|
-
* Roll
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
* emission, and dropped if a listener called `session.setGraphics` (the
|
|
1611
|
-
* rollback baseline no longer matches the member set).
|
|
2698
|
+
* Roll the working preview back to `previous` after all listeners have run.
|
|
2699
|
+
* Multiple calls collapse to a single rollback. Overridden by `close()` or
|
|
2700
|
+
* `abort()` if either is also called during this emission.
|
|
1612
2701
|
*/
|
|
1613
2702
|
reject(): void;
|
|
1614
2703
|
/** Shortcut for `event.session.close()`, deferred until the emission ends. */
|
|
@@ -1705,85 +2794,6 @@ interface DrawSession {
|
|
|
1705
2794
|
onTransientChange(listener: (event: TransientChangeEvent) => void): () => void;
|
|
1706
2795
|
}
|
|
1707
2796
|
//#endregion
|
|
1708
|
-
//#region src/tactical-draw/snapping.d.ts
|
|
1709
|
-
type SnapInteraction = "draw" | "reshape" | "translate" | "label-drag";
|
|
1710
|
-
interface SnapCandidateRequest {
|
|
1711
|
-
coordinate: Position;
|
|
1712
|
-
pixel: PixelCoordinate;
|
|
1713
|
-
interaction: SnapInteraction;
|
|
1714
|
-
graphicId?: string;
|
|
1715
|
-
/**
|
|
1716
|
-
* Every graphic a multi-selection moves together; candidates of any of them
|
|
1717
|
-
* are skipped, so the group never snaps onto itself. Set instead of `graphicId`.
|
|
1718
|
-
*/
|
|
1719
|
-
graphicIds?: readonly string[];
|
|
1720
|
-
controlPointIndex?: number;
|
|
1721
|
-
originalEvent?: unknown;
|
|
1722
|
-
}
|
|
1723
|
-
interface SnapCandidate {
|
|
1724
|
-
id: string;
|
|
1725
|
-
coordinate: Position;
|
|
1726
|
-
kind: string;
|
|
1727
|
-
graphicId?: string;
|
|
1728
|
-
controlPointIndex?: number;
|
|
1729
|
-
priority?: number;
|
|
1730
|
-
}
|
|
1731
|
-
/**
|
|
1732
|
-
* Host snap candidates near `request`. A provider that leaves out the moving
|
|
1733
|
-
* graphic's own candidates should check `request.graphicIds` (a multi-selection)
|
|
1734
|
-
* as well as `request.graphicId`. A move or scale that tests several
|
|
1735
|
-
* points of a graphic (a control measure's control points, a Note's or an
|
|
1736
|
-
* Image's corners and centre) asks once per tested point on each pointer move,
|
|
1737
|
-
* so keep it cheap: return only candidates near `request.pixel`.
|
|
1738
|
-
*/
|
|
1739
|
-
type SnapCandidateProvider = (request: SnapCandidateRequest) => readonly SnapCandidate[];
|
|
1740
|
-
/**
|
|
1741
|
-
* A snap the host answers later, such as one to terrain it has to sample
|
|
1742
|
-
* first. Asked on every reshape and translate move of a control-measure edit,
|
|
1743
|
-
* at the position the other sources snapped it to (for a translate, the moved
|
|
1744
|
-
* first control point). Return `null` to have no say in this move, and the
|
|
1745
|
-
* drag follows the pointer at once; otherwise the drag holds where it was
|
|
1746
|
-
* until the promise settles, then lands at the position it resolves to, or at
|
|
1747
|
-
* the pointer for `null`. An answer lands unless a later move's landed first,
|
|
1748
|
-
* so a drag keeps up while answers are slow. A release waits for the answer
|
|
1749
|
-
* to where it was let go before committing, so the gesture is still one
|
|
1750
|
-
* change. `signal` aborts once the drag is over or the edit settles.
|
|
1751
|
-
*
|
|
1752
|
-
* The host decides how far it reaches: neither `enabled` nor
|
|
1753
|
-
* `tolerancePixels` applies. `bypass` does.
|
|
1754
|
-
*/
|
|
1755
|
-
type DeferredSnapProvider = (request: SnapCandidateRequest, signal: AbortSignal) => Promise<Position | null> | null;
|
|
1756
|
-
interface SnapResult {
|
|
1757
|
-
coordinate: Position;
|
|
1758
|
-
pixel: PixelCoordinate;
|
|
1759
|
-
candidate: SnapCandidate;
|
|
1760
|
-
distancePixels: number;
|
|
1761
|
-
}
|
|
1762
|
-
interface GraphicGeometrySnappingOptions {
|
|
1763
|
-
/** Snap to the nearest point along generated linework and polygon boundaries. Default `true`. */
|
|
1764
|
-
edges?: boolean;
|
|
1765
|
-
/** Snap to generated geometry vertices. Default `false`. */
|
|
1766
|
-
vertices?: boolean;
|
|
1767
|
-
}
|
|
1768
|
-
interface SnappingOptions {
|
|
1769
|
-
enabled?: boolean;
|
|
1770
|
-
tolerancePixels?: number;
|
|
1771
|
-
sources?: {
|
|
1772
|
-
graphics?: boolean;
|
|
1773
|
-
/**
|
|
1774
|
-
* Snap to generated control-measure geometry. `true` enables edges with
|
|
1775
|
-
* vertices disabled; pass an object to select either candidate type.
|
|
1776
|
-
* Text/label point features and the active graphic are excluded.
|
|
1777
|
-
*/
|
|
1778
|
-
graphicGeometry?: boolean | GraphicGeometrySnappingOptions;
|
|
1779
|
-
external?: SnapCandidateProvider;
|
|
1780
|
-
deferred?: DeferredSnapProvider;
|
|
1781
|
-
};
|
|
1782
|
-
bypass?: (originalEvent: unknown) => boolean;
|
|
1783
|
-
/** Called for each resolution attempt; `null` clears a host-rendered indicator. */
|
|
1784
|
-
onSnap?: (result: SnapResult | null) => void;
|
|
1785
|
-
}
|
|
1786
|
-
//#endregion
|
|
1787
2797
|
//#region src/tactical-draw/point-symbol-draw-controller.d.ts
|
|
1788
2798
|
type DrawPointSymbolDraft = Pick<PointSymbol, "kind" | "sidc"> & Partial<Omit<PointSymbol, "kind" | "sidc">>;
|
|
1789
2799
|
//#endregion
|
|
@@ -1811,7 +2821,7 @@ declare const DEFAULT_MARKER_SIZE: MarkerSize;
|
|
|
1811
2821
|
interface TacticalDrawLayerOptions {
|
|
1812
2822
|
graphics?: LayerId;
|
|
1813
2823
|
/**
|
|
1814
|
-
* Passive selection-highlight outlines ({@link TacticalDraw.
|
|
2824
|
+
* Passive selection-highlight outlines ({@link TacticalDraw.setPassiveOutlines}).
|
|
1815
2825
|
* Resolved immediately above `graphics` so highlight boxes stack over base
|
|
1816
2826
|
* graphics but below the preview / guide / handles interaction chrome.
|
|
1817
2827
|
*/
|
|
@@ -1832,6 +2842,25 @@ interface InteractionHit {
|
|
|
1832
2842
|
/** Control-measure id when the hit feature belongs to one (graphics/preview parts). */
|
|
1833
2843
|
measureId?: string;
|
|
1834
2844
|
}
|
|
2845
|
+
/**
|
|
2846
|
+
* A passive outline target ({@link TacticalDraw.setPassiveOutlines}): a bare
|
|
2847
|
+
* graphic id outlines the whole graphic; `{ id, memberId }` outlines one
|
|
2848
|
+
* collocation member (ADR-0063).
|
|
2849
|
+
*/
|
|
2850
|
+
type PassiveOutlineTarget = string | {
|
|
2851
|
+
id: string;
|
|
2852
|
+
memberId: string;
|
|
2853
|
+
};
|
|
2854
|
+
/**
|
|
2855
|
+
* A pick as `td.onPick` / `td.onGraphicPick` handlers receive it: the
|
|
2856
|
+
* adapter's {@link PickEvent} plus the modifier keys held, read the same way
|
|
2857
|
+
* in every engine (#754), so a handler can extend a selection on Shift or
|
|
2858
|
+
* Primary without guarding `originalEvent`.
|
|
2859
|
+
*/
|
|
2860
|
+
interface TacticalDrawPickEvent extends PickEvent {
|
|
2861
|
+
modifiers: PickModifiers;
|
|
2862
|
+
}
|
|
2863
|
+
type TacticalDrawPickHandler = (event: TacticalDrawPickEvent) => void;
|
|
1835
2864
|
interface TacticalDrawOptions {
|
|
1836
2865
|
/** Optional point-symbol body-drag shortcut; disabled when omitted or false. */
|
|
1837
2866
|
offsetDragModifier?: OffsetDragModifier | false;
|
|
@@ -1907,16 +2936,56 @@ interface TacticalDrawOptions {
|
|
|
1907
2936
|
generateId?: () => string;
|
|
1908
2937
|
/** Optional engine-level snapping for draw and edit interactions. */
|
|
1909
2938
|
snapping?: SnappingOptions;
|
|
2939
|
+
/**
|
|
2940
|
+
* Opt-in Collocation support (ADR-0063), from `createCollocationSupport()`.
|
|
2941
|
+
* Without it, rendering, drawing or editing a Collocation throws
|
|
2942
|
+
* `CollocationSupportRequiredError`. What a ground move of a collocation
|
|
2943
|
+
* changes is set there too (`createCollocationSupport({ resolveTransform })`).
|
|
2944
|
+
*/
|
|
2945
|
+
collocations?: CollocationSupport;
|
|
1910
2946
|
}
|
|
1911
2947
|
interface EditOptions {
|
|
1912
2948
|
/** Override the point-symbol offset shortcut for this edit; false disables it. */
|
|
1913
2949
|
offsetDragModifier?: OffsetDragModifier | false;
|
|
2950
|
+
/**
|
|
2951
|
+
* Point symbols only: the host's drop of the symbol into a collocation with
|
|
2952
|
+
* a body offset drag (#760); see {@link OffsetDropHandler}. Away from every
|
|
2953
|
+
* collocation `targetAt` names, the drag moves the offset as usual. Needs
|
|
2954
|
+
* `createCollocationSupport()`.
|
|
2955
|
+
*/
|
|
2956
|
+
offsetDrop?: OffsetDropHandler;
|
|
2957
|
+
/**
|
|
2958
|
+
* Collocations only: the host's removal of a member that a `"rearrange"` drag
|
|
2959
|
+
* dropped well clear of both parts (#759). The host owns which graphics
|
|
2960
|
+
* make up a collocation, and what happens when fewer than two remain, so
|
|
2961
|
+
* the edit commits nothing for the drop. Without it no drop removes.
|
|
2962
|
+
*/
|
|
2963
|
+
onRemoveMember?: (memberId: string) => void;
|
|
2964
|
+
/**
|
|
2965
|
+
* Collocations only: how a dragged part is stored. `"keep"` (default)
|
|
2966
|
+
* keeps a ground part on the ground and makes anything else
|
|
2967
|
+
* screen-relative; `"ground"` and `"screen-relative"` always store that
|
|
2968
|
+
* mode, e.g. `"ground"` for a host whose parts mark ground positions.
|
|
2969
|
+
*/
|
|
2970
|
+
partDrag?: CollocationPartDrag;
|
|
2971
|
+
/**
|
|
2972
|
+
* Collocations only: under `partDrag: "keep"`, the farthest a dragged part
|
|
2973
|
+
* is stored screen-relative, in CSS px at collocation scale 1 from the
|
|
2974
|
+
* location to the part's registration (the Bracket's tick root, the
|
|
2975
|
+
* Staff's foot); further, it is stored on the ground. A location or
|
|
2976
|
+
* member move that keeps parts where they are on screen follows the same
|
|
2977
|
+
* rule. A long screen-relative leader is drawn into the part's image, so
|
|
2978
|
+
* its size grows with the leader's bounding box. Default
|
|
2979
|
+
* `COLLOCATION_SCREEN_RELATIVE_REACH` (200); `Infinity` keeps every
|
|
2980
|
+
* drag screen-relative.
|
|
2981
|
+
*/
|
|
2982
|
+
screenRelativeReach?: number;
|
|
1914
2983
|
signal?: AbortSignal;
|
|
1915
2984
|
/**
|
|
1916
2985
|
* Called synchronously once when the edit starts, before any pointer event
|
|
1917
2986
|
* is processed. Lets a host wire commit / cancel buttons to the active edit.
|
|
1918
2987
|
*/
|
|
1919
|
-
onSession?: (session: EditSession | GraphicEditSession<PointSymbol> | GraphicEditSession<ImageGraphic> | GraphicEditSession<NoteGraphic> | GraphicEditSession<Marker>) => void;
|
|
2988
|
+
onSession?: (session: EditSession | GraphicEditSession<PointSymbol> | GraphicEditSession<ImageGraphic> | GraphicEditSession<NoteGraphic> | GraphicEditSession<Marker> | CollocationEditSession) => void;
|
|
1920
2989
|
/**
|
|
1921
2990
|
* Default `true`. When `true`, a click on empty map (or on another graphics
|
|
1922
2991
|
* layer measure) closes the active edit. Clicks on preview / handle
|
|
@@ -2000,6 +3069,23 @@ interface EditManyOptions {
|
|
|
2000
3069
|
* session, where the other options are ignored.
|
|
2001
3070
|
*/
|
|
2002
3071
|
memberOutlines?: boolean;
|
|
3072
|
+
/**
|
|
3073
|
+
* The host's own gesture for a body drag with the offset-drag key held
|
|
3074
|
+
* (see {@link GroupOffsetDragHandler}): a host collocates the set, say,
|
|
3075
|
+
* previewing the collocation as the pointer moves. Without it such a drag
|
|
3076
|
+
* moves the set as any body drag does. Needs `createCollocationSupport()`.
|
|
3077
|
+
*/
|
|
3078
|
+
offsetDrag?: GroupOffsetDragHandler;
|
|
3079
|
+
/**
|
|
3080
|
+
* The host's drop of the set into a collocation with that drag (#760), when
|
|
3081
|
+
* every member is a point symbol or Marker; see {@link OffsetDropHandler}.
|
|
3082
|
+
* The members join in the order they are given. Over a collocation
|
|
3083
|
+
* `targetAt` names this wins; elsewhere `offsetDrag` runs. Needs
|
|
3084
|
+
* `createCollocationSupport()`.
|
|
3085
|
+
*/
|
|
3086
|
+
offsetDrop?: OffsetDropHandler;
|
|
3087
|
+
/** Override the offset-drag key for this transform; `false` disables the gesture. */
|
|
3088
|
+
offsetDragModifier?: OffsetDragModifier | false;
|
|
2003
3089
|
}
|
|
2004
3090
|
/**
|
|
2005
3091
|
* A host-defined set of graphics outlined together as one passive box
|
|
@@ -2100,6 +3186,9 @@ declare class TacticalDraw {
|
|
|
2100
3186
|
private readonly images;
|
|
2101
3187
|
private readonly notes;
|
|
2102
3188
|
private readonly markers;
|
|
3189
|
+
/** The member kind → capability table collocations draw with, built once. */
|
|
3190
|
+
private readonly collocationMembers;
|
|
3191
|
+
private readonly collocations;
|
|
2103
3192
|
private snappingOptions;
|
|
2104
3193
|
private readonly resolveSnap;
|
|
2105
3194
|
private readonly resolveDeferredSnap;
|
|
@@ -2183,12 +3272,12 @@ declare class TacticalDraw {
|
|
|
2183
3272
|
private noteResolveCache;
|
|
2184
3273
|
private lastSeenMarkerGeneration;
|
|
2185
3274
|
/**
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2188
|
-
* re-
|
|
2189
|
-
*
|
|
3275
|
+
* Current passive outline targets ({@link setPassiveOutlines}). Declarative
|
|
3276
|
+
* set-replace, no session — re-projected on every view change and
|
|
3277
|
+
* re-evaluated at the end of every `render()` so outlines track geometry,
|
|
3278
|
+
* style, and dropped graphics.
|
|
2190
3279
|
*/
|
|
2191
|
-
private
|
|
3280
|
+
private passiveOutlines;
|
|
2192
3281
|
/** Graphic sets outlined as one box each ({@link setHighlightedGroups}). */
|
|
2193
3282
|
private highlightedGroups;
|
|
2194
3283
|
private pinBodies;
|
|
@@ -2204,7 +3293,7 @@ declare class TacticalDraw {
|
|
|
2204
3293
|
*/
|
|
2205
3294
|
private hasHighlightOutlines;
|
|
2206
3295
|
/**
|
|
2207
|
-
* Coalesces bursts of {@link
|
|
3296
|
+
* Coalesces bursts of {@link setPassiveOutlines} (e.g. hover across a
|
|
2208
3297
|
* list of rows) into at most one {@link renderHighlights} per animation
|
|
2209
3298
|
* frame. Every other caller — `render()`, view-change, session start /
|
|
2210
3299
|
* settle — needs highlight state updated synchronously and in step with
|
|
@@ -2289,6 +3378,20 @@ declare class TacticalDraw {
|
|
|
2289
3378
|
* per-frame reconcile cost becomes O(selection) rather than O(document).
|
|
2290
3379
|
*/
|
|
2291
3380
|
private renderGraphicGroup;
|
|
3381
|
+
/** The opted-in collocation support, or `CollocationSupportRequiredError`. */
|
|
3382
|
+
private requireCollocations;
|
|
3383
|
+
/**
|
|
3384
|
+
* Bind a session's offset drop (#760): the drag hides the target it aims
|
|
3385
|
+
* at in the graphics layer, and draws it joined on the preview layer.
|
|
3386
|
+
*/
|
|
3387
|
+
private bindOffsetDrop;
|
|
3388
|
+
/** A collocation's group, stamped like {@link buildGraphicGroup}, with the layout it drew. */
|
|
3389
|
+
private buildCollocationGroup;
|
|
3390
|
+
/**
|
|
3391
|
+
* The current layout of a rendered collocation, from the graphics-stack
|
|
3392
|
+
* render cache (built once and cached on a miss).
|
|
3393
|
+
*/
|
|
3394
|
+
private collocationLayout;
|
|
2292
3395
|
/**
|
|
2293
3396
|
* Render a Graphic group from scratch and stamp it with a fresh revision,
|
|
2294
3397
|
* drawn from the module-scoped {@link nextGraphicGroupRevision} counter (see
|
|
@@ -2363,20 +3466,23 @@ declare class TacticalDraw {
|
|
|
2363
3466
|
*/
|
|
2364
3467
|
render(measures: readonly Graphic[]): void;
|
|
2365
3468
|
/**
|
|
2366
|
-
* Replace the passive
|
|
2367
|
-
* idempotent (mirrors {@link render}): a non-interactive outline
|
|
2368
|
-
*
|
|
2369
|
-
*
|
|
2370
|
-
*
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
3469
|
+
* Replace the passive outline set with `targets`. Declarative and
|
|
3470
|
+
* idempotent (mirrors {@link render}): a non-interactive dashed outline is
|
|
3471
|
+
* drawn on the dedicated highlight layer — no draw / edit / transform
|
|
3472
|
+
* session, no promise, no pick subscription. Passing `[]` clears every
|
|
3473
|
+
* outline. Hosts use it for "locked selection" chrome and for hover.
|
|
3474
|
+
*
|
|
3475
|
+
* A bare id outlines the whole graphic; unknown ids and ids active in an
|
|
3476
|
+
* edit / transform session are skipped (the live session's own visuals
|
|
3477
|
+
* supersede the outline). A `{ id, memberId }` target outlines one
|
|
3478
|
+
* collocation member's extent and rings its position (ADR-0063); it stays
|
|
3479
|
+
* drawn during that collocation's own edit, following the live preview.
|
|
2374
3480
|
*/
|
|
2375
|
-
|
|
3481
|
+
setPassiveOutlines(targets: readonly PassiveOutlineTarget[]): void;
|
|
2376
3482
|
/**
|
|
2377
3483
|
* Replace the passive group outlines with `groups`: one outline box around
|
|
2378
3484
|
* the joint bounds of each group's still-rendered graphics, drawn with the
|
|
2379
|
-
* same style and on the same layer as {@link
|
|
3485
|
+
* same style and on the same layer as {@link setPassiveOutlines}, which
|
|
2380
3486
|
* it sits beside. Declarative like that set: `[]` clears every group
|
|
2381
3487
|
* outline. A graphic in an active edit or transform session still counts
|
|
2382
3488
|
* toward its group's bounds (at its last rendered geometry), so a host can
|
|
@@ -2384,16 +3490,23 @@ declare class TacticalDraw {
|
|
|
2384
3490
|
* rendered graphic draws nothing.
|
|
2385
3491
|
*/
|
|
2386
3492
|
setHighlightedGroups(groups: readonly HighlightedGroup[]): void;
|
|
3493
|
+
/**
|
|
3494
|
+
* @deprecated Use {@link setPassiveOutlines}; this alias forwards to it and
|
|
3495
|
+
* will be removed in a later major.
|
|
3496
|
+
*/
|
|
3497
|
+
setHighlightedGraphics(ids: readonly string[]): void;
|
|
2387
3498
|
/**
|
|
2388
3499
|
* Cancel any pending coalesced highlight frame and re-project highlights
|
|
2389
|
-
* immediately. Used by every caller other than `
|
|
3500
|
+
* immediately. Used by every caller other than `setPassiveOutlines`
|
|
2390
3501
|
* (`render()`, view-change, session start / settle) so their own
|
|
2391
3502
|
* synchronous effects and the highlight layer update together, with no
|
|
2392
3503
|
* frame of lag and no stale coalesced call left to fire afterwards.
|
|
2393
3504
|
*/
|
|
3505
|
+
/** Re-project passive outlines when one targets a member of collocation `id`. */
|
|
3506
|
+
private flushMemberOutlines;
|
|
2394
3507
|
private flushHighlights;
|
|
2395
3508
|
/**
|
|
2396
|
-
* Project the current {@link
|
|
3509
|
+
* Project the current {@link passiveOutlines} into one outline `LineString`
|
|
2397
3510
|
* per graphic and reconcile them onto the highlight layer. Idempotent and
|
|
2398
3511
|
* grouped by graphic id, so desired-state replacement removes stale outlines
|
|
2399
3512
|
* and an unchanged set is a cheap no-op write. Skips ids that are
|
|
@@ -2402,6 +3515,17 @@ declare class TacticalDraw {
|
|
|
2402
3515
|
* (`getCoordinateFromPixel` is optional in the MapAdapter ABI).
|
|
2403
3516
|
*/
|
|
2404
3517
|
private renderHighlights;
|
|
3518
|
+
/** The active edit when it is a single edit of collocation `id`. */
|
|
3519
|
+
private collocationEdit;
|
|
3520
|
+
/**
|
|
3521
|
+
* The collocation a member outline reads, with its layout: the working copy
|
|
3522
|
+
* and live layout while that collocation is edited on its own, else its last
|
|
3523
|
+
* render. `undefined` while a group transform holds it (the group box
|
|
3524
|
+
* supersedes the outline).
|
|
3525
|
+
*/
|
|
3526
|
+
private outlinedCollocation;
|
|
3527
|
+
/** The passive outline of one collocation member: its extent, and a ring at its position. */
|
|
3528
|
+
private memberOutlineFeatures;
|
|
2405
3529
|
/**
|
|
2406
3530
|
* Fit the passive-highlight transform box for one graphic: the point-symbol
|
|
2407
3531
|
* footprint for symbols, the snug text footprint for Text graphics, and the
|
|
@@ -2481,7 +3605,14 @@ declare class TacticalDraw {
|
|
|
2481
3605
|
edit(graphic: ImageGraphic, options?: EditOptions): Promise<GraphicSnapshot<ImageGraphic>>;
|
|
2482
3606
|
edit(graphic: NoteGraphic, options?: EditOptions): Promise<GraphicSnapshot<NoteGraphic>>;
|
|
2483
3607
|
edit(graphic: Marker, options?: EditOptions): Promise<GraphicSnapshot<Marker>>;
|
|
3608
|
+
edit(graphic: Collocation, options?: EditOptions): Promise<GraphicSnapshot<Collocation>>;
|
|
2484
3609
|
edit(measure: ControlMeasure, options?: EditOptions): Promise<GraphicSnapshot<ControlMeasure>>;
|
|
3610
|
+
/**
|
|
3611
|
+
* A single collocation edit (ADR-0063): part drags and a location handle,
|
|
3612
|
+
* no transform box. Clicks on a member or part still reach host pick
|
|
3613
|
+
* handlers (see {@link routePick}).
|
|
3614
|
+
*/
|
|
3615
|
+
private editCollocation;
|
|
2485
3616
|
/**
|
|
2486
3617
|
* Start an interactive group transform (multi-select) over `measures`
|
|
2487
3618
|
* (ADR-0017 "Multi-select" slice). Every host-provided member stays in its
|
|
@@ -2508,7 +3639,7 @@ declare class TacticalDraw {
|
|
|
2508
3639
|
* session is over and why.
|
|
2509
3640
|
*/
|
|
2510
3641
|
editMany(measures: ControlMeasure[], options?: EditManyOptions): Promise<GraphicSnapshot<ControlMeasure>[]>;
|
|
2511
|
-
editMany(
|
|
3642
|
+
editMany(targets: TransformTarget[], options?: EditManyOptions): Promise<GraphicSnapshot[]>;
|
|
2512
3643
|
/**
|
|
2513
3644
|
* One-call selection-sync: mutate a live transform's member set in place, or
|
|
2514
3645
|
* start a fresh `editMany` when none is live (#191). Any mix of control
|
|
@@ -2544,7 +3675,7 @@ declare class TacticalDraw {
|
|
|
2544
3675
|
* either path. Starting a fresh transform preempts any other in-flight
|
|
2545
3676
|
* draw/edit exactly like `editMany`.
|
|
2546
3677
|
*/
|
|
2547
|
-
syncTransformGraphics(graphics: readonly
|
|
3678
|
+
syncTransformGraphics(graphics: readonly TransformTarget[], options?: EditManyOptions): void;
|
|
2548
3679
|
/**
|
|
2549
3680
|
* Subscribe to picks on committed control measures.
|
|
2550
3681
|
*
|
|
@@ -2556,7 +3687,7 @@ declare class TacticalDraw {
|
|
|
2556
3687
|
* Returns an idempotent unsubscribe function. An optional `signal` removes
|
|
2557
3688
|
* the handler when aborted.
|
|
2558
3689
|
*/
|
|
2559
|
-
onGraphicPick(handler:
|
|
3690
|
+
onGraphicPick(handler: TacticalDrawPickHandler, opts?: PickOptions): () => void;
|
|
2560
3691
|
/**
|
|
2561
3692
|
* Subscribe to pick events on `layerId`. Routed through the façade so the
|
|
2562
3693
|
* close-then-pick contract (issue #52) is observable: when an active edit
|
|
@@ -2567,7 +3698,7 @@ declare class TacticalDraw {
|
|
|
2567
3698
|
*
|
|
2568
3699
|
* Returns an unsubscribe function. Optional `signal` mirrors `adapter.onPick`.
|
|
2569
3700
|
*/
|
|
2570
|
-
onPick(layerId: LayerId, handler:
|
|
3701
|
+
onPick(layerId: LayerId, handler: TacticalDrawPickHandler, opts?: PickOptions): () => void;
|
|
2571
3702
|
/**
|
|
2572
3703
|
* Stateless hit test answering "does TacticalDraw own the pixel at
|
|
2573
3704
|
* `pixel`?" — for hosts composing their own click-away / deselection logic
|
|
@@ -2734,39 +3865,8 @@ declare class NoteCapabilityRequiredError extends Error {
|
|
|
2734
3865
|
declare class MarkerCapabilityRequiredError extends Error {
|
|
2735
3866
|
constructor();
|
|
2736
3867
|
}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
/**
|
|
2740
|
-
* The Excalidraw/Felt-style transform box: the oriented bounding box drawn
|
|
2741
|
-
* around a selection, with 4 corner scale handles, a rotate grip above the
|
|
2742
|
-
* top edge, and drag-anywhere-inside-the-box translate. This module is the
|
|
2743
|
-
* single source of truth for box *placement* (`fitTransformBox`,
|
|
2744
|
-
* `boxCorners`, `rotateGripPixel`) AND box *picking* (`pointInBox`,
|
|
2745
|
-
* `pickBoxHandle`) — mirroring the ADR-0016 discipline that keeps
|
|
2746
|
-
* `handles.ts` owning vertex/midpoint placement/pick. Everything here is pure
|
|
2747
|
-
* pixel-space math: no projection, no rendering, no session state.
|
|
2748
|
-
*
|
|
2749
|
-
* **Angle convention**: `angle` is in radians, measured in screen pixel space
|
|
2750
|
-
* (y grows downward). A positive angle rotates the box clockwise as drawn on
|
|
2751
|
-
* screen — the same convention `rotatePointsAround` (`handle-drag.ts`) uses,
|
|
2752
|
-
* so box rotation and control-point rotation stay in lockstep.
|
|
2753
|
-
*
|
|
2754
|
-
* **Corner ordering**: `boxCorners` always returns
|
|
2755
|
-
* `[topLeft, topRight, bottomRight, bottomLeft]` in the box's own (unrotated)
|
|
2756
|
-
* local frame, then rotated into place. "Top" means the smaller-y edge before
|
|
2757
|
-
* rotation — i.e. the edge the rotate grip floats above. The order is stable
|
|
2758
|
-
* across calls so a scale handle's `index` (0–3) always means the same
|
|
2759
|
-
* corner, and its opposite corner is always `(index + 2) % 4`.
|
|
2760
|
-
*/
|
|
2761
|
-
interface TransformBox {
|
|
2762
|
-
/** Box center, pixel space. */
|
|
2763
|
-
center: PixelCoordinate;
|
|
2764
|
-
/** Half-width along the box's local x-axis (pre-rotation), in pixels. */
|
|
2765
|
-
halfWidth: number;
|
|
2766
|
-
/** Half-height along the box's local y-axis (pre-rotation), in pixels. */
|
|
2767
|
-
halfHeight: number;
|
|
2768
|
-
/** Radians, screen space, positive = clockwise on screen. */
|
|
2769
|
-
angle: number;
|
|
3868
|
+
declare class CollocationSupportRequiredError extends Error {
|
|
3869
|
+
constructor();
|
|
2770
3870
|
}
|
|
2771
3871
|
//#endregion
|
|
2772
3872
|
//#region src/point-symbol-size.d.ts
|
|
@@ -2789,50 +3889,6 @@ interface ImageFootprint {
|
|
|
2789
3889
|
}
|
|
2790
3890
|
declare function imageFootprint(image: ImageGraphic, render: ImageRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): ImageFootprint | null;
|
|
2791
3891
|
//#endregion
|
|
2792
|
-
//#region src/tactical-draw/note-rendering.d.ts
|
|
2793
|
-
/**
|
|
2794
|
-
* One Note's contribution to its atomic FeatureGroup (ADR-0066, ADR-0069):
|
|
2795
|
-
* the note raster as an image overlay, then a transparent pick polygon over the full box.
|
|
2796
|
-
* While pending, the polygon becomes a grey placeholder and there is no overlay.
|
|
2797
|
-
* A fully faded Note has neither, so it can't be seen or picked.
|
|
2798
|
-
*/
|
|
2799
|
-
interface NoteRenderPlan {
|
|
2800
|
-
features: Feature[];
|
|
2801
|
-
overlay?: ImageOverlayResource;
|
|
2802
|
-
render: NoteRender;
|
|
2803
|
-
}
|
|
2804
|
-
interface NoteFootprint {
|
|
2805
|
-
box: TransformBox;
|
|
2806
|
-
corners: PixelCoordinate[];
|
|
2807
|
-
}
|
|
2808
|
-
/**
|
|
2809
|
-
* Memo shared by every render of one `TacticalDraw`, so zooming within a
|
|
2810
|
-
* density step reuses the resolved raster without calling the capability, and
|
|
2811
|
-
* the 2048 px cap is sized from a Note's last known height.
|
|
2812
|
-
*/
|
|
2813
|
-
interface NoteResolveCache {
|
|
2814
|
-
/** Last ready box height in em per Note id. */
|
|
2815
|
-
readonly heights: Map<string, number>;
|
|
2816
|
-
/** Last ready raster per Note snapshot, with the density it was requested at. */
|
|
2817
|
-
readonly rasters: WeakMap<NoteGraphic, {
|
|
2818
|
-
pxPerEm: number;
|
|
2819
|
-
raster: NoteRaster;
|
|
2820
|
-
}>;
|
|
2821
|
-
}
|
|
2822
|
-
/** Screen-space box of a Note, for highlights, edit boxes and marquee hit tests. */
|
|
2823
|
-
declare function noteFootprint(note: NoteGraphic, render: NoteRender, adapter: Pick<MapAdapter, "getBearing" | "getPixelFromCoordinate" | "getResolution">): NoteFootprint | null;
|
|
2824
|
-
/**
|
|
2825
|
-
* Resolve and render one Note. Validates the Note and the resolved raster first,
|
|
2826
|
-
* so a malformed Note or raster throws before any caller state changes.
|
|
2827
|
-
*
|
|
2828
|
-
* The density requested from the capability follows the view (ADR-0069): the
|
|
2829
|
-
* on-screen pixels per em, times the capability's pixel ratio, rounded up to a
|
|
2830
|
-
* power of two and capped so the raster's longest side stays within
|
|
2831
|
-
* {@link NOTE_MAX_RASTER_PIXELS}. The overlay fades over one step once an em
|
|
2832
|
-
* is smaller on screen than the fade threshold, or once the cap stretches it.
|
|
2833
|
-
*/
|
|
2834
|
-
declare function renderNoteForAdapter(adapter: Pick<MapAdapter, "getResolution" | "fromLonLat" | "toLonLat">, capability: NoteCapability, note: NoteGraphic, cache?: NoteResolveCache): NoteRenderPlan;
|
|
2835
|
-
//#endregion
|
|
2836
3892
|
//#region src/tactical-draw/marker-rendering.d.ts
|
|
2837
3893
|
type MarkerFootprint = Omit<PointSymbolFootprint, "connector">;
|
|
2838
3894
|
/** Resolve a marker's icon, substituting the built-in placeholder for unknown symbols. */
|
|
@@ -2840,6 +3896,14 @@ declare function resolveMarkerRender(capability: MarkerCapability, marker: Marke
|
|
|
2840
3896
|
/** Complete rotated footprint for selection and transform chrome. */
|
|
2841
3897
|
declare function markerFootprint(marker: Marker, render: MarkerRender, adapter: PointSymbolProjection): MarkerFootprint | null;
|
|
2842
3898
|
//#endregion
|
|
3899
|
+
//#region src/hash.d.ts
|
|
3900
|
+
/**
|
|
3901
|
+
* A fast, stable 64-bit string hash for content-derived resource ids: two
|
|
3902
|
+
* independent 32-bit FNV-1a lanes (different offset bases and primes) over the
|
|
3903
|
+
* UTF-16 code units, as 14 base-36 digits. Not cryptographic.
|
|
3904
|
+
*/
|
|
3905
|
+
declare function hashString(value: string): string;
|
|
3906
|
+
//#endregion
|
|
2843
3907
|
//#region src/world-wrap.d.ts
|
|
2844
3908
|
/**
|
|
2845
3909
|
* Shift `lng` by whole world widths (360°) onto the copy nearest `refLng`.
|
|
@@ -2854,4 +3918,67 @@ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
|
|
|
2854
3918
|
/** `nearestWorldCopyLng` applied to a lon/lat position. */
|
|
2855
3919
|
declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
|
|
2856
3920
|
//#endregion
|
|
2857
|
-
|
|
3921
|
+
//#region src/collocation-minimal-options.d.ts
|
|
3922
|
+
/** What {@link minimalCollocationOptions} compares against. */
|
|
3923
|
+
interface MinimalCollocationOptionsOptions {
|
|
3924
|
+
/**
|
|
3925
|
+
* The host's own defaults, for options it fills in differently from the
|
|
3926
|
+
* engine while they are unset, e.g. `{ line: { halo: { show: true } } }`. Laid over the engine's before resolving, so a value equal to
|
|
3927
|
+
* one of these goes and a value equal to the engine's own default stays.
|
|
3928
|
+
*/
|
|
3929
|
+
defaults?: CollocationOptions;
|
|
3930
|
+
/**
|
|
3931
|
+
* Dotted paths, e.g. `"line.strokeColor"` or `"ground.ties"`, kept as given
|
|
3932
|
+
* whenever set, for host defaults that aren't fixed values (they follow the
|
|
3933
|
+
* map or the selection), so any value set there means something. A path
|
|
3934
|
+
* to an object keeps the whole object.
|
|
3935
|
+
*/
|
|
3936
|
+
keep?: readonly string[];
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* `options` without what makes no difference (#763), for a host that stores
|
|
3940
|
+
* collocation options: what it then stores stays small and picks up new
|
|
3941
|
+
* defaults. A value goes when {@link resolveCollocationOptions}, over the
|
|
3942
|
+
* host's `defaults` if given, resolves the same both with and without it, and
|
|
3943
|
+
* also resolves the same with only it set (its parents' other fields absent)
|
|
3944
|
+
* as without it. The second test keeps a value that only matches because of
|
|
3945
|
+
* another one, such as a `leader.strokeColor` equal to a non-default
|
|
3946
|
+
* `line.strokeColor`, so changing the other one later still leaves it set.
|
|
3947
|
+
* Object values are pruned key by key first and go, once emptied, only if
|
|
3948
|
+
* absent and empty resolve the same, as `gap: {}` and `bracket.plate: {}` do.
|
|
3949
|
+
* A hidden plate or tie keeps its style, since that resolves differently.
|
|
3950
|
+
*
|
|
3951
|
+
* Only values this engine reads as valid can go. Anything else is kept as
|
|
3952
|
+
* given, though it resolves to the default here: keys it doesn't know, enum
|
|
3953
|
+
* strings it doesn't know and values it can't read, any of which a newer
|
|
3954
|
+
* engine may have written, so an older one re-saving never loses them. So
|
|
3955
|
+
* are `memberOptions`, which the engine passes on unread, and the paths in
|
|
3956
|
+
* `keep`. A host reading a stored file drops malformed values first with
|
|
3957
|
+
* `sanitizeCollocationOptions`. `undefined` when nothing is left.
|
|
3958
|
+
* `options` itself is never changed.
|
|
3959
|
+
*
|
|
3960
|
+
* Collocation option defaults are frozen per `Collocation.schemaVersion`
|
|
3961
|
+
* (ADR-0063): what this function drops must mean the same to every engine
|
|
3962
|
+
* reading that version, so changing a default takes a `schemaVersion` bump
|
|
3963
|
+
* and a migration that writes the old default into stored options.
|
|
3964
|
+
*/
|
|
3965
|
+
declare function minimalCollocationOptions(options: CollocationOptions | undefined, {
|
|
3966
|
+
defaults,
|
|
3967
|
+
keep
|
|
3968
|
+
}?: MinimalCollocationOptionsOptions): CollocationOptions | undefined;
|
|
3969
|
+
//#endregion
|
|
3970
|
+
//#region src/collocation-options-schema.d.ts
|
|
3971
|
+
/**
|
|
3972
|
+
* `options` read from a stored file, made safe to use: each malformed value
|
|
3973
|
+
* (a wrong type, `NaN`, a negative length where one can't be, an empty color)
|
|
3974
|
+
* is dropped on its own, its siblings kept, rather than throwing. Everything
|
|
3975
|
+
* well formed is kept as given, including keys and enum strings this engine
|
|
3976
|
+
* doesn't know, perhaps written by a newer one, so reading and re-saving a
|
|
3977
|
+
* file loses nothing. A bag emptied by dropping stays, as an empty bag
|
|
3978
|
+
* resolves like an absent one. `memberOptions` bags are kept whole; each
|
|
3979
|
+
* member kind's capability reads its own. `undefined` when `options` isn't an
|
|
3980
|
+
* object. Returns fresh objects; `options` itself is never changed.
|
|
3981
|
+
*/
|
|
3982
|
+
declare function sanitizeCollocationOptions(options: unknown): CollocationOptions | undefined;
|
|
3983
|
+
//#endregion
|
|
3984
|
+
export { type AnchoredGraphic, BaseMapAdapter, type BuildCollocationRenderOptions, COLLOCATION_BRACKET_OVERHANG, COLLOCATION_CLEARANCE, COLLOCATION_HALO_EXTRA, COLLOCATION_REMOVE_DISTANCE, COLLOCATION_SCREEN_RELATIVE_REACH, type Collocation, type CollocationAreaStyle, type CollocationBracketPlacement, type CollocationBracketShape, type CollocationBracketSide, type CollocationCommit, type CollocationCommitChanges, type CollocationDropSlot, type CollocationDropTarget, type CollocationDropTargetOptions, type CollocationEditChangeEvent, type CollocationEditSession, type CollocationFootprint, type CollocationFootprintRect, type CollocationGround, type CollocationGroundLayout, type CollocationGroundMark, type CollocationHalo, type CollocationLayout, type CollocationLocate, type CollocationMarker, type CollocationMember, type CollocationMemberCapabilities, type CollocationMemberGraphic, type CollocationMemberIcon, type CollocationMemberLayout, type CollocationMemberOptionTypes, type CollocationMemberOptions, type CollocationMemberRender, type CollocationMemberRenderContext, type CollocationMemberSupport, type CollocationOptions, type CollocationPart, type CollocationPartControls, type CollocationPartDrag, type CollocationPartLayout, type CollocationPlate, type CollocationPointSymbol, type CollocationRender, type CollocationRenderMember, type CollocationSpreadStyle, type CollocationStroke, type CollocationStyle, type CollocationSupport, type CollocationSupportOptions, CollocationSupportRequiredError, type CollocationTransform, type CollocationTransientChangeEvent, 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 GroupOffsetDrag, type GroupOffsetDragHandler, type GuideStyle, HATCH_PATTERNS, HIGHLIGHT_BAND_SLOTS, HIGHLIGHT_CASING_OUTSET_CSS_PIXELS, HIGHLIGHT_GLOW_BANDS, HIT_AREA_PROPERTY, type HandleStyle, type HatchPattern, type HighlightBand, type HighlightBandSlot, type HighlightCasing, type HighlightedGroup, ICON_OFFSET_PROPERTY, ICON_SCREEN_ROTATION_PROPERTY, type IconHitLine, 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 MinimalCollocationOptionsOptions, type ModifierKey, NOTE_MAX_RASTER_PIXELS, NOTE_MAX_WIDTH, NOTE_MIN_WIDTH, type NativeEventEntry, type NoteBodyAlign, type NoteBodyStyle, 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 OffsetDrop, type OffsetDropHandler, type PartialCollocationTarget, type PassiveOutlineTarget, type PickCandidate, type PickCandidateHit, type PickCandidateHitKind, type PickCandidateInput, type PickEvaluationContext, type PickEvent, type PickHandler, type PickModifiers, 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 ResolveCollocationTransform, type ResolvedCollocationMemberRender, type ResolvedCollocationOptions, type ResolvedCollocationPlate, type ResolvedCollocationStroke, 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 TacticalDrawPickEvent, type TacticalDrawPickHandler, type TextAppearance, type TextSizeProps, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, type TransformTarget, type TransientChangeEvent, type TransientPhase, alignPointSymbolIndicator, bindAbortable, buildCollocationLayout, buildCollocationRender, canResetGroundSizes, cloneCollocation, cloneImageGraphic, cloneMarker, cloneNoteGraphic, clonePointSymbol, coerceHandleStyle, collocationDropTarget, collocationFootprint, collocationLeaderStrokes, collocationMemberPart, collocationOpacity, collocationScale, combinePinScale, combineWithHostSignal, composeMarkerCapabilities, convertPointSymbolPlacement, createCollocationSupport, effectivePointSymbolPixelSize, evaluatePickCandidates, fillPatternImageDimension, fillPatternImageId, getSizeAnchor, hasHighlightCasing, hashString, highlightBandsForStyle, highlightBandsInPaintOrder, highlightCasingWidth, hitTestFeature, hitTestIconFeature, ignoreAbort, imageFootprint, imageOpacity, insertCollocationMembers, isAnchoredGraphic, isCollocation, isControlMeasureGraphic, isHitArea, isImageGraphic, isMarker, isMinePattern, isNoteGraphic, isPartialCollocationTarget, isPinnableGraphic, isPointSymbol, isTacticalDrawAbortError, isValidPinNumber, layoutCollocation, makeFillPatternImage, markerFootprint, markerOpacity, mergeNativeAndCachedPickFeatures, minimalCollocationOptions, moveCollocationMember, movePointSymbolLocation, nearestWorldCopyLng, nearestWorldCopyPosition, normalizeCollocation, normalizeImageGraphic, normalizeMarker, normalizeNoteGraphic, noteFootprint, noteOpacity, parseColor, patchCollocationOptions, pickHitTolerance, pickPointerType, pinDistanceScale, pinZoomScale, placePointSymbol, pointSymbolFootprint, pointSymbolResource, readPickModifiers, renderNoteForAdapter, renderOrderToVisualOrder, resetGroundSizeOptions, resizePointSymbolSize, resolveCollocationLocation, resolveCollocationOptions, resolveCollocationSize, resolveGroundTextSizePixels, resolveHighlightBands, resolveHighlightCasing, resolveIconAnchor, resolveIconOffset, resolveIconScreenRotation, resolveMarkerRender, resolvePickPresentation, resolvePinPresentation, resolvePointSymbolOffset, resolveTextAppearance, resolveTextHaloWidth, resolveTextSizePixels, sanitizeCollocationOptions, scalePointSymbolLayout, stableCollocation, transformCollocation, tryControlMeasureIdFromFeature, validateCollocation, validateImageGraphic, validateMarker, validateNoteGraphic };
|