@oh-just-another/state 0.59.0 → 0.61.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.
Files changed (163) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +6 -4
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/actions/actionArrange.js +4 -4
  5. package/dist/actions/actionArrange.js.map +1 -1
  6. package/dist/actions/actionClipboard.d.ts.map +1 -1
  7. package/dist/actions/actionClipboard.js +5 -0
  8. package/dist/actions/actionClipboard.js.map +1 -1
  9. package/dist/actions/actionKeyboard.d.ts.map +1 -1
  10. package/dist/actions/actionKeyboard.js +79 -11
  11. package/dist/actions/actionKeyboard.js.map +1 -1
  12. package/dist/actions/actionMode.d.ts +2 -0
  13. package/dist/actions/actionMode.d.ts.map +1 -1
  14. package/dist/actions/actionMode.js +81 -27
  15. package/dist/actions/actionMode.js.map +1 -1
  16. package/dist/actions/actionSelection.d.ts.map +1 -1
  17. package/dist/actions/actionSelection.js +1 -0
  18. package/dist/actions/actionSelection.js.map +1 -1
  19. package/dist/actions/actionView.d.ts +6 -0
  20. package/dist/actions/actionView.d.ts.map +1 -1
  21. package/dist/actions/actionView.js +19 -1
  22. package/dist/actions/actionView.js.map +1 -1
  23. package/dist/actions/actionZoom.d.ts.map +1 -1
  24. package/dist/actions/actionZoom.js +5 -0
  25. package/dist/actions/actionZoom.js.map +1 -1
  26. package/dist/actions/index.d.ts +3 -3
  27. package/dist/actions/index.d.ts.map +1 -1
  28. package/dist/actions/index.js +3 -3
  29. package/dist/actions/index.js.map +1 -1
  30. package/dist/actions/registry.d.ts.map +1 -1
  31. package/dist/actions/registry.js +13 -0
  32. package/dist/actions/registry.js.map +1 -1
  33. package/dist/actions/types.d.ts +10 -1
  34. package/dist/actions/types.d.ts.map +1 -1
  35. package/dist/actions/types.js.map +1 -1
  36. package/dist/built-in-handlers.d.ts +8 -0
  37. package/dist/built-in-handlers.d.ts.map +1 -1
  38. package/dist/built-in-handlers.js +31 -16
  39. package/dist/built-in-handlers.js.map +1 -1
  40. package/dist/clipboard.d.ts +0 -14
  41. package/dist/clipboard.d.ts.map +1 -1
  42. package/dist/clipboard.js +1 -1
  43. package/dist/clipboard.js.map +1 -1
  44. package/dist/constants.d.ts +253 -18
  45. package/dist/constants.d.ts.map +1 -1
  46. package/dist/constants.js +255 -2
  47. package/dist/constants.js.map +1 -1
  48. package/dist/dom-events.d.ts +1 -2
  49. package/dist/dom-events.d.ts.map +1 -1
  50. package/dist/dom-events.js.map +1 -1
  51. package/dist/editor/animation-scene.d.ts +15 -0
  52. package/dist/editor/animation-scene.d.ts.map +1 -1
  53. package/dist/editor/animation-scene.js +159 -0
  54. package/dist/editor/animation-scene.js.map +1 -1
  55. package/dist/editor/applies/create.d.ts +0 -6
  56. package/dist/editor/applies/create.d.ts.map +1 -1
  57. package/dist/editor/applies/create.js +1 -1
  58. package/dist/editor/applies/create.js.map +1 -1
  59. package/dist/editor/applies/link-move.d.ts +0 -8
  60. package/dist/editor/applies/link-move.d.ts.map +1 -1
  61. package/dist/editor/applies/link-move.js +1 -1
  62. package/dist/editor/applies/link-move.js.map +1 -1
  63. package/dist/editor/event-fanout.d.ts +6 -6
  64. package/dist/editor/event-fanout.d.ts.map +1 -1
  65. package/dist/editor/event-fanout.js +8 -8
  66. package/dist/editor/event-fanout.js.map +1 -1
  67. package/dist/editor/hit-test.d.ts +8 -0
  68. package/dist/editor/hit-test.d.ts.map +1 -1
  69. package/dist/editor/hit-test.js +31 -16
  70. package/dist/editor/hit-test.js.map +1 -1
  71. package/dist/editor/interaction-state.d.ts +184 -0
  72. package/dist/editor/interaction-state.d.ts.map +1 -0
  73. package/dist/editor/interaction-state.js +139 -0
  74. package/dist/editor/interaction-state.js.map +1 -0
  75. package/dist/editor/link-handle-drag.d.ts +172 -0
  76. package/dist/editor/link-handle-drag.d.ts.map +1 -0
  77. package/dist/editor/link-handle-drag.js +369 -0
  78. package/dist/editor/link-handle-drag.js.map +1 -0
  79. package/dist/editor/pointer-binding.d.ts +9 -11
  80. package/dist/editor/pointer-binding.d.ts.map +1 -1
  81. package/dist/editor/pointer-binding.js +1247 -909
  82. package/dist/editor/pointer-binding.js.map +1 -1
  83. package/dist/editor/public/brush.d.ts +93 -13
  84. package/dist/editor/public/brush.d.ts.map +1 -1
  85. package/dist/editor/public/brush.js +240 -22
  86. package/dist/editor/public/brush.js.map +1 -1
  87. package/dist/editor/public/cursor.d.ts +1 -15
  88. package/dist/editor/public/cursor.d.ts.map +1 -1
  89. package/dist/editor/public/cursor.js +17 -7
  90. package/dist/editor/public/cursor.js.map +1 -1
  91. package/dist/editor/public/eraser.d.ts +55 -0
  92. package/dist/editor/public/eraser.d.ts.map +1 -0
  93. package/dist/editor/public/eraser.js +65 -0
  94. package/dist/editor/public/eraser.js.map +1 -0
  95. package/dist/editor/public/laser.d.ts +38 -0
  96. package/dist/editor/public/laser.d.ts.map +1 -0
  97. package/dist/editor/public/laser.js +42 -0
  98. package/dist/editor/public/laser.js.map +1 -0
  99. package/dist/editor/public/placement.d.ts.map +1 -1
  100. package/dist/editor/public/placement.js +9 -1
  101. package/dist/editor/public/placement.js.map +1 -1
  102. package/dist/editor/public/selection-ops.d.ts +12 -0
  103. package/dist/editor/public/selection-ops.d.ts.map +1 -1
  104. package/dist/editor/public/selection-ops.js +19 -1
  105. package/dist/editor/public/selection-ops.js.map +1 -1
  106. package/dist/editor/public/stroke-eraser-coverage.d.ts +37 -0
  107. package/dist/editor/public/stroke-eraser-coverage.d.ts.map +1 -0
  108. package/dist/editor/public/stroke-eraser-coverage.js +168 -0
  109. package/dist/editor/public/stroke-eraser-coverage.js.map +1 -0
  110. package/dist/editor/public/stroke-eraser.d.ts +50 -0
  111. package/dist/editor/public/stroke-eraser.d.ts.map +1 -0
  112. package/dist/editor/public/stroke-eraser.js +176 -0
  113. package/dist/editor/public/stroke-eraser.js.map +1 -0
  114. package/dist/editor/public/stroke-smoothing.d.ts +21 -0
  115. package/dist/editor/public/stroke-smoothing.d.ts.map +1 -0
  116. package/dist/editor/public/stroke-smoothing.js +37 -0
  117. package/dist/editor/public/stroke-smoothing.js.map +1 -0
  118. package/dist/editor/public/tool-ops.d.ts +130 -0
  119. package/dist/editor/public/tool-ops.d.ts.map +1 -0
  120. package/dist/editor/public/tool-ops.js +392 -0
  121. package/dist/editor/public/tool-ops.js.map +1 -0
  122. package/dist/editor/public/z-order.d.ts +1 -12
  123. package/dist/editor/public/z-order.d.ts.map +1 -1
  124. package/dist/editor/public/z-order.js +1 -1
  125. package/dist/editor/public/z-order.js.map +1 -1
  126. package/dist/editor/public/zoom-pan.d.ts +9 -0
  127. package/dist/editor/public/zoom-pan.d.ts.map +1 -1
  128. package/dist/editor/public/zoom-pan.js +31 -0
  129. package/dist/editor/public/zoom-pan.js.map +1 -1
  130. package/dist/editor/render-orchestrator.d.ts +180 -5
  131. package/dist/editor/render-orchestrator.d.ts.map +1 -1
  132. package/dist/editor/render-orchestrator.js +516 -353
  133. package/dist/editor/render-orchestrator.js.map +1 -1
  134. package/dist/editor/text-edit.d.ts +136 -0
  135. package/dist/editor/text-edit.d.ts.map +1 -0
  136. package/dist/editor/text-edit.js +328 -0
  137. package/dist/editor/text-edit.js.map +1 -0
  138. package/dist/editor-events.d.ts +5 -5
  139. package/dist/editor-events.d.ts.map +1 -1
  140. package/dist/editor.d.ts +560 -250
  141. package/dist/editor.d.ts.map +1 -1
  142. package/dist/editor.js +1650 -743
  143. package/dist/editor.js.map +1 -1
  144. package/dist/handle.d.ts +0 -2
  145. package/dist/handle.d.ts.map +1 -1
  146. package/dist/handle.js +0 -6
  147. package/dist/handle.js.map +1 -1
  148. package/dist/index.d.ts +7 -2
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +7 -1
  151. package/dist/index.js.map +1 -1
  152. package/dist/modes.d.ts +34 -1
  153. package/dist/modes.d.ts.map +1 -1
  154. package/dist/modes.js.map +1 -1
  155. package/dist/overlay.d.ts +98 -21
  156. package/dist/overlay.d.ts.map +1 -1
  157. package/dist/overlay.js +442 -116
  158. package/dist/overlay.js.map +1 -1
  159. package/dist/search.d.ts +37 -0
  160. package/dist/search.d.ts.map +1 -0
  161. package/dist/search.js +45 -0
  162. package/dist/search.js.map +1 -0
  163. package/package.json +5 -4
@@ -0,0 +1,369 @@
1
+ import { getLink, getLinkCurvePoints, getLinkPath, isNoop, projectPointToPathT, updateLink, } from "@oh-just-another/scene";
2
+ import { hitTest, vec2 } from "@oh-just-another/math";
3
+ import { DOUBLE_CLICK_MS, DOUBLE_CLICK_TOLERANCE_PX, LINK_LABEL_DRAG_SNAP_PX, WAYPOINT_COLLAPSE_RADIUS, } from "../constants.js";
4
+ import { req } from "../util.js";
5
+ import { computeLinkEndpointUpdate } from "./applies/edge.js";
6
+ /**
7
+ * Owns the link edit-handle drags: waypoint (bend point) drags, elbow
8
+ * segment drags, endpoint rebind drags and the handle double-click
9
+ * detector (delete waypoint / reset segment pin). Extracted from the
10
+ * Editor god-class; the Editor keeps thin delegate wrappers so its public
11
+ * API is unchanged.
12
+ */
13
+ export class LinkHandleDragController {
14
+ host;
15
+ /**
16
+ * Mid-drag preview state when the user is dragging an edge endpoint.
17
+ * Drawn as an overlay line + handle dot so the user sees the target.
18
+ */
19
+ _endpointDrag = null;
20
+ /**
21
+ * Host-managed waypoint (bend-point) drag of the selected link. `index`
22
+ * is the position in `edge.waypoints`. `pendingInsert` means the gesture
23
+ * began on a segment midpoint and will splice a new waypoint on the
24
+ * first move (so a no-move click adds nothing). Live-mutated through the
25
+ * gesture transaction → one undo step per drag.
26
+ */
27
+ _waypointDrag = null;
28
+ /**
29
+ * Host-managed elbow segment drag. `axis` is the segment's orientation.
30
+ * Dragging pins the segment's perpendicular coordinate into
31
+ * `Link.fixedSegments`; the reroute pass re-flows the rest. One undo
32
+ * step via the gesture tx.
33
+ */
34
+ _segmentDrag = null;
35
+ /**
36
+ * Host-managed caption (label pill) drag along the link's path. The cursor
37
+ * is projected back onto the drawn polyline so the pill can only slide
38
+ * ALONG the link; near the arc-length middle it snaps back to the default
39
+ * position (`label.position` removed). One undo step via the gesture tx.
40
+ * `moved` distinguishes a click (kept for the double-click-to-edit chain)
41
+ * from a real drag.
42
+ */
43
+ _labelDrag = null;
44
+ /** Wall-clock of the previous handle press — drives `isHandleDoubleClick`. */
45
+ lastHandleClickAt = 0;
46
+ lastHandleClickWorld = null;
47
+ constructor(host) {
48
+ this.host = host;
49
+ }
50
+ get endpointDrag() {
51
+ return this._endpointDrag;
52
+ }
53
+ get waypointDrag() {
54
+ return this._waypointDrag;
55
+ }
56
+ get segmentDrag() {
57
+ return this._segmentDrag;
58
+ }
59
+ get labelDrag() {
60
+ return this._labelDrag;
61
+ }
62
+ get isDraggingLabel() {
63
+ return this._labelDrag !== null;
64
+ }
65
+ /** Drop all drag state without committing (Escape / cancelInteraction). */
66
+ reset() {
67
+ this._waypointDrag = null;
68
+ this._segmentDrag = null;
69
+ this._endpointDrag = null;
70
+ this._labelDrag = null;
71
+ }
72
+ /**
73
+ * Live endpoint-rebind move: re-point the dragged end to the cursor in the
74
+ * scene (a free `point` endpoint), recorded in the gesture transaction so the
75
+ * WHOLE link redraws under the cursor with full fidelity — real style,
76
+ * arrowhead, curved bow, and (via `rerouteElbows` in `render`) a live elbow
77
+ * re-route. One undo step on commit; Escape cancels the transaction and the
78
+ * link snaps back to where it was. The handle dot follows via `endpointDrag`.
79
+ */
80
+ applyEndpointMove(linkId, side, toPoint) {
81
+ const edge = getLink(this.host.scene, linkId);
82
+ if (!edge)
83
+ return;
84
+ // A real drag breaks the handle double-click chain (mirrors waypoint /
85
+ // segment drags) so a quick click after dropping isn't read as a delete.
86
+ this.lastHandleClickAt = 0;
87
+ // Resolve the attach target under the cursor and snap the endpoint to it
88
+ // with the SAME logic the drop uses, so the link attaches LIVE exactly as it
89
+ // will commit — lands on the dot (fixed), floats on the body, or stays a
90
+ // free point over empty space.
91
+ const target = this.host.linkAttachTargetAt(toPoint);
92
+ const targetId = target?.kind === "element" ? target.id : null;
93
+ const ep = this.host.snapLinkEndpoint(targetId, toPoint);
94
+ const r = updateLink(this.host.scene, linkId, (e) => side === "from" ? { ...e, from: ep } : { ...e, to: ep });
95
+ this.host.scene = r.scene;
96
+ this.host.recordGesturePatch(r.patch);
97
+ this._endpointDrag = { linkId, side, toPoint };
98
+ // Attach-point highlight — the SAME feedback as drawing a new link
99
+ // (candidate dots + float-element halo), driven by `hoveredLinkTarget`.
100
+ this.host.updateHoveredLinkTarget(toPoint);
101
+ this.host.notify();
102
+ }
103
+ applyEndpointUpdate(emit) {
104
+ // A move opened a gesture transaction (live re-point per tick). The final
105
+ // snapped endpoint goes into the SAME transaction so the net history step is
106
+ // original → final (one undo). A pure click (no move, no tx) that resolves
107
+ // to a no-op change must not leave a junk undo entry.
108
+ const moved = this.host.hasGestureTx();
109
+ const result = computeLinkEndpointUpdate(this.host.scene, emit, (toElement, toPoint) => this.host.snapLinkEndpoint(toElement, toPoint));
110
+ if (result === null) {
111
+ this.host.cancelGesture();
112
+ this._endpointDrag = null;
113
+ this.host.clearHoveredLinkTarget();
114
+ this.host.notify();
115
+ return;
116
+ }
117
+ if (!moved && isNoop(result.patch)) {
118
+ this._endpointDrag = null;
119
+ this.host.clearHoveredLinkTarget();
120
+ this.host.notify();
121
+ return;
122
+ }
123
+ this.host.scene = result.scene;
124
+ this.host.recordGesturePatch(result.patch);
125
+ this.host.commitGesture();
126
+ this._endpointDrag = null;
127
+ this.host.clearHoveredLinkTarget();
128
+ }
129
+ /** True while a waypoint of the selected link is being dragged. */
130
+ get isDraggingWaypoint() {
131
+ return this._waypointDrag !== null;
132
+ }
133
+ /**
134
+ * Begin a host-managed waypoint drag. `insert` splices a new waypoint at
135
+ * `index` on the first move (segment-midpoint "add" handle); otherwise an
136
+ * existing waypoint at `index` is moved. Live-mutated through the gesture
137
+ * transaction so the whole drag is one undo step.
138
+ */
139
+ beginWaypointDrag(linkId, index, insert) {
140
+ if (!getLink(this.host.scene, linkId))
141
+ return;
142
+ this._waypointDrag = { linkId, index, pendingInsert: insert };
143
+ }
144
+ /** Live update of the dragged waypoint to `world`. */
145
+ updateWaypointDrag(world) {
146
+ const drag = this._waypointDrag;
147
+ if (!drag)
148
+ return;
149
+ // A real drag breaks the handle double-click chain (see updateSegmentDrag).
150
+ this.lastHandleClickAt = 0;
151
+ const edge = getLink(this.host.scene, drag.linkId);
152
+ if (!edge)
153
+ return;
154
+ const wps = [...(edge.waypoints ?? [])];
155
+ if (drag.pendingInsert) {
156
+ wps.splice(drag.index, 0, world);
157
+ drag.pendingInsert = false;
158
+ }
159
+ else {
160
+ if (drag.index < 0 || drag.index >= wps.length)
161
+ return;
162
+ wps[drag.index] = world;
163
+ }
164
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, waypoints: wps }));
165
+ this.host.scene = r.scene;
166
+ this.host.recordGesturePatch(r.patch);
167
+ this.host.notify();
168
+ }
169
+ /**
170
+ * Finish the waypoint drag. If the dragged waypoint landed within
171
+ * `WAYPOINT_COLLAPSE_RADIUS` of an adjacent path point, it is removed
172
+ * (drag-onto-the-line to delete). A no-move insert adds nothing.
173
+ */
174
+ endWaypointDrag() {
175
+ const drag = this._waypointDrag;
176
+ this._waypointDrag = null;
177
+ if (!drag)
178
+ return;
179
+ if (drag.pendingInsert) {
180
+ // Never moved → it was a click on a midpoint; nothing inserted.
181
+ this.host.commitGesture();
182
+ return;
183
+ }
184
+ const edge = getLink(this.host.scene, drag.linkId);
185
+ if (edge?.waypoints && drag.index >= 0 && drag.index < edge.waypoints.length) {
186
+ const path = getLinkPath(this.host.scene, edge);
187
+ const wp = req(edge.waypoints[drag.index]);
188
+ // Neighbours in the [from, ...waypoints, to] chain: path[index] and
189
+ // path[index + 2] (path[0] = from, so waypoint i sits at path[i + 1]).
190
+ // Dropping the waypoint back onto the straight segment between its
191
+ // neighbours removes the bend ("drag onto the line to delete").
192
+ const collapse = WAYPOINT_COLLAPSE_RADIUS / (this.host.scene.viewport.zoom || 1);
193
+ const a = path?.[drag.index];
194
+ const b = path?.[drag.index + 2];
195
+ if (a && b && hitTest.distanceToSegment(wp, a, b) <= collapse) {
196
+ const wps = edge.waypoints.filter((_, i) => i !== drag.index);
197
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, waypoints: wps }));
198
+ this.host.scene = r.scene;
199
+ this.host.recordGesturePatch(r.patch);
200
+ }
201
+ }
202
+ this.host.commitGesture();
203
+ }
204
+ /** True while an elbow segment is being dragged. */
205
+ get isDraggingSegment() {
206
+ return this._segmentDrag !== null;
207
+ }
208
+ /**
209
+ * Begin a host-managed elbow segment drag. `axis` is the segment's
210
+ * orientation; `at` is its centre along its own axis (used to re-identify it
211
+ * across re-routes).
212
+ */
213
+ beginSegmentDrag(linkId, axis, at) {
214
+ if (!getLink(this.host.scene, linkId))
215
+ return;
216
+ this._segmentDrag = { linkId, axis, at };
217
+ }
218
+ /**
219
+ * Move the dragged elbow segment perpendicular to its axis: pin its
220
+ * perpendicular coordinate to the cursor. The reroute pass re-flows the
221
+ * rest around the pin (one undo step via the gesture transaction).
222
+ */
223
+ updateSegmentDrag(world) {
224
+ const drag = this._segmentDrag;
225
+ if (!drag)
226
+ return;
227
+ // A real drag breaks the handle double-click chain, so a single click
228
+ // right after pinning can't be misread as a double-click (= delete).
229
+ this.lastHandleClickAt = 0;
230
+ const edge = getLink(this.host.scene, drag.linkId);
231
+ if (!edge)
232
+ return;
233
+ const pos = drag.axis === "h" ? world.y : world.x;
234
+ const fixed = [...(edge.fixedSegments ?? [])];
235
+ const entry = { axis: drag.axis, pos, at: drag.at };
236
+ const at = fixed.findIndex((f) => f.axis === drag.axis && Math.abs(f.at - drag.at) < 0.5);
237
+ if (at >= 0)
238
+ fixed[at] = entry;
239
+ else
240
+ fixed.push(entry);
241
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, fixedSegments: fixed }));
242
+ this.host.scene = r.scene;
243
+ this.host.recordGesturePatch(r.patch);
244
+ this.host.notify();
245
+ }
246
+ /** Finish the elbow segment drag (commit the gesture as one undo step). */
247
+ endSegmentDrag() {
248
+ if (!this._segmentDrag)
249
+ return;
250
+ this._segmentDrag = null;
251
+ this.host.commitGesture();
252
+ }
253
+ /** Begin dragging the selected link's caption pill along its path. */
254
+ beginLabelDrag(linkId) {
255
+ if (!getLink(this.host.scene, linkId)?.label)
256
+ return;
257
+ this._labelDrag = { linkId, moved: false };
258
+ }
259
+ /** Live update: project the cursor onto the path, snap near the middle. */
260
+ updateLabelDrag(world) {
261
+ const drag = this._labelDrag;
262
+ if (!drag)
263
+ return;
264
+ drag.moved = true;
265
+ // A real drag breaks the handle double-click chain (see updateSegmentDrag).
266
+ this.lastHandleClickAt = 0;
267
+ const edge = getLink(this.host.scene, drag.linkId);
268
+ if (!edge?.label)
269
+ return;
270
+ const path = getLinkCurvePoints(this.host.scene, edge);
271
+ if (!path || path.length < 2)
272
+ return;
273
+ let total = 0;
274
+ for (let i = 1; i < path.length; i++) {
275
+ const a = path[i - 1];
276
+ const b = path[i];
277
+ if (a && b)
278
+ total += Math.hypot(b.x - a.x, b.y - a.y);
279
+ }
280
+ const t = projectPointToPathT(path, world);
281
+ // Snap back to the default placement near the middle: remove the explicit
282
+ // position so elbow links regain their longest-segment auto-placement.
283
+ const zoom = this.host.scene.viewport.zoom || 1;
284
+ const snapped = total > 0 && Math.abs(t - 0.5) * total < LINK_LABEL_DRAG_SNAP_PX / zoom;
285
+ const r = updateLink(this.host.scene, drag.linkId, (e) => {
286
+ if (!e.label)
287
+ return e;
288
+ if (snapped) {
289
+ const { position: _position, ...rest } = e.label;
290
+ void _position;
291
+ return { ...e, label: rest };
292
+ }
293
+ return { ...e, label: { ...e.label, position: t } };
294
+ });
295
+ this.host.scene = r.scene;
296
+ this.host.recordGesturePatch(r.patch);
297
+ this.host.notify();
298
+ }
299
+ /** Finish the caption drag (commits the gesture as one undo step). */
300
+ endLabelDrag() {
301
+ if (!this._labelDrag)
302
+ return;
303
+ this._labelDrag = null;
304
+ this.host.commitGesture();
305
+ }
306
+ /**
307
+ * Double-click detector for link edit handles (waypoint / segment).
308
+ * Returns true when this press follows the previous handle press within
309
+ * the double-click window + tolerance. Updates state every call. Kept
310
+ * separate from the up-side double-click path (handles return early in
311
+ * `onDown`, so that path never sees them).
312
+ */
313
+ isHandleDoubleClick(world) {
314
+ const now = performance.now();
315
+ const isDouble = now - this.lastHandleClickAt < DOUBLE_CLICK_MS &&
316
+ this.lastHandleClickWorld !== null &&
317
+ vec2.distance(this.lastHandleClickWorld, world) <= DOUBLE_CLICK_TOLERANCE_PX;
318
+ this.lastHandleClickAt = now;
319
+ this.lastHandleClickWorld = world;
320
+ return isDouble;
321
+ }
322
+ /**
323
+ * Delete a free bend point (waypoint) from a straight / bezier link by
324
+ * index — double-click a waypoint handle to remove it. One undo step.
325
+ */
326
+ deleteWaypoint(linkId, index) {
327
+ const edge = getLink(this.host.scene, linkId);
328
+ if (!edge?.waypoints || index < 0 || index >= edge.waypoints.length)
329
+ return;
330
+ const wps = edge.waypoints.filter((_, i) => i !== index);
331
+ const r = updateLink(this.host.scene, linkId, (e) => ({ ...e, waypoints: wps }));
332
+ this.host.scene = r.scene;
333
+ this.host.pushHistory(r.patch);
334
+ this.host.notify();
335
+ }
336
+ /**
337
+ * Remove the pinned (fixed) elbow segment that matches the given
338
+ * geometry — double-click a segment handle to return it to the auto
339
+ * route. Matches by axis + nearest pinned perpendicular `pos` (exact for
340
+ * a pinned segment), `at` as tiebreak. The reroute pass re-flows on the
341
+ * next render (fixedSegments is part of the elbow signature). One undo
342
+ * step.
343
+ */
344
+ resetSegmentPin(linkId, axis, pos, at) {
345
+ const edge = getLink(this.host.scene, linkId);
346
+ if (!edge?.fixedSegments || edge.fixedSegments.length === 0)
347
+ return;
348
+ let bestIdx = -1;
349
+ let bestD = Infinity;
350
+ for (let i = 0; i < edge.fixedSegments.length; i++) {
351
+ const f = req(edge.fixedSegments[i]);
352
+ if (f.axis !== axis)
353
+ continue;
354
+ const d = Math.abs(f.pos - pos) + Math.abs(f.at - at) * 0.001;
355
+ if (d < bestD) {
356
+ bestD = d;
357
+ bestIdx = i;
358
+ }
359
+ }
360
+ if (bestIdx < 0)
361
+ return;
362
+ const fixed = edge.fixedSegments.filter((_, i) => i !== bestIdx);
363
+ const r = updateLink(this.host.scene, linkId, (e) => ({ ...e, fixedSegments: fixed }));
364
+ this.host.scene = r.scene;
365
+ this.host.pushHistory(r.patch);
366
+ this.host.notify();
367
+ }
368
+ }
369
+ //# sourceMappingURL=link-handle-drag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-handle-drag.js","sourceRoot":"","sources":["../../src/editor/link-handle-drag.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,mBAAmB,EACnB,UAAU,GAIX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAkC9D;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IA0CN;IAzC7B;;;OAGG;IACK,aAAa,GAIV,IAAI,CAAC;IAChB;;;;;;OAMG;IACK,aAAa,GAIV,IAAI,CAAC;IAChB;;;;;OAKG;IACK,YAAY,GAA2D,IAAI,CAAC;IACpF;;;;;;;OAOG;IACK,UAAU,GAA8C,IAAI,CAAC;IACrE,8EAA8E;IACtE,iBAAiB,GAAG,CAAC,CAAC;IACtB,oBAAoB,GAAgB,IAAI,CAAC;IAEjD,YAA6B,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;IAAG,CAAC;IAEzD,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,C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,CAAC;YACnD,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI;gBAAE,SAAS;YAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;YAC9D,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;gBACd,KAAK,GAAG,CAAC,CAAC;gBACV,OAAO,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC;QACD,IAAI,OAAO,GAAG,CAAC;YAAE,OAAO;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACvF,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF"}
@@ -1,18 +1,16 @@
1
1
  import type { Editor } from "../editor.js";
2
2
  /**
3
- * Pointer + wheel event binding. Owns the branchy dispatch — pan /
4
- * pinch / brush / annotation / interactive-hit / machine flow —
5
- * kept in one file so reading any single handler does not require
6
- * jumping across module boundaries.
3
+ * Pointer + wheel event binding. Owns the branchy dispatch — pan / pinch /
4
+ * brush / annotation / interactive-hit / machine flow — delegating each case to
5
+ * the module-level handlers above so no single handler is a monolith.
7
6
  *
8
- * Returns an unsubscribe function that removes every listener it
9
- * installed.
7
+ * Returns an unsubscribe function that removes every listener it installed.
10
8
  *
11
- * Typed against the full `Editor` class (type-only import — erased at
12
- * runtime, so no import cycle and dependency-cruiser ignores it). This
13
- * handler reaches deep into Editor's surface, so the members it touches
14
- * are declared `public` (with the `_`-prefix convention marking them
15
- * internal). editor.ts is the only call site.
9
+ * Typed against the full `Editor` class (type-only import — erased at runtime,
10
+ * so no import cycle and dependency-cruiser ignores it). This handler reaches
11
+ * deep into Editor's surface, so the members it touches are declared `public`
12
+ * (with the `_`-prefix convention marking them internal). editor.ts is the only
13
+ * call site.
16
14
  */
17
15
  export declare const bindPointerEvents: (editor: Editor) => (() => void);
18
16
  //# sourceMappingURL=pointer-binding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pointer-binding.d.ts","sourceRoot":"","sources":["../../src/editor/pointer-binding.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAY3C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,CAAC,MAAM,IAAI,CAwlC7D,CAAC"}
1
+ {"version":3,"file":"pointer-binding.d.ts","sourceRoot":"","sources":["../../src/editor/pointer-binding.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAmnC3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,CAAC,MAAM,IAAI,CAyR7D,CAAC"}