@orbat-mapper/tactical-draw 0.2.0-alpha.4 → 0.2.0-alpha.40

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/README.md CHANGED
@@ -10,6 +10,10 @@ concrete map engine in sight. Bring your own: pair this package with one of
10
10
  the engine adapters, or implement `MapAdapter` against whatever you're
11
11
  already using.
12
12
 
13
+ Point symbols are also optional: the core contains only their lightweight
14
+ model and capability interface. Add `@orbat-mapper/point-symbols` and
15
+ `milsymbol` when an application needs MIL-STD-2525/APP-6 unit icons.
16
+
13
17
  ## Installation
14
18
 
15
19
  ```bash
@@ -50,19 +54,19 @@ pnpm add @orbat-mapper/tactical-draw-adapter-leaflet leaflet
50
54
 
51
55
  ## Pick to edit
52
56
 
53
- Use `onMeasurePick` to subscribe to committed control measures without accessing
57
+ Use `onGraphicPick` to subscribe to committed graphics without accessing
54
58
  internal layer ids:
55
59
 
56
60
  ```ts
57
- const unsubscribe = td.onMeasurePick((event) => {
58
- const measure = measures.find((candidate) => candidate.id === event.id);
59
- if (measure) void td.edit(measure);
61
+ const unsubscribe = td.onGraphicPick((event) => {
62
+ const graphic = graphics.find((candidate) => candidate.id === event.id);
63
+ if (graphic) void td.edit(graphic);
60
64
  });
61
65
  ```
62
66
 
63
- The handler receives the full `PickEvent`, with `event.id` set to the control
64
- measure id. The returned unsubscribe function is idempotent, and
65
- `onMeasurePick(handler, { signal })` also supports abort-driven teardown.
67
+ The handler receives the full `PickEvent`, with `event.id` set to the graphic
68
+ id. The returned unsubscribe function is idempotent, and
69
+ `onGraphicPick(handler, { signal })` also supports abort-driven teardown.
66
70
 
67
71
  ## Cancel and inspect the active interaction
68
72
 
@@ -83,6 +87,22 @@ if (session && "canCommit" in session) {
83
87
  }
84
88
  ```
85
89
 
90
+ Live edit and transform sessions expose a session-local `history`. Completed
91
+ gestures and authored programmatic mutations are undoable without settling the
92
+ session; pointer-move preview frames are not history steps:
93
+
94
+ ```ts
95
+ const active = td.activeSession;
96
+ const history =
97
+ (active && "history" in active ? active.history : null) ?? td.activeTransformSession?.history;
98
+ if (history) history.undo();
99
+ ```
100
+
101
+ `history.subscribe(...)` reports `canUndo`, `canRedo`, and optional operation
102
+ labels. Committing folds only the selected working state into the host document
103
+ as one operation. Changing a transform session's members with `setGraphics()`
104
+ establishes a new local baseline and clears both stacks.
105
+
86
106
  ## Bring your own engine
87
107
 
88
108
  Implement `MapAdapter` (or extend `BaseMapAdapter`) against your map engine