@oh-just-another/state 0.59.0 → 0.60.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 (149) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -0
  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 +77 -9
  11. package/dist/actions/actionKeyboard.js.map +1 -1
  12. package/dist/actions/actionMode.d.ts +4 -0
  13. package/dist/actions/actionMode.d.ts.map +1 -1
  14. package/dist/actions/actionMode.js +54 -0
  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 +9 -0
  34. package/dist/actions/types.d.ts.map +1 -1
  35. package/dist/actions/types.js.map +1 -1
  36. package/dist/clipboard.d.ts +0 -14
  37. package/dist/clipboard.d.ts.map +1 -1
  38. package/dist/clipboard.js +1 -1
  39. package/dist/clipboard.js.map +1 -1
  40. package/dist/constants.d.ts +160 -18
  41. package/dist/constants.d.ts.map +1 -1
  42. package/dist/constants.js +162 -2
  43. package/dist/constants.js.map +1 -1
  44. package/dist/dom-events.d.ts +1 -2
  45. package/dist/dom-events.d.ts.map +1 -1
  46. package/dist/dom-events.js.map +1 -1
  47. package/dist/editor/animation-scene.d.ts +15 -0
  48. package/dist/editor/animation-scene.d.ts.map +1 -1
  49. package/dist/editor/animation-scene.js +123 -0
  50. package/dist/editor/animation-scene.js.map +1 -1
  51. package/dist/editor/applies/create.d.ts +0 -6
  52. package/dist/editor/applies/create.d.ts.map +1 -1
  53. package/dist/editor/applies/create.js +1 -1
  54. package/dist/editor/applies/create.js.map +1 -1
  55. package/dist/editor/applies/link-move.d.ts +0 -8
  56. package/dist/editor/applies/link-move.d.ts.map +1 -1
  57. package/dist/editor/applies/link-move.js +1 -1
  58. package/dist/editor/applies/link-move.js.map +1 -1
  59. package/dist/editor/interaction-state.d.ts +184 -0
  60. package/dist/editor/interaction-state.d.ts.map +1 -0
  61. package/dist/editor/interaction-state.js +139 -0
  62. package/dist/editor/interaction-state.js.map +1 -0
  63. package/dist/editor/link-handle-drag.d.ts +152 -0
  64. package/dist/editor/link-handle-drag.d.ts.map +1 -0
  65. package/dist/editor/link-handle-drag.js +300 -0
  66. package/dist/editor/link-handle-drag.js.map +1 -0
  67. package/dist/editor/pointer-binding.d.ts +9 -11
  68. package/dist/editor/pointer-binding.d.ts.map +1 -1
  69. package/dist/editor/pointer-binding.js +1185 -901
  70. package/dist/editor/pointer-binding.js.map +1 -1
  71. package/dist/editor/public/brush.d.ts +31 -12
  72. package/dist/editor/public/brush.d.ts.map +1 -1
  73. package/dist/editor/public/brush.js +66 -17
  74. package/dist/editor/public/brush.js.map +1 -1
  75. package/dist/editor/public/cursor.d.ts +1 -15
  76. package/dist/editor/public/cursor.d.ts.map +1 -1
  77. package/dist/editor/public/cursor.js +14 -3
  78. package/dist/editor/public/cursor.js.map +1 -1
  79. package/dist/editor/public/eraser.d.ts +55 -0
  80. package/dist/editor/public/eraser.d.ts.map +1 -0
  81. package/dist/editor/public/eraser.js +65 -0
  82. package/dist/editor/public/eraser.js.map +1 -0
  83. package/dist/editor/public/laser.d.ts +38 -0
  84. package/dist/editor/public/laser.d.ts.map +1 -0
  85. package/dist/editor/public/laser.js +42 -0
  86. package/dist/editor/public/laser.js.map +1 -0
  87. package/dist/editor/public/placement.d.ts.map +1 -1
  88. package/dist/editor/public/placement.js +9 -1
  89. package/dist/editor/public/placement.js.map +1 -1
  90. package/dist/editor/public/selection-ops.d.ts +12 -0
  91. package/dist/editor/public/selection-ops.d.ts.map +1 -1
  92. package/dist/editor/public/selection-ops.js +19 -1
  93. package/dist/editor/public/selection-ops.js.map +1 -1
  94. package/dist/editor/public/stroke-eraser-coverage.d.ts +37 -0
  95. package/dist/editor/public/stroke-eraser-coverage.d.ts.map +1 -0
  96. package/dist/editor/public/stroke-eraser-coverage.js +168 -0
  97. package/dist/editor/public/stroke-eraser-coverage.js.map +1 -0
  98. package/dist/editor/public/stroke-eraser.d.ts +50 -0
  99. package/dist/editor/public/stroke-eraser.d.ts.map +1 -0
  100. package/dist/editor/public/stroke-eraser.js +176 -0
  101. package/dist/editor/public/stroke-eraser.js.map +1 -0
  102. package/dist/editor/public/stroke-smoothing.d.ts +21 -0
  103. package/dist/editor/public/stroke-smoothing.d.ts.map +1 -0
  104. package/dist/editor/public/stroke-smoothing.js +37 -0
  105. package/dist/editor/public/stroke-smoothing.js.map +1 -0
  106. package/dist/editor/public/tool-ops.d.ts +130 -0
  107. package/dist/editor/public/tool-ops.d.ts.map +1 -0
  108. package/dist/editor/public/tool-ops.js +392 -0
  109. package/dist/editor/public/tool-ops.js.map +1 -0
  110. package/dist/editor/public/z-order.d.ts +1 -12
  111. package/dist/editor/public/z-order.d.ts.map +1 -1
  112. package/dist/editor/public/z-order.js +1 -1
  113. package/dist/editor/public/z-order.js.map +1 -1
  114. package/dist/editor/public/zoom-pan.d.ts +9 -0
  115. package/dist/editor/public/zoom-pan.d.ts.map +1 -1
  116. package/dist/editor/public/zoom-pan.js +31 -0
  117. package/dist/editor/public/zoom-pan.js.map +1 -1
  118. package/dist/editor/render-orchestrator.d.ts +177 -5
  119. package/dist/editor/render-orchestrator.d.ts.map +1 -1
  120. package/dist/editor/render-orchestrator.js +517 -351
  121. package/dist/editor/render-orchestrator.js.map +1 -1
  122. package/dist/editor/text-edit.d.ts +136 -0
  123. package/dist/editor/text-edit.d.ts.map +1 -0
  124. package/dist/editor/text-edit.js +328 -0
  125. package/dist/editor/text-edit.js.map +1 -0
  126. package/dist/editor.d.ts +504 -239
  127. package/dist/editor.d.ts.map +1 -1
  128. package/dist/editor.js +1557 -706
  129. package/dist/editor.js.map +1 -1
  130. package/dist/handle.d.ts +0 -2
  131. package/dist/handle.d.ts.map +1 -1
  132. package/dist/handle.js +0 -6
  133. package/dist/handle.js.map +1 -1
  134. package/dist/index.d.ts +6 -1
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +7 -1
  137. package/dist/index.js.map +1 -1
  138. package/dist/modes.d.ts +15 -1
  139. package/dist/modes.d.ts.map +1 -1
  140. package/dist/modes.js.map +1 -1
  141. package/dist/overlay.d.ts +91 -2
  142. package/dist/overlay.d.ts.map +1 -1
  143. package/dist/overlay.js +450 -93
  144. package/dist/overlay.js.map +1 -1
  145. package/dist/search.d.ts +37 -0
  146. package/dist/search.d.ts.map +1 -0
  147. package/dist/search.js +45 -0
  148. package/dist/search.js.map +1 -0
  149. package/package.json +4 -4
@@ -0,0 +1,152 @@
1
+ import { type LinkEndpoint, type Patch, type Scene } from "@oh-just-another/scene";
2
+ import type { ElementId, LinkId, Vec2 } from "@oh-just-another/types";
3
+ import type { InteractionEmit, PressTarget } from "../machine.js";
4
+ /**
5
+ * Editor capabilities the link handle drags need. Keeps the controller off
6
+ * the god-class: scene access, gesture transaction lifecycle, endpoint
7
+ * snapping and hover feedback are delegated back to the Editor through this
8
+ * narrow interface.
9
+ */
10
+ export interface LinkHandleDragHost {
11
+ /** Current scene (read + replace — live drags mutate through the gesture tx). */
12
+ scene: Scene;
13
+ /** Record a patch as one undo step (double-click delete / reset paths). */
14
+ pushHistory(patch: Patch): void;
15
+ /** Apply a live-drag patch into the open gesture transaction. */
16
+ recordGesturePatch(patch: Patch): void;
17
+ /** Commit the gesture transaction (one undo step for the whole drag). */
18
+ commitGesture(): void;
19
+ /** Cancel the gesture transaction (revert the live drag). */
20
+ cancelGesture(): void;
21
+ /** True while a gesture transaction is open (an endpoint move happened). */
22
+ hasGestureTx(): boolean;
23
+ /** Repaint + listener fan-out. */
24
+ notify(): void;
25
+ /** Attach target under the cursor (same resolution the drop uses). */
26
+ linkAttachTargetAt(worldPoint: Vec2): PressTarget | undefined;
27
+ /** Snap an endpoint to a target element / free point. */
28
+ snapLinkEndpoint(targetId: ElementId | null, worldPoint: Vec2): LinkEndpoint;
29
+ /** Drive the attach-point highlight (candidate dots + halo). */
30
+ updateHoveredLinkTarget(worldPoint: Vec2): void;
31
+ /** Drop the attach-point highlight. */
32
+ clearHoveredLinkTarget(): void;
33
+ }
34
+ /**
35
+ * Owns the link edit-handle drags: waypoint (bend point) drags, elbow
36
+ * segment drags, endpoint rebind drags and the handle double-click
37
+ * detector (delete waypoint / reset segment pin). Extracted from the
38
+ * Editor god-class; the Editor keeps thin delegate wrappers so its public
39
+ * API is unchanged.
40
+ */
41
+ export declare class LinkHandleDragController {
42
+ private readonly host;
43
+ /**
44
+ * Mid-drag preview state when the user is dragging an edge endpoint.
45
+ * Drawn as an overlay line + handle dot so the user sees the target.
46
+ */
47
+ private _endpointDrag;
48
+ /**
49
+ * Host-managed waypoint (bend-point) drag of the selected link. `index`
50
+ * is the position in `edge.waypoints`. `pendingInsert` means the gesture
51
+ * began on a segment midpoint and will splice a new waypoint on the
52
+ * first move (so a no-move click adds nothing). Live-mutated through the
53
+ * gesture transaction → one undo step per drag.
54
+ */
55
+ private _waypointDrag;
56
+ /**
57
+ * Host-managed elbow segment drag. `axis` is the segment's orientation.
58
+ * Dragging pins the segment's perpendicular coordinate into
59
+ * `Link.fixedSegments`; the reroute pass re-flows the rest. One undo
60
+ * step via the gesture tx.
61
+ */
62
+ private _segmentDrag;
63
+ /** Wall-clock of the previous handle press — drives `isHandleDoubleClick`. */
64
+ private lastHandleClickAt;
65
+ private lastHandleClickWorld;
66
+ constructor(host: LinkHandleDragHost);
67
+ get endpointDrag(): {
68
+ linkId: LinkId;
69
+ side: "from" | "to";
70
+ toPoint: Vec2;
71
+ } | null;
72
+ get waypointDrag(): {
73
+ linkId: LinkId;
74
+ index: number;
75
+ pendingInsert: boolean;
76
+ } | null;
77
+ get segmentDrag(): {
78
+ linkId: LinkId;
79
+ axis: "h" | "v";
80
+ at: number;
81
+ } | null;
82
+ /** Drop all drag state without committing (Escape / cancelInteraction). */
83
+ reset(): void;
84
+ /**
85
+ * Live endpoint-rebind move: re-point the dragged end to the cursor in the
86
+ * scene (a free `point` endpoint), recorded in the gesture transaction so the
87
+ * WHOLE link redraws under the cursor with full fidelity — real style,
88
+ * arrowhead, curved bow, and (via `rerouteElbows` in `render`) a live elbow
89
+ * re-route. One undo step on commit; Escape cancels the transaction and the
90
+ * link snaps back to where it was. The handle dot follows via `endpointDrag`.
91
+ */
92
+ applyEndpointMove(linkId: LinkId, side: "from" | "to", toPoint: Vec2): void;
93
+ applyEndpointUpdate(emit: Extract<InteractionEmit, {
94
+ type: "UPDATE_EDGE_ENDPOINT";
95
+ }>): void;
96
+ /** True while a waypoint of the selected link is being dragged. */
97
+ get isDraggingWaypoint(): boolean;
98
+ /**
99
+ * Begin a host-managed waypoint drag. `insert` splices a new waypoint at
100
+ * `index` on the first move (segment-midpoint "add" handle); otherwise an
101
+ * existing waypoint at `index` is moved. Live-mutated through the gesture
102
+ * transaction so the whole drag is one undo step.
103
+ */
104
+ beginWaypointDrag(linkId: LinkId, index: number, insert: boolean): void;
105
+ /** Live update of the dragged waypoint to `world`. */
106
+ updateWaypointDrag(world: Vec2): void;
107
+ /**
108
+ * Finish the waypoint drag. If the dragged waypoint landed within
109
+ * `WAYPOINT_COLLAPSE_RADIUS` of an adjacent path point, it is removed
110
+ * (drag-onto-the-line to delete). A no-move insert adds nothing.
111
+ */
112
+ endWaypointDrag(): void;
113
+ /** True while an elbow segment is being dragged. */
114
+ get isDraggingSegment(): boolean;
115
+ /**
116
+ * Begin a host-managed elbow segment drag. `axis` is the segment's
117
+ * orientation; `at` is its centre along its own axis (used to re-identify it
118
+ * across re-routes).
119
+ */
120
+ beginSegmentDrag(linkId: LinkId, axis: "h" | "v", at: number): void;
121
+ /**
122
+ * Move the dragged elbow segment perpendicular to its axis: pin its
123
+ * perpendicular coordinate to the cursor. The reroute pass re-flows the
124
+ * rest around the pin (one undo step via the gesture transaction).
125
+ */
126
+ updateSegmentDrag(world: Vec2): void;
127
+ /** Finish the elbow segment drag (commit the gesture as one undo step). */
128
+ endSegmentDrag(): void;
129
+ /**
130
+ * Double-click detector for link edit handles (waypoint / segment).
131
+ * Returns true when this press follows the previous handle press within
132
+ * the double-click window + tolerance. Updates state every call. Kept
133
+ * separate from the up-side double-click path (handles return early in
134
+ * `onDown`, so that path never sees them).
135
+ */
136
+ isHandleDoubleClick(world: Vec2): boolean;
137
+ /**
138
+ * Delete a free bend point (waypoint) from a straight / bezier link by
139
+ * index — double-click a waypoint handle to remove it. One undo step.
140
+ */
141
+ deleteWaypoint(linkId: LinkId, index: number): void;
142
+ /**
143
+ * Remove the pinned (fixed) elbow segment that matches the given
144
+ * geometry — double-click a segment handle to return it to the auto
145
+ * route. Matches by axis + nearest pinned perpendicular `pos` (exact for
146
+ * a pinned segment), `at` as tiebreak. The reroute pass re-flows on the
147
+ * next render (fixedSegments is part of the elbow signature). One undo
148
+ * step.
149
+ */
150
+ resetSegmentPin(linkId: LinkId, axis: "h" | "v", pos: number, at: number): void;
151
+ }
152
+ //# sourceMappingURL=link-handle-drag.d.ts.map
@@ -0,0 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AAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAKnE;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI;IAoBpC,2EAA2E;IAC3E,cAAc,IAAI,IAAI;IAMtB;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;IAWzC;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUnD;;;;;;;OAOG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;CAqBhF"}
@@ -0,0 +1,300 @@
1
+ import { getLink, getLinkPath, isNoop, updateLink, } from "@oh-just-another/scene";
2
+ import { hitTest, vec2 } from "@oh-just-another/math";
3
+ import { DOUBLE_CLICK_MS, DOUBLE_CLICK_TOLERANCE_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
+ /** Wall-clock of the previous handle press — drives `isHandleDoubleClick`. */
36
+ lastHandleClickAt = 0;
37
+ lastHandleClickWorld = null;
38
+ constructor(host) {
39
+ this.host = host;
40
+ }
41
+ get endpointDrag() {
42
+ return this._endpointDrag;
43
+ }
44
+ get waypointDrag() {
45
+ return this._waypointDrag;
46
+ }
47
+ get segmentDrag() {
48
+ return this._segmentDrag;
49
+ }
50
+ /** Drop all drag state without committing (Escape / cancelInteraction). */
51
+ reset() {
52
+ this._waypointDrag = null;
53
+ this._segmentDrag = null;
54
+ this._endpointDrag = null;
55
+ }
56
+ /**
57
+ * Live endpoint-rebind move: re-point the dragged end to the cursor in the
58
+ * scene (a free `point` endpoint), recorded in the gesture transaction so the
59
+ * WHOLE link redraws under the cursor with full fidelity — real style,
60
+ * arrowhead, curved bow, and (via `rerouteElbows` in `render`) a live elbow
61
+ * re-route. One undo step on commit; Escape cancels the transaction and the
62
+ * link snaps back to where it was. The handle dot follows via `endpointDrag`.
63
+ */
64
+ applyEndpointMove(linkId, side, toPoint) {
65
+ const edge = getLink(this.host.scene, linkId);
66
+ if (!edge)
67
+ return;
68
+ // A real drag breaks the handle double-click chain (mirrors waypoint /
69
+ // segment drags) so a quick click after dropping isn't read as a delete.
70
+ this.lastHandleClickAt = 0;
71
+ // Resolve the attach target under the cursor and snap the endpoint to it
72
+ // with the SAME logic the drop uses, so the link attaches LIVE exactly as it
73
+ // will commit — lands on the dot (fixed), floats on the body, or stays a
74
+ // free point over empty space.
75
+ const target = this.host.linkAttachTargetAt(toPoint);
76
+ const targetId = target?.kind === "element" ? target.id : null;
77
+ const ep = this.host.snapLinkEndpoint(targetId, toPoint);
78
+ const r = updateLink(this.host.scene, linkId, (e) => side === "from" ? { ...e, from: ep } : { ...e, to: ep });
79
+ this.host.scene = r.scene;
80
+ this.host.recordGesturePatch(r.patch);
81
+ this._endpointDrag = { linkId, side, toPoint };
82
+ // Attach-point highlight — the SAME feedback as drawing a new link
83
+ // (candidate dots + float-element halo), driven by `hoveredLinkTarget`.
84
+ this.host.updateHoveredLinkTarget(toPoint);
85
+ this.host.notify();
86
+ }
87
+ applyEndpointUpdate(emit) {
88
+ // A move opened a gesture transaction (live re-point per tick). The final
89
+ // snapped endpoint goes into the SAME transaction so the net history step is
90
+ // original → final (one undo). A pure click (no move, no tx) that resolves
91
+ // to a no-op change must not leave a junk undo entry.
92
+ const moved = this.host.hasGestureTx();
93
+ const result = computeLinkEndpointUpdate(this.host.scene, emit, (toElement, toPoint) => this.host.snapLinkEndpoint(toElement, toPoint));
94
+ if (result === null) {
95
+ this.host.cancelGesture();
96
+ this._endpointDrag = null;
97
+ this.host.clearHoveredLinkTarget();
98
+ this.host.notify();
99
+ return;
100
+ }
101
+ if (!moved && isNoop(result.patch)) {
102
+ this._endpointDrag = null;
103
+ this.host.clearHoveredLinkTarget();
104
+ this.host.notify();
105
+ return;
106
+ }
107
+ this.host.scene = result.scene;
108
+ this.host.recordGesturePatch(result.patch);
109
+ this.host.commitGesture();
110
+ this._endpointDrag = null;
111
+ this.host.clearHoveredLinkTarget();
112
+ }
113
+ /** True while a waypoint of the selected link is being dragged. */
114
+ get isDraggingWaypoint() {
115
+ return this._waypointDrag !== null;
116
+ }
117
+ /**
118
+ * Begin a host-managed waypoint drag. `insert` splices a new waypoint at
119
+ * `index` on the first move (segment-midpoint "add" handle); otherwise an
120
+ * existing waypoint at `index` is moved. Live-mutated through the gesture
121
+ * transaction so the whole drag is one undo step.
122
+ */
123
+ beginWaypointDrag(linkId, index, insert) {
124
+ if (!getLink(this.host.scene, linkId))
125
+ return;
126
+ this._waypointDrag = { linkId, index, pendingInsert: insert };
127
+ }
128
+ /** Live update of the dragged waypoint to `world`. */
129
+ updateWaypointDrag(world) {
130
+ const drag = this._waypointDrag;
131
+ if (!drag)
132
+ return;
133
+ // A real drag breaks the handle double-click chain (see updateSegmentDrag).
134
+ this.lastHandleClickAt = 0;
135
+ const edge = getLink(this.host.scene, drag.linkId);
136
+ if (!edge)
137
+ return;
138
+ const wps = [...(edge.waypoints ?? [])];
139
+ if (drag.pendingInsert) {
140
+ wps.splice(drag.index, 0, world);
141
+ drag.pendingInsert = false;
142
+ }
143
+ else {
144
+ if (drag.index < 0 || drag.index >= wps.length)
145
+ return;
146
+ wps[drag.index] = world;
147
+ }
148
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, waypoints: wps }));
149
+ this.host.scene = r.scene;
150
+ this.host.recordGesturePatch(r.patch);
151
+ this.host.notify();
152
+ }
153
+ /**
154
+ * Finish the waypoint drag. If the dragged waypoint landed within
155
+ * `WAYPOINT_COLLAPSE_RADIUS` of an adjacent path point, it is removed
156
+ * (drag-onto-the-line to delete). A no-move insert adds nothing.
157
+ */
158
+ endWaypointDrag() {
159
+ const drag = this._waypointDrag;
160
+ this._waypointDrag = null;
161
+ if (!drag)
162
+ return;
163
+ if (drag.pendingInsert) {
164
+ // Never moved → it was a click on a midpoint; nothing inserted.
165
+ this.host.commitGesture();
166
+ return;
167
+ }
168
+ const edge = getLink(this.host.scene, drag.linkId);
169
+ if (edge?.waypoints && drag.index >= 0 && drag.index < edge.waypoints.length) {
170
+ const path = getLinkPath(this.host.scene, edge);
171
+ const wp = req(edge.waypoints[drag.index]);
172
+ // Neighbours in the [from, ...waypoints, to] chain: path[index] and
173
+ // path[index + 2] (path[0] = from, so waypoint i sits at path[i + 1]).
174
+ // Dropping the waypoint back onto the straight segment between its
175
+ // neighbours removes the bend ("drag onto the line to delete").
176
+ const collapse = WAYPOINT_COLLAPSE_RADIUS / (this.host.scene.viewport.zoom || 1);
177
+ const a = path?.[drag.index];
178
+ const b = path?.[drag.index + 2];
179
+ if (a && b && hitTest.distanceToSegment(wp, a, b) <= collapse) {
180
+ const wps = edge.waypoints.filter((_, i) => i !== drag.index);
181
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, waypoints: wps }));
182
+ this.host.scene = r.scene;
183
+ this.host.recordGesturePatch(r.patch);
184
+ }
185
+ }
186
+ this.host.commitGesture();
187
+ }
188
+ /** True while an elbow segment is being dragged. */
189
+ get isDraggingSegment() {
190
+ return this._segmentDrag !== null;
191
+ }
192
+ /**
193
+ * Begin a host-managed elbow segment drag. `axis` is the segment's
194
+ * orientation; `at` is its centre along its own axis (used to re-identify it
195
+ * across re-routes).
196
+ */
197
+ beginSegmentDrag(linkId, axis, at) {
198
+ if (!getLink(this.host.scene, linkId))
199
+ return;
200
+ this._segmentDrag = { linkId, axis, at };
201
+ }
202
+ /**
203
+ * Move the dragged elbow segment perpendicular to its axis: pin its
204
+ * perpendicular coordinate to the cursor. The reroute pass re-flows the
205
+ * rest around the pin (one undo step via the gesture transaction).
206
+ */
207
+ updateSegmentDrag(world) {
208
+ const drag = this._segmentDrag;
209
+ if (!drag)
210
+ return;
211
+ // A real drag breaks the handle double-click chain, so a single click
212
+ // right after pinning can't be misread as a double-click (= delete).
213
+ this.lastHandleClickAt = 0;
214
+ const edge = getLink(this.host.scene, drag.linkId);
215
+ if (!edge)
216
+ return;
217
+ const pos = drag.axis === "h" ? world.y : world.x;
218
+ const fixed = [...(edge.fixedSegments ?? [])];
219
+ const entry = { axis: drag.axis, pos, at: drag.at };
220
+ const at = fixed.findIndex((f) => f.axis === drag.axis && Math.abs(f.at - drag.at) < 0.5);
221
+ if (at >= 0)
222
+ fixed[at] = entry;
223
+ else
224
+ fixed.push(entry);
225
+ const r = updateLink(this.host.scene, drag.linkId, (e) => ({ ...e, fixedSegments: fixed }));
226
+ this.host.scene = r.scene;
227
+ this.host.recordGesturePatch(r.patch);
228
+ this.host.notify();
229
+ }
230
+ /** Finish the elbow segment drag (commit the gesture as one undo step). */
231
+ endSegmentDrag() {
232
+ if (!this._segmentDrag)
233
+ return;
234
+ this._segmentDrag = null;
235
+ this.host.commitGesture();
236
+ }
237
+ /**
238
+ * Double-click detector for link edit handles (waypoint / segment).
239
+ * Returns true when this press follows the previous handle press within
240
+ * the double-click window + tolerance. Updates state every call. Kept
241
+ * separate from the up-side double-click path (handles return early in
242
+ * `onDown`, so that path never sees them).
243
+ */
244
+ isHandleDoubleClick(world) {
245
+ const now = performance.now();
246
+ const isDouble = now - this.lastHandleClickAt < DOUBLE_CLICK_MS &&
247
+ this.lastHandleClickWorld !== null &&
248
+ vec2.distance(this.lastHandleClickWorld, world) <= DOUBLE_CLICK_TOLERANCE_PX;
249
+ this.lastHandleClickAt = now;
250
+ this.lastHandleClickWorld = world;
251
+ return isDouble;
252
+ }
253
+ /**
254
+ * Delete a free bend point (waypoint) from a straight / bezier link by
255
+ * index — double-click a waypoint handle to remove it. One undo step.
256
+ */
257
+ deleteWaypoint(linkId, index) {
258
+ const edge = getLink(this.host.scene, linkId);
259
+ if (!edge?.waypoints || index < 0 || index >= edge.waypoints.length)
260
+ return;
261
+ const wps = edge.waypoints.filter((_, i) => i !== index);
262
+ const r = updateLink(this.host.scene, linkId, (e) => ({ ...e, waypoints: wps }));
263
+ this.host.scene = r.scene;
264
+ this.host.pushHistory(r.patch);
265
+ this.host.notify();
266
+ }
267
+ /**
268
+ * Remove the pinned (fixed) elbow segment that matches the given
269
+ * geometry — double-click a segment handle to return it to the auto
270
+ * route. Matches by axis + nearest pinned perpendicular `pos` (exact for
271
+ * a pinned segment), `at` as tiebreak. The reroute pass re-flows on the
272
+ * next render (fixedSegments is part of the elbow signature). One undo
273
+ * step.
274
+ */
275
+ resetSegmentPin(linkId, axis, pos, at) {
276
+ const edge = getLink(this.host.scene, linkId);
277
+ if (!edge?.fixedSegments || edge.fixedSegments.length === 0)
278
+ return;
279
+ let bestIdx = -1;
280
+ let bestD = Infinity;
281
+ for (let i = 0; i < edge.fixedSegments.length; i++) {
282
+ const f = req(edge.fixedSegments[i]);
283
+ if (f.axis !== axis)
284
+ continue;
285
+ const d = Math.abs(f.pos - pos) + Math.abs(f.at - at) * 0.001;
286
+ if (d < bestD) {
287
+ bestD = d;
288
+ bestIdx = i;
289
+ }
290
+ }
291
+ if (bestIdx < 0)
292
+ return;
293
+ const fixed = edge.fixedSegments.filter((_, i) => i !== bestIdx);
294
+ const r = updateLink(this.host.scene, linkId, (e) => ({ ...e, fixedSegments: fixed }));
295
+ this.host.scene = r.scene;
296
+ this.host.pushHistory(r.patch);
297
+ this.host.notify();
298
+ }
299
+ }
300
+ //# 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,WAAW,EACX,MAAM,EACN,UAAU,GAIX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,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;IAiCN;IAhC7B;;;OAGG;IACK,aAAa,GAIV,IAAI,CAAC;IAChB;;;;;;OAMG;IACK,aAAa,GAIV,IAAI,CAAC;IAChB;;;;;OAKG;IACK,YAAY,GAA2D,IAAI,CAAC;IACpF,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,CAAC;IAC5B,CAAC;IA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AAC,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":"AAwCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAikC3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,CAAC,MAAM,IAAI,CAoR7D,CAAC"}