dishui 0.0.56 → 0.0.59
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/components/Select/index.js +90 -72
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +659 -552
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +1041 -966
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/canvas/ViewportContainer.d.ts +6 -0
- package/dist/components/pro/Flow/canvas/ViewportContainer.js +20 -15
- package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.d.ts +6 -2
- package/dist/components/pro/Flow/context/FlowUIContext.js +51 -51
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useCompactMode.d.ts +13 -0
- package/dist/components/pro/Flow/hooks/useCompactMode.js +20 -0
- package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -0
- package/dist/components/pro/Flow/hooks/useDraggablePanel.d.ts +19 -4
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js +31 -24
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js +16 -22
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js +16 -16
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.d.ts +2 -2
- package/dist/components/pro/Flow/nodes/nodeUtils.js +12 -12
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.d.ts +10 -5
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js +95 -67
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/utils/i18n.js +10 -0
- package/dist/utils/i18n.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,620 +1,576 @@
|
|
|
1
|
-
import { useFlowContext as
|
|
2
|
-
import { useFlowUI as
|
|
3
|
-
import { usePixiApp as
|
|
4
|
-
import { useViewport as
|
|
5
|
-
import { GridRenderer as
|
|
6
|
-
import { SelectionOverlay as
|
|
7
|
-
import { shapeDrawers as
|
|
8
|
-
import { findClosestHandleWorld as
|
|
9
|
-
import { distToSegment as
|
|
10
|
-
import { NodeRenderer as
|
|
11
|
-
import { buildEdgePath as
|
|
12
|
-
import { EdgeRenderer as
|
|
13
|
-
import { LineRenderer as
|
|
14
|
-
import { FreehandTool as
|
|
15
|
-
import { GeometricLineTool as
|
|
16
|
-
import { computeAlignmentSnap as
|
|
17
|
-
import { AlignmentGuidesRenderer as
|
|
18
|
-
import { getDocumentSlides as
|
|
19
|
-
import { useCallback as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { Graphics as
|
|
22
|
-
var
|
|
1
|
+
import { useFlowContext as ln } from "./context/FlowContext.js";
|
|
2
|
+
import { useFlowUI as un } from "./context/FlowUIContext.js";
|
|
3
|
+
import { usePixiApp as fn } from "./hooks/usePixiApp.js";
|
|
4
|
+
import { useViewport as hn } from "./hooks/useViewport.js";
|
|
5
|
+
import { GridRenderer as yn } from "./canvas/GridRenderer.js";
|
|
6
|
+
import { SelectionOverlay as pn } from "./canvas/SelectionOverlay.js";
|
|
7
|
+
import { shapeDrawers as je } from "./nodes/shapes.js";
|
|
8
|
+
import { findClosestHandleWorld as At, getHandlePositions as It, handleWorldPos as Wt } from "./nodes/NodeHandles.js";
|
|
9
|
+
import { distToSegment as Ne, generateId as xn, isPointInNode as Yt, rectsOverlap as gn } from "./nodes/nodeUtils.js";
|
|
10
|
+
import { NodeRenderer as wn } from "./nodes/NodeRenderer.js";
|
|
11
|
+
import { buildEdgePath as sn, linearizeSegments as cn, resolveEdgeEndpoints as Mt } from "./edges/edgePaths.js";
|
|
12
|
+
import { EdgeRenderer as mn } from "./edges/EdgeRenderer.js";
|
|
13
|
+
import { LineRenderer as vn } from "./lines/LineRenderer.js";
|
|
14
|
+
import { FreehandTool as In } from "./lines/FreehandTool.js";
|
|
15
|
+
import { GeometricLineTool as bn } from "./lines/GeometricLineTool.js";
|
|
16
|
+
import { computeAlignmentSnap as le } from "./hooks/useAlignmentGuides.js";
|
|
17
|
+
import { AlignmentGuidesRenderer as Mn } from "./canvas/AlignmentGuides.js";
|
|
18
|
+
import { getDocumentSlides as Rn, nextAnimIndex as Sn } from "./nodes/animAnchors.js";
|
|
19
|
+
import { useCallback as Jt, useEffect as bt, useRef as I, useState as $e } from "react";
|
|
20
|
+
import { jsx as Ce, jsxs as Je } from "react/jsx-runtime";
|
|
21
|
+
import { Graphics as Qt } from "pixi.js";
|
|
22
|
+
var zn = {
|
|
23
23
|
nw: "nwse-resize",
|
|
24
24
|
ne: "nesw-resize",
|
|
25
25
|
se: "nwse-resize",
|
|
26
26
|
sw: "nesw-resize"
|
|
27
|
-
};
|
|
28
|
-
function
|
|
29
|
-
|
|
27
|
+
}, ue = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, Qe = ue ? 2 : 1;
|
|
28
|
+
function $(_, S, H) {
|
|
29
|
+
return Math.min(S * Qe / _, H * Qe);
|
|
30
|
+
}
|
|
31
|
+
function tn(_, S, H) {
|
|
32
|
+
const { x: V, y: E } = S.position, L = S.width, D = S.height, C = [
|
|
30
33
|
[
|
|
31
34
|
"nw",
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
V,
|
|
36
|
+
E
|
|
34
37
|
],
|
|
35
38
|
[
|
|
36
39
|
"ne",
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
V + L,
|
|
41
|
+
E
|
|
39
42
|
],
|
|
40
43
|
[
|
|
41
44
|
"se",
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
V + L,
|
|
46
|
+
E + D
|
|
44
47
|
],
|
|
45
48
|
[
|
|
46
49
|
"sw",
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
V,
|
|
51
|
+
E + D
|
|
49
52
|
]
|
|
50
53
|
];
|
|
51
|
-
let M = null,
|
|
52
|
-
for (const [
|
|
53
|
-
const K = Math.hypot(
|
|
54
|
-
K <
|
|
54
|
+
let M = null, q = H;
|
|
55
|
+
for (const [j, at, nt] of C) {
|
|
56
|
+
const K = Math.hypot(_.x - at, _.y - nt);
|
|
57
|
+
K < q && (q = K, M = j);
|
|
55
58
|
}
|
|
56
59
|
return M;
|
|
57
60
|
}
|
|
58
|
-
function
|
|
59
|
-
let
|
|
60
|
-
for (const
|
|
61
|
-
const M = Mt(
|
|
61
|
+
function en(_, S, H, V, E) {
|
|
62
|
+
let L = null, D = E;
|
|
63
|
+
for (const C of H) {
|
|
64
|
+
const M = Mt(C, V);
|
|
62
65
|
if (!M) continue;
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
edgeId:
|
|
66
|
+
const q = Math.hypot(_ - M.sx, S - M.sy);
|
|
67
|
+
q < D && (D = q, L = {
|
|
68
|
+
edgeId: C.id,
|
|
66
69
|
end: "source",
|
|
67
70
|
worldX: M.sx,
|
|
68
71
|
worldY: M.sy
|
|
69
72
|
});
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
edgeId:
|
|
73
|
+
const j = Math.hypot(_ - M.tx, S - M.ty);
|
|
74
|
+
j < D && (D = j, L = {
|
|
75
|
+
edgeId: C.id,
|
|
73
76
|
end: "target",
|
|
74
77
|
worldX: M.tx,
|
|
75
78
|
worldY: M.ty
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
|
-
return
|
|
81
|
+
return L;
|
|
79
82
|
}
|
|
80
|
-
function
|
|
81
|
-
let
|
|
82
|
-
for (const
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
for (let M = 0; M <
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
edgeId:
|
|
83
|
+
function nn(_, S, H, V) {
|
|
84
|
+
let E = null, L = V;
|
|
85
|
+
for (const D of H) {
|
|
86
|
+
const C = D.data.waypoints;
|
|
87
|
+
if (C)
|
|
88
|
+
for (let M = 0; M < C.length; M++) {
|
|
89
|
+
const q = Math.hypot(_ - C[M].x, S - C[M].y);
|
|
90
|
+
q < L && (L = q, E = {
|
|
91
|
+
edgeId: D.id,
|
|
89
92
|
waypointIndex: M,
|
|
90
|
-
wx:
|
|
91
|
-
wy:
|
|
93
|
+
wx: C[M].x,
|
|
94
|
+
wy: C[M].y
|
|
92
95
|
});
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
|
-
return
|
|
98
|
+
return E;
|
|
96
99
|
}
|
|
97
|
-
function
|
|
98
|
-
let
|
|
99
|
-
for (const
|
|
100
|
-
if (
|
|
101
|
-
const M = Mt(
|
|
100
|
+
function rn(_, S, H, V, E) {
|
|
101
|
+
let L = null, D = E;
|
|
102
|
+
for (const C of H) {
|
|
103
|
+
if (C.type !== "simplebezier") continue;
|
|
104
|
+
const M = Mt(C, V);
|
|
102
105
|
if (!M) continue;
|
|
103
|
-
const
|
|
106
|
+
const q = C.data.waypoints ?? [], j = [
|
|
104
107
|
{
|
|
105
108
|
x: M.sx,
|
|
106
109
|
y: M.sy
|
|
107
110
|
},
|
|
108
|
-
...
|
|
111
|
+
...q,
|
|
109
112
|
{
|
|
110
113
|
x: M.tx,
|
|
111
114
|
y: M.ty
|
|
112
115
|
}
|
|
113
|
-
],
|
|
114
|
-
for (let K = 0; K <=
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
edgeId:
|
|
116
|
+
], at = C.data.bezierControls, nt = j.length - 2;
|
|
117
|
+
for (let K = 0; K <= nt; K++) {
|
|
118
|
+
const rt = j[K], ot = j[K + 1], Rt = at?.[K], Xt = Math.hypot(ot.x - rt.x, ot.y - rt.y), Tt = Math.max(30, Xt * 0.3), te = Rt?.c1x ?? (K === 0 ? rt.x + M.snx * Tt : rt.x + (ot.x - rt.x) * 0.4), _t = Rt?.c1y ?? (K === 0 ? rt.y + M.sny * Tt : rt.y), Ft = Rt?.c2x ?? (K === nt ? ot.x + M.tnx * Tt : ot.x - (ot.x - rt.x) * 0.4), St = Rt?.c2y ?? (K === nt ? ot.y + M.tny * Tt : ot.y), zt = Math.hypot(_ - te, S - _t);
|
|
119
|
+
zt < D && (D = zt, L = {
|
|
120
|
+
edgeId: C.id,
|
|
118
121
|
segmentIndex: K,
|
|
119
122
|
controlEnd: "c1",
|
|
120
|
-
wx:
|
|
121
|
-
wy:
|
|
123
|
+
wx: te,
|
|
124
|
+
wy: _t
|
|
122
125
|
});
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
edgeId:
|
|
126
|
+
const pt = Math.hypot(_ - Ft, S - St);
|
|
127
|
+
pt < D && (D = pt, L = {
|
|
128
|
+
edgeId: C.id,
|
|
126
129
|
segmentIndex: K,
|
|
127
130
|
controlEnd: "c2",
|
|
128
|
-
wx:
|
|
129
|
-
wy:
|
|
131
|
+
wx: Ft,
|
|
132
|
+
wy: St
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
|
-
return
|
|
136
|
+
return L;
|
|
134
137
|
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
138
|
-
const
|
|
138
|
+
function Cn(_, S, H, V) {
|
|
139
|
+
const E = Mt(H, V);
|
|
140
|
+
if (!E) return 0;
|
|
141
|
+
const L = H.data.waypoints ?? [], D = [
|
|
139
142
|
{
|
|
140
|
-
x:
|
|
141
|
-
y:
|
|
143
|
+
x: E.sx,
|
|
144
|
+
y: E.sy
|
|
142
145
|
},
|
|
143
|
-
...
|
|
146
|
+
...L,
|
|
144
147
|
{
|
|
145
|
-
x:
|
|
146
|
-
y:
|
|
148
|
+
x: E.tx,
|
|
149
|
+
y: E.ty
|
|
147
150
|
}
|
|
148
151
|
];
|
|
149
|
-
let
|
|
150
|
-
for (let
|
|
151
|
-
const
|
|
152
|
-
|
|
152
|
+
let C = 1 / 0, M = 0;
|
|
153
|
+
for (let q = 0; q < D.length - 1; q++) {
|
|
154
|
+
const j = Ne(_, S, D[q].x, D[q].y, D[q + 1].x, D[q + 1].y);
|
|
155
|
+
j < C && (C = j, M = q);
|
|
153
156
|
}
|
|
154
157
|
return M;
|
|
155
158
|
}
|
|
156
|
-
function
|
|
157
|
-
let { x:
|
|
158
|
-
const
|
|
159
|
-
return
|
|
160
|
-
x:
|
|
161
|
-
y:
|
|
162
|
-
w:
|
|
159
|
+
function En(_, S, H, V, E = 24) {
|
|
160
|
+
let { x: L, y: D, w: C, h: M } = { ..._ };
|
|
161
|
+
const q = S === "nw" || S === "sw", j = S === "ne" || S === "se", at = S === "nw" || S === "ne", nt = S === "sw" || S === "se";
|
|
162
|
+
return q && (L += H, C -= H), j && (C += H), at && (D += V, M -= V), nt && (M += V), C < E && (q && (L = _.x + _.w - E), C = E), M < E && (at && (D = _.y + _.h - E), M = E), {
|
|
163
|
+
x: L,
|
|
164
|
+
y: D,
|
|
165
|
+
w: C,
|
|
163
166
|
h: M
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
|
-
function
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
169
|
-
const
|
|
170
|
-
for (let
|
|
169
|
+
function Ee(_, S, H, V, E) {
|
|
170
|
+
const L = Mt(H, V);
|
|
171
|
+
if (!L) return !1;
|
|
172
|
+
const D = cn(sn(H.type, L, H.data.waypoints, H.data.bezierControls));
|
|
173
|
+
for (let C = 0; C < D.length - 1; C++) if (Ne(_, S, D[C].x, D[C].y, D[C + 1].x, D[C + 1].y) < E) return !0;
|
|
171
174
|
return !1;
|
|
172
175
|
}
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
for (let
|
|
176
|
+
function on(_, S, H, V) {
|
|
177
|
+
const E = H.points;
|
|
178
|
+
for (let L = 0; L < E.length - 1; L++) if (Ne(_, S, E[L].x, E[L].y, E[L + 1].x, E[L + 1].y) < V) return !0;
|
|
176
179
|
return !1;
|
|
177
180
|
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
}, [])), { setViewportInternal:
|
|
181
|
+
function $n({ onPixiReady: _ }) {
|
|
182
|
+
const S = I(null), H = I(null), V = I(13751771), { pixiRef: E, readyRef: L } = fn(S, Jt((l) => {
|
|
183
|
+
V.current = l.gridDot, H.current && (H.current.dotColor = l.gridDot);
|
|
184
|
+
}, [])), { setViewportInternal: D, viewportReqRef: C, viewport: M, autoFocus: q, showGrid: j, showAnchors: at, gridSize: nt, toolMode: K, edgeType: rt, focusOnRect: ot, setFocusOnRect: Rt, pendingPlacement: Xt, setPendingPlacement: Tt, setContextMenu: te, beginNodeDrag: _t, endNodeDrag: Ft, presentation: St, editingNodeId: zt, setEditingNodeId: pt } = un(), { currentCanvas: fe, selection: Te, setSelection: ht, setDoc: J, currentCanvasId: he, pushCanvas: dn, doc: De } = ln(), Ct = I(null), ee = I(null), ne = I(null), re = I(null), ye = I(null), pe = I(null), oe = I(null), Ot = I(null), qt = I(null), se = I(null), Dt = I([]), xe = I(null), ge = I(null), lt = I(null), Zt = I(null), ke = I({
|
|
182
185
|
time: 0,
|
|
183
186
|
wx: 0,
|
|
184
187
|
wy: 0
|
|
185
|
-
}),
|
|
188
|
+
}), kt = I({
|
|
186
189
|
time: 0,
|
|
187
190
|
wx: 0,
|
|
188
191
|
wy: 0
|
|
189
|
-
}),
|
|
192
|
+
}), He = I(0), Vt = I(null), Pe = I({
|
|
190
193
|
x: 0,
|
|
191
194
|
y: 0
|
|
192
|
-
}),
|
|
193
|
-
...
|
|
194
|
-
nodes:
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
195
|
+
}), Le = at || St ? fe : {
|
|
196
|
+
...fe,
|
|
197
|
+
nodes: fe.nodes.filter((l) => l.type !== "animAnchor")
|
|
198
|
+
}, W = I(Le);
|
|
199
|
+
W.current = Le;
|
|
200
|
+
const B = I(he);
|
|
201
|
+
B.current = he;
|
|
202
|
+
const Bt = I(Te);
|
|
203
|
+
Bt.current = Te;
|
|
204
|
+
const Ge = I(De);
|
|
205
|
+
Ge.current = De;
|
|
206
|
+
const Kt = I(K);
|
|
207
|
+
Kt.current = K;
|
|
208
|
+
const Ut = I(q);
|
|
209
|
+
Ut.current = q;
|
|
210
|
+
const jt = I(ot);
|
|
211
|
+
jt.current = ot;
|
|
212
|
+
const Ae = I(rt);
|
|
213
|
+
Ae.current = rt;
|
|
214
|
+
const We = I(at);
|
|
215
|
+
We.current = at;
|
|
216
|
+
const Ht = I(St);
|
|
217
|
+
Ht.current = St;
|
|
218
|
+
const ce = I(Xt);
|
|
219
|
+
ce.current = Xt;
|
|
220
|
+
const Ye = I(_t);
|
|
221
|
+
Ye.current = _t;
|
|
222
|
+
const ie = I(Ft);
|
|
223
|
+
ie.current = Ft;
|
|
224
|
+
const st = I(null), Q = I(null), tt = I(null), ct = I(null), xt = I(null), yt = I(null), gt = I(null), we = I(M), me = I(0), { vmRef: F, screenToWorld: Xe } = hn(E, Jt((l) => {
|
|
225
|
+
we.current = l, me.current || (me.current = requestAnimationFrame(() => {
|
|
226
|
+
me.current = 0, D(we.current);
|
|
224
227
|
}));
|
|
225
|
-
}, [
|
|
226
|
-
|
|
227
|
-
const [
|
|
228
|
-
|
|
229
|
-
const
|
|
228
|
+
}, [D])), it = I(Xe);
|
|
229
|
+
it.current = Xe;
|
|
230
|
+
const [ut, ve] = $e(null), [Ie, be] = $e(null), Me = I(ut);
|
|
231
|
+
Me.current = ut;
|
|
232
|
+
const de = I(() => {
|
|
230
233
|
});
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
de.current = (l, P, X) => {
|
|
235
|
+
pt(l === "node" ? P : null), ve({
|
|
233
236
|
kind: l,
|
|
234
|
-
id:
|
|
235
|
-
value:
|
|
237
|
+
id: P,
|
|
238
|
+
value: X
|
|
236
239
|
});
|
|
237
240
|
};
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
243
|
-
let
|
|
244
|
-
if (
|
|
245
|
-
...
|
|
246
|
-
nodes:
|
|
247
|
-
...
|
|
241
|
+
const _e = Jt((l) => {
|
|
242
|
+
const P = Me.current;
|
|
243
|
+
P && (J((X) => {
|
|
244
|
+
const A = B.current, Z = X.canvases[A];
|
|
245
|
+
if (!Z) return X;
|
|
246
|
+
let O = Z;
|
|
247
|
+
if (P.kind === "node") O = {
|
|
248
|
+
...Z,
|
|
249
|
+
nodes: Z.nodes.map((Y) => Y.id === P.id ? {
|
|
250
|
+
...Y,
|
|
248
251
|
data: {
|
|
249
|
-
...
|
|
252
|
+
...Y.data,
|
|
250
253
|
label: l
|
|
251
254
|
}
|
|
252
|
-
} :
|
|
255
|
+
} : Y)
|
|
253
256
|
};
|
|
254
|
-
else if (
|
|
255
|
-
...
|
|
256
|
-
edges:
|
|
257
|
-
...
|
|
257
|
+
else if (P.kind === "edge") O = {
|
|
258
|
+
...Z,
|
|
259
|
+
edges: Z.edges.map((Y) => Y.id === P.id ? {
|
|
260
|
+
...Y,
|
|
258
261
|
data: {
|
|
259
|
-
...
|
|
262
|
+
...Y.data,
|
|
260
263
|
labelText: l
|
|
261
264
|
}
|
|
262
|
-
} :
|
|
265
|
+
} : Y)
|
|
263
266
|
};
|
|
264
|
-
else return
|
|
267
|
+
else return X;
|
|
265
268
|
return {
|
|
266
|
-
...
|
|
269
|
+
...X,
|
|
267
270
|
canvases: {
|
|
268
|
-
...
|
|
269
|
-
[
|
|
271
|
+
...X.canvases,
|
|
272
|
+
[A]: O
|
|
270
273
|
}
|
|
271
274
|
};
|
|
272
|
-
}),
|
|
273
|
-
}, [J,
|
|
274
|
-
|
|
275
|
-
}, [
|
|
276
|
-
|
|
277
|
-
if (!
|
|
278
|
-
const l =
|
|
279
|
-
l &&
|
|
280
|
-
}, [
|
|
281
|
-
if (!
|
|
282
|
-
const l =
|
|
275
|
+
}), ve(null), pt(null), be(null));
|
|
276
|
+
}, [J, pt]), an = Jt(() => {
|
|
277
|
+
ve(null), pt(null), be(null);
|
|
278
|
+
}, [pt]);
|
|
279
|
+
bt(() => {
|
|
280
|
+
if (!zt || Me.current?.id === zt) return;
|
|
281
|
+
const l = W.current.nodes.find((P) => P.id === zt);
|
|
282
|
+
l && de.current("node", l.id, l.data.label);
|
|
283
|
+
}, [zt]), bt(() => {
|
|
284
|
+
if (!ut) return;
|
|
285
|
+
const l = F.current;
|
|
283
286
|
if (!l) return;
|
|
284
|
-
const
|
|
285
|
-
let
|
|
286
|
-
if (
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
x:
|
|
290
|
-
y:
|
|
287
|
+
const P = W.current;
|
|
288
|
+
let X = null;
|
|
289
|
+
if (ut.kind === "node") {
|
|
290
|
+
const A = P.nodes.find((Z) => Z.id === ut.id);
|
|
291
|
+
A && (X = {
|
|
292
|
+
x: A.position.x + A.width / 2,
|
|
293
|
+
y: A.position.y + A.height / 2
|
|
291
294
|
});
|
|
292
|
-
} else if (
|
|
293
|
-
const
|
|
294
|
-
for (const
|
|
295
|
-
if (
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
298
|
-
const
|
|
299
|
-
x: (
|
|
300
|
-
y: (
|
|
295
|
+
} else if (ut.kind === "edge") {
|
|
296
|
+
const A = P.edges.find((O) => O.id === ut.id), Z = /* @__PURE__ */ new Map();
|
|
297
|
+
for (const O of P.nodes) Z.set(O.id, O);
|
|
298
|
+
if (A) {
|
|
299
|
+
const O = Mt(A, Z);
|
|
300
|
+
if (O) {
|
|
301
|
+
const Y = cn(sn(A.type, O, A.data.waypoints, A.data.bezierControls)), dt = Y[Math.floor(Y.length / 2)] ?? {
|
|
302
|
+
x: (O.sx + O.tx) / 2,
|
|
303
|
+
y: (O.sy + O.ty) / 2
|
|
301
304
|
};
|
|
302
|
-
|
|
303
|
-
x:
|
|
304
|
-
y:
|
|
305
|
+
X = {
|
|
306
|
+
x: dt.x,
|
|
307
|
+
y: dt.y
|
|
305
308
|
};
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
x:
|
|
313
|
-
y:
|
|
312
|
+
if (X) {
|
|
313
|
+
const A = l.worldToScreen(X.x, X.y);
|
|
314
|
+
be({
|
|
315
|
+
x: A.x,
|
|
316
|
+
y: A.y
|
|
314
317
|
});
|
|
315
318
|
}
|
|
316
|
-
}, [
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
}, [ut, F]);
|
|
320
|
+
const Fe = I(0);
|
|
321
|
+
bt(() => {
|
|
322
|
+
C.current !== Fe.current && (Fe.current = C.current, we.current = M, F.current?.setState(M));
|
|
320
323
|
}, [
|
|
321
324
|
M,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
]),
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
x:
|
|
331
|
-
y:
|
|
332
|
-
zoom:
|
|
333
|
-
},
|
|
325
|
+
F,
|
|
326
|
+
C
|
|
327
|
+
]), bt(() => {
|
|
328
|
+
Rt((l, P, X, A, Z) => {
|
|
329
|
+
const O = F.current, Y = S.current;
|
|
330
|
+
if (!O || !Y) return;
|
|
331
|
+
const dt = Y.clientWidth || 800, wt = Y.clientHeight || 600, mt = Math.max(0, Z?.padding ?? 60), Pt = Math.max(1, dt - mt * 2), vt = Math.max(1, wt - mt * 2), Et = Z?.preserveZoom ? O.state.zoom : Math.min(Pt / Math.max(X, 1), vt / Math.max(A, 1), Z?.maxZoom ?? 2), Nt = l + X / 2, ft = P + A / 2, $t = dt / 2 - Nt * Et, Se = wt / 2 - ft * Et;
|
|
332
|
+
O.animateTo({
|
|
333
|
+
x: $t,
|
|
334
|
+
y: Se,
|
|
335
|
+
zoom: Et
|
|
336
|
+
}, Z?.duration ?? 350);
|
|
334
337
|
});
|
|
335
|
-
}, [
|
|
336
|
-
const
|
|
337
|
-
J((
|
|
338
|
-
const
|
|
339
|
-
return
|
|
340
|
-
...
|
|
338
|
+
}, [Rt, F]);
|
|
339
|
+
const Oe = Jt((l) => {
|
|
340
|
+
J((P) => {
|
|
341
|
+
const X = P.canvases[B.current];
|
|
342
|
+
return X ? {
|
|
343
|
+
...P,
|
|
341
344
|
canvases: {
|
|
342
|
-
...
|
|
343
|
-
[
|
|
344
|
-
...
|
|
345
|
-
lines: [...
|
|
345
|
+
...P.canvases,
|
|
346
|
+
[B.current]: {
|
|
347
|
+
...X,
|
|
348
|
+
lines: [...X.lines, l]
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
|
-
} :
|
|
351
|
+
} : P;
|
|
349
352
|
});
|
|
350
|
-
}, [J,
|
|
351
|
-
return
|
|
352
|
-
const l =
|
|
353
|
+
}, [J, he]), Re = I(Oe);
|
|
354
|
+
return Re.current = Oe, bt(() => {
|
|
355
|
+
const l = E.current;
|
|
353
356
|
if (!l || l.destroyed) return;
|
|
354
|
-
let
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
357
|
-
if (!
|
|
358
|
-
setTimeout(
|
|
357
|
+
let P = !1, X = null, A = null, Z = null;
|
|
358
|
+
const O = () => {
|
|
359
|
+
if (P) return;
|
|
360
|
+
if (!L.current) {
|
|
361
|
+
setTimeout(O, 30);
|
|
359
362
|
return;
|
|
360
363
|
}
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
onLineComplete: (
|
|
373
|
-
screenToWorld: (
|
|
374
|
-
}),
|
|
375
|
-
onLineComplete: (
|
|
376
|
-
screenToWorld: (
|
|
377
|
-
}),
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
if (s === "freehand" || s === "line" || s === "polyline" || s === "arrow") return;
|
|
387
|
-
const u = st.current(m.global.x, m.global.y), v = A.current.nodes, P = A.current.edges, N = A.current.lines, I = Yt.current, S = m.metaKey || m.ctrlKey || m.shiftKey, O = $.current?.state.zoom ?? 1, e = ae.current;
|
|
388
|
-
if (e) {
|
|
389
|
-
const t = Qe("node"), i = u.x - e.width / 2, n = u.y - e.height / 2, o = ne([{
|
|
390
|
-
id: "__ghost__",
|
|
391
|
-
type: e.type,
|
|
392
|
-
position: {
|
|
393
|
-
x: i,
|
|
394
|
-
y: n
|
|
395
|
-
},
|
|
396
|
-
width: e.width,
|
|
397
|
-
height: e.height,
|
|
398
|
-
data: {}
|
|
399
|
-
}], v), r = i + o.dx, d = n + o.dy;
|
|
400
|
-
J((w) => {
|
|
401
|
-
const g = w.canvases[V.current];
|
|
402
|
-
if (!g) return w;
|
|
403
|
-
const C = {};
|
|
404
|
-
e.type === "animAnchor" && (C.animIndex = an(w));
|
|
405
|
-
const H = Math.max(0, ...g.nodes.map((h) => h.zIndex ?? 0), ...g.lines.map((h) => h.zIndex ?? 0));
|
|
406
|
-
return {
|
|
407
|
-
...w,
|
|
408
|
-
canvases: {
|
|
409
|
-
...w.canvases,
|
|
410
|
-
[V.current]: {
|
|
411
|
-
...g,
|
|
412
|
-
nodes: [...g.nodes, {
|
|
413
|
-
id: t,
|
|
414
|
-
type: e.type,
|
|
415
|
-
position: {
|
|
416
|
-
x: r,
|
|
417
|
-
y: d
|
|
418
|
-
},
|
|
419
|
-
width: e.width,
|
|
420
|
-
height: e.height,
|
|
421
|
-
zIndex: H + 1,
|
|
422
|
-
data: {
|
|
423
|
-
...e.data,
|
|
424
|
-
...C
|
|
425
|
-
}
|
|
426
|
-
}]
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
}), lt({
|
|
431
|
-
nodeIds: /* @__PURE__ */ new Set([t]),
|
|
432
|
-
edgeIds: /* @__PURE__ */ new Set(),
|
|
433
|
-
lineIds: /* @__PURE__ */ new Set()
|
|
434
|
-
}), Ft.current && window.setTimeout(() => {
|
|
435
|
-
_t.current(r, d, e.width, e.height, {
|
|
436
|
-
padding: 80,
|
|
437
|
-
preserveZoom: !0,
|
|
438
|
-
duration: 280
|
|
439
|
-
});
|
|
440
|
-
}, 0);
|
|
364
|
+
H.current = new yn(l.app.stage, nt, j), H.current.dotColor = V.current, Ct.current = new pn(l.app.stage), ee.current = new wn(l.world), ne.current = new mn(l.world), re.current = new vn(l.world);
|
|
365
|
+
const Y = new Qt();
|
|
366
|
+
Y.label = "connect-line", Y.visible = !1, l.world.addChild(Y), xt.current = Y;
|
|
367
|
+
const dt = new Qt();
|
|
368
|
+
dt.label = "transform-handles", l.app.stage.addChild(dt), Ot.current = dt;
|
|
369
|
+
const wt = new Qt();
|
|
370
|
+
wt.label = "handle-hover", l.world.addChild(wt), qt.current = wt;
|
|
371
|
+
const mt = new Qt();
|
|
372
|
+
mt.label = "edge-edit-handles", l.world.addChild(mt), Zt.current = mt;
|
|
373
|
+
const Pt = new Qt();
|
|
374
|
+
Pt.label = "ghost-placement", Pt.alpha = 0.5, l.world.addChild(Pt), Vt.current = Pt, se.current = new Mn(l.world), ye.current = new In(l.app.stage, l.world, {
|
|
375
|
+
onLineComplete: (f) => Re.current(f),
|
|
376
|
+
screenToWorld: (f, o) => it.current(f, o)
|
|
377
|
+
}), pe.current = new bn(l.app.stage, l.world, {
|
|
378
|
+
onLineComplete: (f) => Re.current(f),
|
|
379
|
+
screenToWorld: (f, o) => it.current(f, o)
|
|
380
|
+
}), _?.(l);
|
|
381
|
+
const vt = l.app.stage;
|
|
382
|
+
vt.on("pointerdown", (f) => {
|
|
383
|
+
if (S.current?.focus({ preventScroll: !0 }), F.current?.multiTouchActive || F.current?.isPanning || F.current?.isSpaceHeld || f.button !== 0) return;
|
|
384
|
+
const o = Kt.current;
|
|
385
|
+
if (o === "pan") {
|
|
386
|
+
F.current?.startPan(f.global.x, f.global.y);
|
|
441
387
|
return;
|
|
442
388
|
}
|
|
443
|
-
|
|
444
|
-
|
|
389
|
+
if (o === "freehand" || o === "line" || o === "polyline" || o === "arrow") return;
|
|
390
|
+
const i = it.current(f.global.x, f.global.y), p = W.current.nodes, N = W.current.edges, k = W.current.lines, z = Bt.current, b = f.metaKey || f.ctrlKey || f.shiftKey, T = F.current?.state.zoom ?? 1;
|
|
391
|
+
if (ce.current) return;
|
|
392
|
+
const c = Date.now(), h = ke.current, u = c - h.time < 350 && Math.hypot(i.x - h.wx, i.y - h.wy) < 8 / T;
|
|
393
|
+
if (ke.current = {
|
|
445
394
|
time: c,
|
|
446
|
-
wx:
|
|
447
|
-
wy:
|
|
448
|
-
},
|
|
449
|
-
const t =
|
|
395
|
+
wx: i.x,
|
|
396
|
+
wy: i.y
|
|
397
|
+
}, z.nodeIds.size === 1 && !b && o === "select") {
|
|
398
|
+
const t = p.find((r) => r.id === [...z.nodeIds][0]);
|
|
450
399
|
if (t) {
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
const
|
|
454
|
-
for (const
|
|
455
|
-
|
|
456
|
-
x:
|
|
457
|
-
y:
|
|
458
|
-
w:
|
|
459
|
-
h:
|
|
460
|
-
}) :
|
|
461
|
-
x:
|
|
462
|
-
y:
|
|
463
|
-
w:
|
|
464
|
-
h:
|
|
400
|
+
const r = tn(i, t, $(T, 10, 16));
|
|
401
|
+
if (r) {
|
|
402
|
+
const d = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), e = t.type === "geometryGroup", s = e || t.type === "flowGroup" || t.data.isGroup, w = t.position.x, m = t.position.y, R = t.width, G = t.height;
|
|
403
|
+
for (const y of p)
|
|
404
|
+
y.id !== t.id && (y.parentId === t.id ? d.set(y.id, {
|
|
405
|
+
x: y.position.x,
|
|
406
|
+
y: y.position.y,
|
|
407
|
+
w: y.width,
|
|
408
|
+
h: y.height
|
|
409
|
+
}) : e && y.position.x >= w && y.position.y >= m && y.position.x + y.width <= w + R && y.position.y + y.height <= m + G && d.set(y.id, {
|
|
410
|
+
x: y.position.x,
|
|
411
|
+
y: y.position.y,
|
|
412
|
+
w: y.width,
|
|
413
|
+
h: y.height
|
|
465
414
|
}));
|
|
466
|
-
if (
|
|
467
|
-
for (const
|
|
468
|
-
|
|
415
|
+
if (s)
|
|
416
|
+
for (const y of W.current.lines) y.parentId === t.id ? a.set(y.id, y.points.map((v) => ({ ...v }))) : e && y.points.length > 0 && y.points.every((v) => v.x >= w && v.x <= w + R && v.y >= m && v.y <= m + G) && a.set(y.id, y.points.map((v) => ({ ...v })));
|
|
417
|
+
yt.current = {
|
|
469
418
|
active: !0,
|
|
470
419
|
nodeId: t.id,
|
|
471
|
-
handle:
|
|
472
|
-
startWorld:
|
|
420
|
+
handle: r,
|
|
421
|
+
startWorld: i,
|
|
473
422
|
startBounds: {
|
|
474
423
|
x: t.position.x,
|
|
475
424
|
y: t.position.y,
|
|
476
425
|
w: t.width,
|
|
477
426
|
h: t.height
|
|
478
427
|
},
|
|
479
|
-
childStarts:
|
|
480
|
-
childLineStarts:
|
|
428
|
+
childStarts: d,
|
|
429
|
+
childLineStarts: a.size > 0 ? a : void 0
|
|
481
430
|
};
|
|
482
431
|
return;
|
|
483
432
|
}
|
|
484
433
|
}
|
|
485
434
|
}
|
|
486
|
-
let
|
|
487
|
-
for (let t =
|
|
488
|
-
|
|
435
|
+
let n = null;
|
|
436
|
+
for (let t = p.length - 1; t >= 0; t--) if (Yt(i.x, i.y, p[t])) {
|
|
437
|
+
n = p[t];
|
|
489
438
|
break;
|
|
490
439
|
}
|
|
491
|
-
if (
|
|
492
|
-
const t =
|
|
493
|
-
t && (
|
|
440
|
+
if (n?.parentId) {
|
|
441
|
+
const t = p.find((r) => r.id === n.parentId);
|
|
442
|
+
t && (n = t);
|
|
494
443
|
}
|
|
495
|
-
if (
|
|
496
|
-
const t =
|
|
497
|
-
|
|
498
|
-
|
|
444
|
+
if ((o === "select" || o === "connect") && (n || ue)) {
|
|
445
|
+
const t = n ? [n] : p, r = $(T, 14, 20);
|
|
446
|
+
let d = null, a = null, e = 1 / 0;
|
|
447
|
+
for (const s of t) {
|
|
448
|
+
const w = At(It(s.width, s.height), s, i.x, i.y, r);
|
|
449
|
+
if (!w) continue;
|
|
450
|
+
const m = Wt(w, s), R = Math.hypot(i.x - m.x, i.y - m.y);
|
|
451
|
+
R < e && (e = R, d = s, a = w);
|
|
452
|
+
}
|
|
453
|
+
if (d && a) {
|
|
454
|
+
tt.current = {
|
|
499
455
|
active: !0,
|
|
500
|
-
sourceNodeId:
|
|
501
|
-
sourceHandleId:
|
|
456
|
+
sourceNodeId: d.id,
|
|
457
|
+
sourceHandleId: a.id
|
|
502
458
|
};
|
|
503
459
|
return;
|
|
504
460
|
}
|
|
505
461
|
}
|
|
506
|
-
if ((
|
|
462
|
+
if ((o === "select" || o === "connect") && !b && z.edgeIds.size > 0) {
|
|
507
463
|
const t = /* @__PURE__ */ new Map();
|
|
508
|
-
for (const
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
const
|
|
514
|
-
|
|
464
|
+
for (const a of p) t.set(a.id, a);
|
|
465
|
+
const r = N.filter((a) => z.edgeIds.has(a.id)), d = en(i.x, i.y, r, t, $(T, 14, 20));
|
|
466
|
+
if (d) {
|
|
467
|
+
const a = N.find((e) => e.id === d.edgeId);
|
|
468
|
+
if (a) {
|
|
469
|
+
const e = d.end === "source" ? "target" : "source";
|
|
470
|
+
ct.current = {
|
|
515
471
|
active: !0,
|
|
516
|
-
edgeId:
|
|
517
|
-
movingEnd:
|
|
518
|
-
fixedNodeId:
|
|
519
|
-
fixedHandleId:
|
|
472
|
+
edgeId: a.id,
|
|
473
|
+
movingEnd: d.end,
|
|
474
|
+
fixedNodeId: e === "source" ? a.source : a.target,
|
|
475
|
+
fixedHandleId: e === "source" ? a.sourceHandle : a.targetHandle
|
|
520
476
|
};
|
|
521
477
|
return;
|
|
522
478
|
}
|
|
523
479
|
}
|
|
524
480
|
}
|
|
525
|
-
if (
|
|
481
|
+
if (o === "select" && z.edgeIds.size > 0 && !n) {
|
|
526
482
|
const t = /* @__PURE__ */ new Map();
|
|
527
|
-
for (const
|
|
528
|
-
const
|
|
529
|
-
if (
|
|
530
|
-
|
|
483
|
+
for (const s of p) t.set(s.id, s);
|
|
484
|
+
const r = N.filter((s) => z.edgeIds.has(s.id)), d = $(T, 10, 14), a = rn(i.x, i.y, r, t, d);
|
|
485
|
+
if (a) {
|
|
486
|
+
lt.current = {
|
|
531
487
|
active: !0,
|
|
532
|
-
edgeId:
|
|
533
|
-
type:
|
|
534
|
-
index:
|
|
488
|
+
edgeId: a.edgeId,
|
|
489
|
+
type: a.controlEnd === "c1" ? "bezierC1" : "bezierC2",
|
|
490
|
+
index: a.segmentIndex
|
|
535
491
|
};
|
|
536
492
|
return;
|
|
537
493
|
}
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
540
|
-
if (
|
|
541
|
-
J((
|
|
542
|
-
const w =
|
|
494
|
+
const e = nn(i.x, i.y, r, d);
|
|
495
|
+
if (e) {
|
|
496
|
+
if (u) {
|
|
497
|
+
J((s) => {
|
|
498
|
+
const w = s.canvases[B.current];
|
|
543
499
|
return w ? {
|
|
544
|
-
...
|
|
500
|
+
...s,
|
|
545
501
|
canvases: {
|
|
546
|
-
...
|
|
547
|
-
[
|
|
502
|
+
...s.canvases,
|
|
503
|
+
[B.current]: {
|
|
548
504
|
...w,
|
|
549
|
-
edges: w.edges.map((
|
|
550
|
-
if (
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
...
|
|
555
|
-
waypoints:
|
|
505
|
+
edges: w.edges.map((m) => {
|
|
506
|
+
if (m.id !== e.edgeId) return m;
|
|
507
|
+
const R = [...m.data.waypoints ?? []];
|
|
508
|
+
R.splice(e.waypointIndex, 1);
|
|
509
|
+
const G = {
|
|
510
|
+
...m.data,
|
|
511
|
+
waypoints: R.length > 0 ? R : void 0
|
|
556
512
|
};
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
|
|
513
|
+
if (m.type === "simplebezier" && m.data.bezierControls) {
|
|
514
|
+
const y = [...m.data.bezierControls];
|
|
515
|
+
y.splice(e.waypointIndex, 2, null), G.bezierControls = y.some((v) => v !== null) ? y : void 0;
|
|
560
516
|
}
|
|
561
517
|
return {
|
|
562
|
-
...
|
|
563
|
-
data:
|
|
518
|
+
...m,
|
|
519
|
+
data: G
|
|
564
520
|
};
|
|
565
521
|
})
|
|
566
522
|
}
|
|
567
523
|
}
|
|
568
|
-
} :
|
|
524
|
+
} : s;
|
|
569
525
|
});
|
|
570
526
|
return;
|
|
571
527
|
}
|
|
572
|
-
|
|
528
|
+
lt.current = {
|
|
573
529
|
active: !0,
|
|
574
|
-
edgeId:
|
|
530
|
+
edgeId: e.edgeId,
|
|
575
531
|
type: "waypoint",
|
|
576
|
-
index:
|
|
532
|
+
index: e.waypointIndex
|
|
577
533
|
};
|
|
578
534
|
return;
|
|
579
535
|
}
|
|
580
|
-
if (
|
|
581
|
-
for (const
|
|
582
|
-
const w =
|
|
583
|
-
x:
|
|
584
|
-
y:
|
|
536
|
+
if (u) {
|
|
537
|
+
for (const s of r) if (Ee(i.x, i.y, s, t, $(T, 8, 12))) {
|
|
538
|
+
const w = Cn(i.x, i.y, s, t), m = {
|
|
539
|
+
x: i.x,
|
|
540
|
+
y: i.y
|
|
585
541
|
};
|
|
586
|
-
J((
|
|
587
|
-
const
|
|
588
|
-
return
|
|
589
|
-
...
|
|
542
|
+
J((R) => {
|
|
543
|
+
const G = R.canvases[B.current];
|
|
544
|
+
return G ? {
|
|
545
|
+
...R,
|
|
590
546
|
canvases: {
|
|
591
|
-
...
|
|
592
|
-
[
|
|
593
|
-
...
|
|
594
|
-
edges:
|
|
595
|
-
if (
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
...
|
|
600
|
-
waypoints:
|
|
547
|
+
...R.canvases,
|
|
548
|
+
[B.current]: {
|
|
549
|
+
...G,
|
|
550
|
+
edges: G.edges.map((y) => {
|
|
551
|
+
if (y.id !== s.id) return y;
|
|
552
|
+
const v = [...y.data.waypoints ?? []];
|
|
553
|
+
v.splice(w, 0, m);
|
|
554
|
+
const U = {
|
|
555
|
+
...y.data,
|
|
556
|
+
waypoints: v
|
|
601
557
|
};
|
|
602
|
-
if (
|
|
603
|
-
const
|
|
604
|
-
for (;
|
|
605
|
-
|
|
558
|
+
if (y.type === "simplebezier" && y.data.bezierControls) {
|
|
559
|
+
const et = [...y.data.bezierControls];
|
|
560
|
+
for (; et.length < (y.data.waypoints ?? []).length + 1; ) et.push(null);
|
|
561
|
+
et.splice(w, 1, null, null), U.bezierControls = et;
|
|
606
562
|
}
|
|
607
563
|
return {
|
|
608
|
-
...
|
|
609
|
-
data:
|
|
564
|
+
...y,
|
|
565
|
+
data: U
|
|
610
566
|
};
|
|
611
567
|
})
|
|
612
568
|
}
|
|
613
569
|
}
|
|
614
|
-
} :
|
|
615
|
-
}),
|
|
570
|
+
} : R;
|
|
571
|
+
}), lt.current = {
|
|
616
572
|
active: !0,
|
|
617
|
-
edgeId:
|
|
573
|
+
edgeId: s.id,
|
|
618
574
|
type: "waypoint",
|
|
619
575
|
index: w
|
|
620
576
|
};
|
|
@@ -622,76 +578,76 @@ function Wn({ onPixiReady: F }) {
|
|
|
622
578
|
}
|
|
623
579
|
}
|
|
624
580
|
}
|
|
625
|
-
if (
|
|
626
|
-
!
|
|
627
|
-
nodeIds: /* @__PURE__ */ new Set([
|
|
581
|
+
if (n && (o === "select" || o === "connect")) {
|
|
582
|
+
!b && !z.nodeIds.has(n.id) ? ht({
|
|
583
|
+
nodeIds: /* @__PURE__ */ new Set([n.id]),
|
|
628
584
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
629
585
|
lineIds: /* @__PURE__ */ new Set()
|
|
630
|
-
}) :
|
|
631
|
-
const
|
|
632
|
-
return
|
|
633
|
-
nodeIds:
|
|
586
|
+
}) : b && ht((e) => {
|
|
587
|
+
const s = new Set(e.nodeIds);
|
|
588
|
+
return s.has(n.id) ? s.delete(n.id) : s.add(n.id), {
|
|
589
|
+
nodeIds: s,
|
|
634
590
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
635
591
|
lineIds: /* @__PURE__ */ new Set()
|
|
636
592
|
};
|
|
637
|
-
}),
|
|
593
|
+
}), Ut.current && jt.current(n.position.x, n.position.y, n.width, n.height, {
|
|
638
594
|
padding: 80,
|
|
639
595
|
preserveZoom: !0,
|
|
640
596
|
duration: 280
|
|
641
597
|
});
|
|
642
|
-
const t =
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
for (const
|
|
646
|
-
const
|
|
647
|
-
if (!
|
|
648
|
-
const w =
|
|
649
|
-
for (const
|
|
650
|
-
if (!(t.has(
|
|
651
|
-
if (
|
|
652
|
-
t.add(
|
|
598
|
+
const t = z.nodeIds.has(n.id) ? new Set(z.nodeIds) : /* @__PURE__ */ new Set([n.id]);
|
|
599
|
+
b && !z.nodeIds.has(n.id) && t.add(n.id);
|
|
600
|
+
const r = /* @__PURE__ */ new Set();
|
|
601
|
+
for (const e of [...t]) {
|
|
602
|
+
const s = p.find((v) => v.id === e);
|
|
603
|
+
if (!s || s.type !== "flowGroup" && s.type !== "geometryGroup" && !s.data.isGroup) continue;
|
|
604
|
+
const w = s.type === "geometryGroup", m = s.position.x, R = s.position.y, G = s.width, y = s.height;
|
|
605
|
+
for (const v of p)
|
|
606
|
+
if (!(t.has(v.id) || v.id === e)) {
|
|
607
|
+
if (v.parentId === e) {
|
|
608
|
+
t.add(v.id);
|
|
653
609
|
continue;
|
|
654
610
|
}
|
|
655
|
-
w &&
|
|
611
|
+
w && v.position.x >= m && v.position.y >= R && v.position.x + v.width <= m + G && v.position.y + v.height <= R + y && t.add(v.id);
|
|
656
612
|
}
|
|
657
|
-
for (const
|
|
658
|
-
if (w) for (const
|
|
659
|
-
|
|
613
|
+
for (const v of W.current.lines) v.parentId === e && r.add(v.id);
|
|
614
|
+
if (w) for (const v of W.current.lines)
|
|
615
|
+
r.has(v.id) || v.points.length > 0 && v.points.every((U) => U.x >= m && U.x <= m + G && U.y >= R && U.y <= R + y) && r.add(v.id);
|
|
660
616
|
}
|
|
661
|
-
const
|
|
662
|
-
for (const
|
|
663
|
-
const
|
|
664
|
-
if (
|
|
665
|
-
for (const
|
|
666
|
-
|
|
617
|
+
const d = /* @__PURE__ */ new Map();
|
|
618
|
+
for (const e of p) t.has(e.id) && d.set(e.id, { ...e.position });
|
|
619
|
+
const a = /* @__PURE__ */ new Map();
|
|
620
|
+
if (r.size > 0)
|
|
621
|
+
for (const e of W.current.lines) r.has(e.id) && a.set(e.id, e.points.map((s) => ({ ...s })));
|
|
622
|
+
st.current = {
|
|
667
623
|
active: !0,
|
|
668
624
|
nodeIds: t,
|
|
669
|
-
lineIds:
|
|
670
|
-
startWorld:
|
|
671
|
-
nodeStarts:
|
|
672
|
-
linePointStarts:
|
|
673
|
-
},
|
|
625
|
+
lineIds: r.size > 0 ? r : void 0,
|
|
626
|
+
startWorld: i,
|
|
627
|
+
nodeStarts: d,
|
|
628
|
+
linePointStarts: a.size > 0 ? a : void 0
|
|
629
|
+
}, Ye.current();
|
|
674
630
|
return;
|
|
675
631
|
}
|
|
676
|
-
const
|
|
677
|
-
for (const t of
|
|
678
|
-
const
|
|
679
|
-
for (const t of
|
|
680
|
-
if (
|
|
681
|
-
const
|
|
682
|
-
return
|
|
683
|
-
...
|
|
684
|
-
edgeIds:
|
|
632
|
+
const g = /* @__PURE__ */ new Map();
|
|
633
|
+
for (const t of p) g.set(t.id, t);
|
|
634
|
+
const x = $(T, 8, 12);
|
|
635
|
+
for (const t of N) if (Ee(i.x, i.y, t, g, x)) {
|
|
636
|
+
if (ht(b ? (r) => {
|
|
637
|
+
const d = new Set(r.edgeIds);
|
|
638
|
+
return d.has(t.id) ? d.delete(t.id) : d.add(t.id), {
|
|
639
|
+
...r,
|
|
640
|
+
edgeIds: d
|
|
685
641
|
};
|
|
686
642
|
} : {
|
|
687
643
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
688
644
|
edgeIds: /* @__PURE__ */ new Set([t.id]),
|
|
689
645
|
lineIds: /* @__PURE__ */ new Set()
|
|
690
|
-
}),
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
const
|
|
694
|
-
|
|
646
|
+
}), Ut.current) {
|
|
647
|
+
const r = g.get(t.source), d = g.get(t.target);
|
|
648
|
+
if (r && d) {
|
|
649
|
+
const a = Math.min(r.position.x, d.position.x), e = Math.min(r.position.y, d.position.y), s = Math.max(r.position.x + r.width, d.position.x + d.width), w = Math.max(r.position.y + r.height, d.position.y + d.height);
|
|
650
|
+
jt.current(a, e, s - a, w - e, {
|
|
695
651
|
padding: 80,
|
|
696
652
|
preserveZoom: !0,
|
|
697
653
|
duration: 280
|
|
@@ -700,465 +656,465 @@ function Wn({ onPixiReady: F }) {
|
|
|
700
656
|
}
|
|
701
657
|
return;
|
|
702
658
|
}
|
|
703
|
-
for (const t of
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
706
|
-
const
|
|
707
|
-
return
|
|
708
|
-
...
|
|
709
|
-
lineIds:
|
|
659
|
+
for (const t of k) if (on(i.x, i.y, t, x)) {
|
|
660
|
+
const r = z.lineIds.has(t.id);
|
|
661
|
+
if (b ? ht((e) => {
|
|
662
|
+
const s = new Set(e.lineIds);
|
|
663
|
+
return s.has(t.id) ? s.delete(t.id) : s.add(t.id), {
|
|
664
|
+
...e,
|
|
665
|
+
lineIds: s
|
|
710
666
|
};
|
|
711
|
-
}) :
|
|
667
|
+
}) : r || ht({
|
|
712
668
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
713
669
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
714
670
|
lineIds: /* @__PURE__ */ new Set([t.id])
|
|
715
|
-
}),
|
|
716
|
-
const
|
|
717
|
-
|
|
671
|
+
}), Ut.current && t.points.length > 0) {
|
|
672
|
+
const e = t.points.map((y) => y.x), s = t.points.map((y) => y.y), w = Math.min(...e), m = Math.min(...s), R = Math.max(...e), G = Math.max(...s);
|
|
673
|
+
jt.current(w, m, Math.max(1, R - w), Math.max(1, G - m), {
|
|
718
674
|
padding: 80,
|
|
719
675
|
preserveZoom: !0,
|
|
720
676
|
duration: 280
|
|
721
677
|
});
|
|
722
678
|
}
|
|
723
|
-
const
|
|
724
|
-
for (const
|
|
725
|
-
|
|
679
|
+
const d = r ? new Set(z.lineIds) : /* @__PURE__ */ new Set([t.id]), a = /* @__PURE__ */ new Map();
|
|
680
|
+
for (const e of k) d.has(e.id) && a.set(e.id, e.points.map((s) => ({ ...s })));
|
|
681
|
+
gt.current = {
|
|
726
682
|
active: !0,
|
|
727
|
-
lineIds:
|
|
728
|
-
startWorld:
|
|
729
|
-
pointStarts:
|
|
683
|
+
lineIds: d,
|
|
684
|
+
startWorld: i,
|
|
685
|
+
pointStarts: a
|
|
730
686
|
};
|
|
731
687
|
return;
|
|
732
688
|
}
|
|
733
|
-
|
|
689
|
+
b || ht({
|
|
734
690
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
735
691
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
736
692
|
lineIds: /* @__PURE__ */ new Set()
|
|
737
|
-
}),
|
|
693
|
+
}), o === "select" && (Q.current = {
|
|
738
694
|
active: !0,
|
|
739
695
|
startScreen: {
|
|
740
|
-
x:
|
|
741
|
-
y:
|
|
696
|
+
x: f.global.x,
|
|
697
|
+
y: f.global.y
|
|
742
698
|
}
|
|
743
699
|
});
|
|
744
|
-
}),
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
750
|
-
let
|
|
751
|
-
for (let
|
|
752
|
-
const
|
|
753
|
-
|
|
700
|
+
}), vt.on("globalpointermove", (f) => {
|
|
701
|
+
const o = it.current(f.global.x, f.global.y);
|
|
702
|
+
if (Pe.current = o, F.current?.multiTouchActive) return;
|
|
703
|
+
const i = Kt.current;
|
|
704
|
+
if (i === "freehand" || i === "line" || i === "polyline" || i === "arrow") return;
|
|
705
|
+
const p = W.current.nodes, N = W.current.edges, k = F.current?.state.zoom ?? 1, z = !st.current?.active && !tt.current?.active && !yt.current?.active && !ct.current?.active && !lt.current?.active && !gt.current?.active;
|
|
706
|
+
let b = null;
|
|
707
|
+
for (let c = p.length - 1; c >= 0; c--) if (Yt(o.x, o.y, p[c])) {
|
|
708
|
+
const h = p[c];
|
|
709
|
+
b = h.parentId ? p.find((u) => u.id === h.parentId)?.id ?? h.id : h.id;
|
|
754
710
|
break;
|
|
755
711
|
}
|
|
756
|
-
if (
|
|
757
|
-
const
|
|
758
|
-
for (const
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
let
|
|
762
|
-
if (
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
nodeId:
|
|
770
|
-
handleId:
|
|
771
|
-
wx:
|
|
772
|
-
wy:
|
|
712
|
+
if (oe.current = b, z && (i === "select" || i === "connect")) {
|
|
713
|
+
const c = /* @__PURE__ */ new Map();
|
|
714
|
+
for (const x of p) c.set(x.id, x);
|
|
715
|
+
const h = Bt.current, u = h.edgeIds.size > 0 ? N.filter((x) => h.edgeIds.has(x.id)) : [], n = u.length > 0 ? en(o.x, o.y, u, c, $(k, 12, 18)) : null;
|
|
716
|
+
ge.current = n;
|
|
717
|
+
let g = null;
|
|
718
|
+
if (b) {
|
|
719
|
+
const x = p.find((t) => t.id === b);
|
|
720
|
+
if (x) {
|
|
721
|
+
const t = At(It(x.width, x.height), x, o.x, o.y, $(k, 14, 20));
|
|
722
|
+
if (t) {
|
|
723
|
+
const r = Wt(t, x);
|
|
724
|
+
g = {
|
|
725
|
+
nodeId: x.id,
|
|
726
|
+
handleId: t.id,
|
|
727
|
+
wx: r.x,
|
|
728
|
+
wy: r.y
|
|
773
729
|
};
|
|
774
730
|
}
|
|
775
731
|
}
|
|
776
732
|
}
|
|
777
|
-
|
|
733
|
+
xe.current = g;
|
|
778
734
|
}
|
|
779
|
-
const
|
|
780
|
-
if (
|
|
781
|
-
const
|
|
782
|
-
let
|
|
783
|
-
if (
|
|
784
|
-
else if (
|
|
785
|
-
else if (
|
|
786
|
-
const
|
|
787
|
-
for (const
|
|
788
|
-
const
|
|
789
|
-
(
|
|
735
|
+
const T = S.current;
|
|
736
|
+
if (T && z) {
|
|
737
|
+
const c = Bt.current;
|
|
738
|
+
let h = "";
|
|
739
|
+
if (ge.current) h = "crosshair";
|
|
740
|
+
else if (xe.current) h = "crosshair";
|
|
741
|
+
else if (c.edgeIds.size > 0 && i === "select") {
|
|
742
|
+
const u = N.filter((x) => c.edgeIds.has(x.id)), n = /* @__PURE__ */ new Map();
|
|
743
|
+
for (const x of p) n.set(x.id, x);
|
|
744
|
+
const g = $(k, 10, 14);
|
|
745
|
+
(nn(o.x, o.y, u, g) || rn(o.x, o.y, u, n, g)) && (h = "grab");
|
|
790
746
|
}
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
794
|
-
const
|
|
795
|
-
|
|
747
|
+
if (!h && c.nodeIds.size === 1 && i === "select") {
|
|
748
|
+
const u = p.find((n) => n.id === [...c.nodeIds][0]);
|
|
749
|
+
if (u) {
|
|
750
|
+
const n = tn(o, u, $(k, 10, 16));
|
|
751
|
+
n && (h = zn[n]);
|
|
796
752
|
}
|
|
797
753
|
}
|
|
798
|
-
if (!
|
|
799
|
-
const
|
|
800
|
-
for (const
|
|
801
|
-
|
|
754
|
+
if (!h && i === "select") {
|
|
755
|
+
const u = W.current.lines, n = $(k, 8, 12);
|
|
756
|
+
for (const g of u) if (on(o.x, o.y, g, n)) {
|
|
757
|
+
h = "move";
|
|
802
758
|
break;
|
|
803
759
|
}
|
|
804
760
|
}
|
|
805
|
-
|
|
761
|
+
T.style.cursor = h;
|
|
806
762
|
}
|
|
807
|
-
if (
|
|
808
|
-
const
|
|
809
|
-
id:
|
|
763
|
+
if (yt.current?.active) {
|
|
764
|
+
const c = yt.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y, n = En(c.startBounds, c.handle, h, u), g = W.current.nodes, x = le([{
|
|
765
|
+
id: c.nodeId,
|
|
810
766
|
type: "shapeRect",
|
|
811
767
|
position: {
|
|
812
|
-
x:
|
|
813
|
-
y:
|
|
768
|
+
x: n.x,
|
|
769
|
+
y: n.y
|
|
814
770
|
},
|
|
815
|
-
width:
|
|
816
|
-
height:
|
|
771
|
+
width: n.w,
|
|
772
|
+
height: n.h,
|
|
817
773
|
data: {}
|
|
818
|
-
}],
|
|
819
|
-
|
|
820
|
-
const
|
|
821
|
-
J((
|
|
822
|
-
const
|
|
823
|
-
return
|
|
824
|
-
...
|
|
774
|
+
}], g);
|
|
775
|
+
n.x += x.dx, n.y += x.dy, (c.handle === "ne" || c.handle === "se") && (n.w += x.dx), (c.handle === "se" || c.handle === "sw") && (n.h += x.dy), Dt.current = x.guides;
|
|
776
|
+
const t = c.startBounds, r = Math.max(n.w, 24), d = Math.max(n.h, 24), a = t.w > 0 ? r / t.w : 1, e = t.h > 0 ? d / t.h : 1;
|
|
777
|
+
J((s) => {
|
|
778
|
+
const w = s.canvases[B.current];
|
|
779
|
+
return w ? {
|
|
780
|
+
...s,
|
|
825
781
|
canvases: {
|
|
826
|
-
...
|
|
827
|
-
[
|
|
828
|
-
...
|
|
829
|
-
nodes:
|
|
830
|
-
if (
|
|
831
|
-
...
|
|
782
|
+
...s.canvases,
|
|
783
|
+
[B.current]: {
|
|
784
|
+
...w,
|
|
785
|
+
nodes: w.nodes.map((m) => {
|
|
786
|
+
if (m.id === c.nodeId) return {
|
|
787
|
+
...m,
|
|
832
788
|
position: {
|
|
833
|
-
x:
|
|
834
|
-
y:
|
|
789
|
+
x: n.x,
|
|
790
|
+
y: n.y
|
|
835
791
|
},
|
|
836
|
-
width:
|
|
837
|
-
height:
|
|
792
|
+
width: r,
|
|
793
|
+
height: d
|
|
838
794
|
};
|
|
839
|
-
const
|
|
840
|
-
return
|
|
841
|
-
...
|
|
795
|
+
const R = c.childStarts.get(m.id);
|
|
796
|
+
return R ? {
|
|
797
|
+
...m,
|
|
842
798
|
position: {
|
|
843
|
-
x:
|
|
844
|
-
y:
|
|
799
|
+
x: n.x + (R.x - t.x) * a,
|
|
800
|
+
y: n.y + (R.y - t.y) * e
|
|
845
801
|
},
|
|
846
|
-
width: Math.max(
|
|
847
|
-
height: Math.max(
|
|
848
|
-
} :
|
|
802
|
+
width: Math.max(R.w * a, 24),
|
|
803
|
+
height: Math.max(R.h * e, 24)
|
|
804
|
+
} : m;
|
|
849
805
|
}),
|
|
850
|
-
lines:
|
|
851
|
-
const
|
|
852
|
-
return
|
|
853
|
-
...
|
|
854
|
-
points:
|
|
855
|
-
x:
|
|
856
|
-
y:
|
|
806
|
+
lines: c.childLineStarts ? w.lines.map((m) => {
|
|
807
|
+
const R = c.childLineStarts.get(m.id);
|
|
808
|
+
return R ? {
|
|
809
|
+
...m,
|
|
810
|
+
points: R.map((G) => ({
|
|
811
|
+
x: n.x + (G.x - t.x) * a,
|
|
812
|
+
y: n.y + (G.y - t.y) * e
|
|
857
813
|
}))
|
|
858
|
-
} :
|
|
859
|
-
}) :
|
|
814
|
+
} : m;
|
|
815
|
+
}) : w.lines
|
|
860
816
|
}
|
|
861
817
|
}
|
|
862
|
-
} :
|
|
818
|
+
} : s;
|
|
863
819
|
});
|
|
864
820
|
return;
|
|
865
821
|
}
|
|
866
|
-
if (
|
|
867
|
-
const
|
|
868
|
-
for (const
|
|
869
|
-
J((
|
|
870
|
-
const
|
|
871
|
-
return
|
|
872
|
-
...
|
|
822
|
+
if (lt.current?.active) {
|
|
823
|
+
const c = lt.current, h = W.current.nodes, u = /* @__PURE__ */ new Map();
|
|
824
|
+
for (const n of h) u.set(n.id, n);
|
|
825
|
+
J((n) => {
|
|
826
|
+
const g = n.canvases[B.current];
|
|
827
|
+
return g ? {
|
|
828
|
+
...n,
|
|
873
829
|
canvases: {
|
|
874
|
-
...
|
|
875
|
-
[
|
|
876
|
-
...
|
|
877
|
-
edges:
|
|
878
|
-
if (
|
|
879
|
-
if (
|
|
880
|
-
const
|
|
881
|
-
return
|
|
882
|
-
x:
|
|
883
|
-
y:
|
|
830
|
+
...n.canvases,
|
|
831
|
+
[B.current]: {
|
|
832
|
+
...g,
|
|
833
|
+
edges: g.edges.map((x) => {
|
|
834
|
+
if (x.id !== c.edgeId) return x;
|
|
835
|
+
if (c.type === "waypoint") {
|
|
836
|
+
const Gt = [...x.data.waypoints ?? []];
|
|
837
|
+
return c.index < Gt.length && (Gt[c.index] = {
|
|
838
|
+
x: o.x,
|
|
839
|
+
y: o.y
|
|
884
840
|
}), {
|
|
885
|
-
...
|
|
841
|
+
...x,
|
|
886
842
|
data: {
|
|
887
|
-
...
|
|
888
|
-
waypoints:
|
|
843
|
+
...x.data,
|
|
844
|
+
waypoints: Gt
|
|
889
845
|
}
|
|
890
846
|
};
|
|
891
847
|
}
|
|
892
|
-
const
|
|
893
|
-
if (!
|
|
894
|
-
const
|
|
848
|
+
const t = Mt(x, u);
|
|
849
|
+
if (!t) return x;
|
|
850
|
+
const r = x.data.waypoints ?? [], d = [
|
|
895
851
|
{
|
|
896
|
-
x:
|
|
897
|
-
y:
|
|
852
|
+
x: t.sx,
|
|
853
|
+
y: t.sy
|
|
898
854
|
},
|
|
899
|
-
...
|
|
855
|
+
...r,
|
|
900
856
|
{
|
|
901
|
-
x:
|
|
902
|
-
y:
|
|
857
|
+
x: t.tx,
|
|
858
|
+
y: t.ty
|
|
903
859
|
}
|
|
904
|
-
],
|
|
905
|
-
for (;
|
|
906
|
-
const
|
|
907
|
-
if (
|
|
908
|
-
const
|
|
909
|
-
return
|
|
910
|
-
c1x:
|
|
911
|
-
c1y:
|
|
912
|
-
c2x:
|
|
913
|
-
c2y:
|
|
914
|
-
} :
|
|
915
|
-
c1x:
|
|
916
|
-
c1y:
|
|
917
|
-
c2x:
|
|
918
|
-
c2y:
|
|
860
|
+
], a = d.length - 1, e = [...x.data.bezierControls ?? []];
|
|
861
|
+
for (; e.length < a; ) e.push(null);
|
|
862
|
+
const s = c.index;
|
|
863
|
+
if (s >= a) return x;
|
|
864
|
+
const w = d[s], m = d[s + 1], R = e[s], G = Math.hypot(m.x - w.x, m.y - w.y), y = Math.max(30, G * 0.3), v = a - 1, U = s === 0 ? w.x + t.snx * y : w.x + (m.x - w.x) * 0.4, et = s === 0 ? w.y + t.sny * y : w.y, Lt = s === v ? m.x + t.tnx * y : m.x - (m.x - w.x) * 0.4, ae = s === v ? m.y + t.tny * y : m.y;
|
|
865
|
+
return c.type === "bezierC1" ? e[s] = {
|
|
866
|
+
c1x: o.x,
|
|
867
|
+
c1y: o.y,
|
|
868
|
+
c2x: R?.c2x ?? Lt,
|
|
869
|
+
c2y: R?.c2y ?? ae
|
|
870
|
+
} : e[s] = {
|
|
871
|
+
c1x: R?.c1x ?? U,
|
|
872
|
+
c1y: R?.c1y ?? et,
|
|
873
|
+
c2x: o.x,
|
|
874
|
+
c2y: o.y
|
|
919
875
|
}, {
|
|
920
|
-
...
|
|
876
|
+
...x,
|
|
921
877
|
data: {
|
|
922
|
-
...
|
|
923
|
-
bezierControls:
|
|
878
|
+
...x.data,
|
|
879
|
+
bezierControls: e
|
|
924
880
|
}
|
|
925
881
|
};
|
|
926
882
|
})
|
|
927
883
|
}
|
|
928
884
|
}
|
|
929
|
-
} :
|
|
885
|
+
} : n;
|
|
930
886
|
});
|
|
931
887
|
return;
|
|
932
888
|
}
|
|
933
|
-
if (
|
|
934
|
-
const
|
|
935
|
-
J((
|
|
936
|
-
const
|
|
937
|
-
return
|
|
938
|
-
...
|
|
889
|
+
if (gt.current?.active) {
|
|
890
|
+
const c = gt.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y;
|
|
891
|
+
J((n) => {
|
|
892
|
+
const g = n.canvases[B.current];
|
|
893
|
+
return g ? {
|
|
894
|
+
...n,
|
|
939
895
|
canvases: {
|
|
940
|
-
...
|
|
941
|
-
[
|
|
942
|
-
...
|
|
943
|
-
lines:
|
|
944
|
-
const
|
|
945
|
-
return
|
|
946
|
-
...
|
|
947
|
-
points:
|
|
948
|
-
x:
|
|
949
|
-
y:
|
|
896
|
+
...n.canvases,
|
|
897
|
+
[B.current]: {
|
|
898
|
+
...g,
|
|
899
|
+
lines: g.lines.map((x) => {
|
|
900
|
+
const t = c.pointStarts.get(x.id);
|
|
901
|
+
return t ? {
|
|
902
|
+
...x,
|
|
903
|
+
points: t.map((r) => ({
|
|
904
|
+
x: r.x + h,
|
|
905
|
+
y: r.y + u
|
|
950
906
|
}))
|
|
951
|
-
} :
|
|
907
|
+
} : x;
|
|
952
908
|
})
|
|
953
909
|
}
|
|
954
910
|
}
|
|
955
|
-
} :
|
|
911
|
+
} : n;
|
|
956
912
|
});
|
|
957
913
|
return;
|
|
958
914
|
}
|
|
959
|
-
if (
|
|
960
|
-
const
|
|
961
|
-
const
|
|
915
|
+
if (st.current?.active) {
|
|
916
|
+
const c = st.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y, n = W.current.nodes, g = le(n.filter((r) => c.nodeIds.has(r.id)).map((r) => {
|
|
917
|
+
const d = c.nodeStarts.get(r.id);
|
|
962
918
|
return {
|
|
963
|
-
...
|
|
919
|
+
...r,
|
|
964
920
|
position: {
|
|
965
|
-
x:
|
|
966
|
-
y:
|
|
921
|
+
x: d.x + h,
|
|
922
|
+
y: d.y + u
|
|
967
923
|
}
|
|
968
924
|
};
|
|
969
|
-
}),
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
return
|
|
973
|
-
...
|
|
925
|
+
}), n), x = h + g.dx, t = u + g.dy;
|
|
926
|
+
Dt.current = g.guides, J((r) => {
|
|
927
|
+
const d = r.canvases[B.current];
|
|
928
|
+
return d ? {
|
|
929
|
+
...r,
|
|
974
930
|
canvases: {
|
|
975
|
-
...
|
|
976
|
-
[
|
|
977
|
-
...
|
|
978
|
-
nodes:
|
|
979
|
-
const
|
|
980
|
-
return
|
|
981
|
-
...
|
|
931
|
+
...r.canvases,
|
|
932
|
+
[B.current]: {
|
|
933
|
+
...d,
|
|
934
|
+
nodes: d.nodes.map((a) => {
|
|
935
|
+
const e = c.nodeStarts.get(a.id);
|
|
936
|
+
return e ? {
|
|
937
|
+
...a,
|
|
982
938
|
position: {
|
|
983
|
-
x:
|
|
984
|
-
y:
|
|
939
|
+
x: e.x + x,
|
|
940
|
+
y: e.y + t
|
|
985
941
|
}
|
|
986
|
-
} :
|
|
942
|
+
} : a;
|
|
987
943
|
}),
|
|
988
|
-
lines:
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
-
...
|
|
992
|
-
points:
|
|
993
|
-
x:
|
|
994
|
-
y:
|
|
944
|
+
lines: c.linePointStarts ? d.lines.map((a) => {
|
|
945
|
+
const e = c.linePointStarts.get(a.id);
|
|
946
|
+
return e ? {
|
|
947
|
+
...a,
|
|
948
|
+
points: e.map((s) => ({
|
|
949
|
+
x: s.x + x,
|
|
950
|
+
y: s.y + t
|
|
995
951
|
}))
|
|
996
|
-
} :
|
|
997
|
-
}) :
|
|
952
|
+
} : a;
|
|
953
|
+
}) : d.lines
|
|
998
954
|
}
|
|
999
955
|
}
|
|
1000
|
-
} :
|
|
956
|
+
} : r;
|
|
1001
957
|
});
|
|
1002
958
|
return;
|
|
1003
959
|
}
|
|
1004
|
-
if (
|
|
1005
|
-
const
|
|
1006
|
-
|
|
960
|
+
if (Q.current?.active && Ct.current) {
|
|
961
|
+
const c = Math.min(Q.current.startScreen.x, f.global.x), h = Math.min(Q.current.startScreen.y, f.global.y), u = Math.abs(f.global.x - Q.current.startScreen.x), n = Math.abs(f.global.y - Q.current.startScreen.y);
|
|
962
|
+
Ct.current.showMarquee(c, h, u, n);
|
|
1007
963
|
}
|
|
1008
|
-
if (
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
const
|
|
1014
|
-
let
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1017
|
-
const
|
|
1018
|
-
if (
|
|
1019
|
-
const
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
-
|
|
964
|
+
if (tt.current?.active && xt.current) {
|
|
965
|
+
const c = W.current.nodes.find((h) => h.id === tt.current.sourceNodeId);
|
|
966
|
+
if (c) {
|
|
967
|
+
const h = It(c.width, c.height).find((u) => u.id === tt.current.sourceHandleId);
|
|
968
|
+
if (h) {
|
|
969
|
+
const u = Wt(h, c), n = u.x, g = u.y;
|
|
970
|
+
let x = o.x, t = o.y;
|
|
971
|
+
const r = oe.current;
|
|
972
|
+
if (r && r !== tt.current.sourceNodeId) {
|
|
973
|
+
const a = W.current.nodes.find((e) => e.id === r);
|
|
974
|
+
if (a) {
|
|
975
|
+
const e = At(It(a.width, a.height), a, o.x, o.y, 1 / 0);
|
|
976
|
+
if (e) {
|
|
977
|
+
const s = Wt(e, a);
|
|
978
|
+
x = s.x, t = s.y;
|
|
1023
979
|
}
|
|
1024
980
|
}
|
|
1025
981
|
}
|
|
1026
|
-
const
|
|
1027
|
-
|
|
982
|
+
const d = xt.current;
|
|
983
|
+
d.clear(), d.moveTo(n, g).lineTo(x, t).stroke({
|
|
1028
984
|
color: 3900150,
|
|
1029
985
|
width: 2,
|
|
1030
986
|
alpha: 0.6
|
|
1031
|
-
}),
|
|
987
|
+
}), d.visible = !0;
|
|
1032
988
|
}
|
|
1033
989
|
}
|
|
1034
990
|
}
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
const
|
|
1039
|
-
x:
|
|
1040
|
-
y:
|
|
1041
|
-
},
|
|
1042
|
-
let
|
|
1043
|
-
const
|
|
1044
|
-
if (
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1048
|
-
if (
|
|
1049
|
-
const
|
|
1050
|
-
|
|
991
|
+
if (ct.current?.active && xt.current && !xt.current.destroyed) {
|
|
992
|
+
const c = ct.current, h = W.current.nodes.find((u) => u.id === c.fixedNodeId);
|
|
993
|
+
if (h) {
|
|
994
|
+
const u = It(h.width, h.height).find((e) => e.id === c.fixedHandleId), n = u ? Wt(u, h) : {
|
|
995
|
+
x: h.position.x + h.width / 2,
|
|
996
|
+
y: h.position.y + h.height / 2
|
|
997
|
+
}, g = n.x, x = n.y;
|
|
998
|
+
let t = o.x, r = o.y;
|
|
999
|
+
const d = oe.current;
|
|
1000
|
+
if (d && d !== c.fixedNodeId) {
|
|
1001
|
+
const e = W.current.nodes.find((s) => s.id === d);
|
|
1002
|
+
if (e) {
|
|
1003
|
+
const s = At(It(e.width, e.height), e, o.x, o.y, 1 / 0);
|
|
1004
|
+
if (s) {
|
|
1005
|
+
const w = Wt(s, e);
|
|
1006
|
+
t = w.x, r = w.y;
|
|
1051
1007
|
}
|
|
1052
1008
|
}
|
|
1053
1009
|
}
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1010
|
+
const a = xt.current;
|
|
1011
|
+
a.clear(), a.moveTo(g, x).lineTo(t, r).stroke({
|
|
1056
1012
|
color: 16347926,
|
|
1057
1013
|
width: 2,
|
|
1058
1014
|
alpha: 0.7
|
|
1059
|
-
}),
|
|
1015
|
+
}), a.visible = !0;
|
|
1060
1016
|
}
|
|
1061
1017
|
}
|
|
1062
1018
|
});
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1019
|
+
const Et = () => {
|
|
1020
|
+
Dt.current = [];
|
|
1065
1021
|
try {
|
|
1066
|
-
|
|
1022
|
+
se.current?.clear();
|
|
1067
1023
|
} catch {
|
|
1068
1024
|
}
|
|
1069
1025
|
try {
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1026
|
+
const f = xt.current;
|
|
1027
|
+
f && !f.destroyed && (f.clear(), f.visible = !1);
|
|
1072
1028
|
} catch {
|
|
1073
1029
|
}
|
|
1074
|
-
|
|
1030
|
+
S.current && (S.current.style.cursor = "");
|
|
1075
1031
|
};
|
|
1076
|
-
|
|
1077
|
-
if (
|
|
1078
|
-
|
|
1032
|
+
vt.on("pointerup", (f) => {
|
|
1033
|
+
if (Et(), lt.current?.active) {
|
|
1034
|
+
lt.current = null;
|
|
1079
1035
|
return;
|
|
1080
1036
|
}
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1037
|
+
if (yt.current?.active) {
|
|
1038
|
+
yt.current = null;
|
|
1083
1039
|
return;
|
|
1084
1040
|
}
|
|
1085
|
-
if (
|
|
1086
|
-
|
|
1041
|
+
if (gt.current?.active) {
|
|
1042
|
+
gt.current = null;
|
|
1087
1043
|
return;
|
|
1088
1044
|
}
|
|
1089
|
-
if (
|
|
1090
|
-
const
|
|
1091
|
-
if (
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
nodeIds: new Set(
|
|
1045
|
+
if (st.current?.active && (st.current = null, ie.current()), Q.current?.active) {
|
|
1046
|
+
const o = it.current(Q.current.startScreen.x, Q.current.startScreen.y), i = it.current(f.global.x, f.global.y), p = Math.min(o.x, i.x), N = Math.min(o.y, i.y), k = Math.abs(i.x - o.x), z = Math.abs(i.y - o.y);
|
|
1047
|
+
if (k > 4 && z > 4) {
|
|
1048
|
+
const b = W.current.nodes.filter((c) => gn(p, N, k, z, c.position.x, c.position.y, c.width, c.height)), T = W.current.lines.filter((c) => c.points.length === 0 ? !1 : c.points.every((h) => h.x >= p && h.x <= p + k && h.y >= N && h.y <= N + z));
|
|
1049
|
+
ht({
|
|
1050
|
+
nodeIds: new Set(b.map((c) => c.id)),
|
|
1095
1051
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
1096
|
-
lineIds: new Set(
|
|
1052
|
+
lineIds: new Set(T.map((c) => c.id))
|
|
1097
1053
|
});
|
|
1098
1054
|
}
|
|
1099
|
-
|
|
1055
|
+
Q.current = null, Ct.current?.hideMarquee();
|
|
1100
1056
|
}
|
|
1101
|
-
if (
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
const
|
|
1105
|
-
let
|
|
1106
|
-
for (let
|
|
1107
|
-
|
|
1057
|
+
if (ct.current?.active) {
|
|
1058
|
+
const o = ct.current.edgeId, i = ct.current.movingEnd, p = ct.current.fixedNodeId;
|
|
1059
|
+
ct.current = null;
|
|
1060
|
+
const N = it.current(f.global.x, f.global.y), k = W.current.nodes, z = ue ? $(F.current?.state.zoom ?? 1, 12, 24) : 0;
|
|
1061
|
+
let b = null;
|
|
1062
|
+
for (let T = k.length - 1; T >= 0; T--) if (Yt(N.x, N.y, k[T], z) && k[T].id !== p) {
|
|
1063
|
+
b = k[T];
|
|
1108
1064
|
break;
|
|
1109
1065
|
}
|
|
1110
|
-
if (
|
|
1111
|
-
const
|
|
1112
|
-
J((
|
|
1113
|
-
const
|
|
1114
|
-
return
|
|
1115
|
-
...
|
|
1066
|
+
if (b) {
|
|
1067
|
+
const T = b.id, c = At(It(b.width, b.height), b, N.x, N.y, 1 / 0)?.id;
|
|
1068
|
+
J((h) => {
|
|
1069
|
+
const u = h.canvases[B.current];
|
|
1070
|
+
return u ? {
|
|
1071
|
+
...h,
|
|
1116
1072
|
canvases: {
|
|
1117
|
-
...
|
|
1118
|
-
[
|
|
1119
|
-
...
|
|
1120
|
-
edges:
|
|
1121
|
-
...
|
|
1122
|
-
source:
|
|
1123
|
-
sourceHandle:
|
|
1073
|
+
...h.canvases,
|
|
1074
|
+
[B.current]: {
|
|
1075
|
+
...u,
|
|
1076
|
+
edges: u.edges.map((n) => n.id !== o ? n : i === "source" ? {
|
|
1077
|
+
...n,
|
|
1078
|
+
source: T,
|
|
1079
|
+
sourceHandle: c
|
|
1124
1080
|
} : {
|
|
1125
|
-
...
|
|
1126
|
-
target:
|
|
1127
|
-
targetHandle:
|
|
1081
|
+
...n,
|
|
1082
|
+
target: T,
|
|
1083
|
+
targetHandle: c
|
|
1128
1084
|
})
|
|
1129
1085
|
}
|
|
1130
1086
|
}
|
|
1131
|
-
} :
|
|
1087
|
+
} : h;
|
|
1132
1088
|
});
|
|
1133
1089
|
}
|
|
1134
1090
|
return;
|
|
1135
1091
|
}
|
|
1136
|
-
if (
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
const
|
|
1140
|
-
let
|
|
1141
|
-
for (let
|
|
1142
|
-
|
|
1092
|
+
if (tt.current?.active) {
|
|
1093
|
+
const o = tt.current.sourceNodeId, i = tt.current.sourceHandleId;
|
|
1094
|
+
tt.current = null;
|
|
1095
|
+
const p = it.current(f.global.x, f.global.y), N = W.current.nodes, k = ue ? $(F.current?.state.zoom ?? 1, 12, 24) : 0;
|
|
1096
|
+
let z = null;
|
|
1097
|
+
for (let b = N.length - 1; b >= 0; b--) if (Yt(p.x, p.y, N[b], k) && N[b].id !== o) {
|
|
1098
|
+
z = N[b];
|
|
1143
1099
|
break;
|
|
1144
1100
|
}
|
|
1145
|
-
if (
|
|
1146
|
-
const
|
|
1147
|
-
J((
|
|
1148
|
-
const
|
|
1149
|
-
return !
|
|
1150
|
-
...
|
|
1101
|
+
if (z) {
|
|
1102
|
+
const b = z.id, T = At(It(z.width, z.height), z, p.x, p.y, 1 / 0)?.id, c = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, h = Ae.current;
|
|
1103
|
+
J((u) => {
|
|
1104
|
+
const n = u.canvases[B.current];
|
|
1105
|
+
return !n || n.edges.some((g) => g.source === o && g.target === b && g.sourceHandle === i && g.targetHandle === T) ? u : {
|
|
1106
|
+
...u,
|
|
1151
1107
|
canvases: {
|
|
1152
|
-
...
|
|
1153
|
-
[
|
|
1154
|
-
...
|
|
1155
|
-
edges: [...
|
|
1156
|
-
id:
|
|
1157
|
-
source:
|
|
1158
|
-
target:
|
|
1159
|
-
sourceHandle:
|
|
1160
|
-
targetHandle:
|
|
1161
|
-
type:
|
|
1108
|
+
...u.canvases,
|
|
1109
|
+
[B.current]: {
|
|
1110
|
+
...n,
|
|
1111
|
+
edges: [...n.edges, {
|
|
1112
|
+
id: c,
|
|
1113
|
+
source: o,
|
|
1114
|
+
target: b,
|
|
1115
|
+
sourceHandle: i,
|
|
1116
|
+
targetHandle: T,
|
|
1117
|
+
type: h,
|
|
1162
1118
|
data: {
|
|
1163
1119
|
strokeColor: "theme:base-content",
|
|
1164
1120
|
strokeWidth: 2,
|
|
@@ -1172,49 +1128,145 @@ function Wn({ onPixiReady: F }) {
|
|
|
1172
1128
|
});
|
|
1173
1129
|
}
|
|
1174
1130
|
}
|
|
1175
|
-
}),
|
|
1176
|
-
|
|
1177
|
-
})
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1131
|
+
}), vt.on("pointerupoutside", () => {
|
|
1132
|
+
Et(), st.current?.active && ie.current(), st.current = null, yt.current = null, Q.current = null, ct.current = null, tt.current = null, lt.current = null, gt.current = null, Ct.current?.hideMarquee();
|
|
1133
|
+
});
|
|
1134
|
+
const Nt = S.current;
|
|
1135
|
+
let ft = null;
|
|
1136
|
+
const $t = (f) => {
|
|
1137
|
+
const o = Nt.getBoundingClientRect(), i = f[0].clientX, p = f[0].clientY, N = f[1].clientX, k = f[1].clientY;
|
|
1138
|
+
return {
|
|
1139
|
+
dist: Math.hypot(N - i, k - p),
|
|
1140
|
+
midX: (i + N) / 2 - o.left,
|
|
1141
|
+
midY: (p + k) / 2 - o.top
|
|
1142
|
+
};
|
|
1143
|
+
}, Se = () => {
|
|
1144
|
+
Et(), st.current?.active && ie.current(), st.current = null, yt.current = null, Q.current = null, ct.current = null, tt.current = null, lt.current = null, gt.current = null, Ct.current?.hideMarquee(), F.current?.cancelPan();
|
|
1145
|
+
}, qe = (f) => {
|
|
1146
|
+
if (f.touches.length < 2) return;
|
|
1147
|
+
const o = F.current;
|
|
1148
|
+
o && (o.multiTouchActive = !0, Se(), ft = $t(f.touches), f.preventDefault());
|
|
1149
|
+
}, Ze = (f) => {
|
|
1150
|
+
if (!ft || f.touches.length < 2) return;
|
|
1151
|
+
f.preventDefault();
|
|
1152
|
+
const o = F.current;
|
|
1153
|
+
if (!o) return;
|
|
1154
|
+
const i = $t(f.touches), p = i.dist / Math.max(1, ft.dist);
|
|
1155
|
+
Number.isFinite(p) && p > 0 && o.zoomAt(i.midX, i.midY, p), o.setState({
|
|
1156
|
+
x: o.state.x + (i.midX - ft.midX),
|
|
1157
|
+
y: o.state.y + (i.midY - ft.midY)
|
|
1158
|
+
}), ft = i;
|
|
1159
|
+
}, ze = (f) => {
|
|
1160
|
+
if (f.touches.length >= 2) {
|
|
1161
|
+
ft = $t(f.touches);
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
if (ft = null, f.touches.length === 0) {
|
|
1165
|
+
const o = F.current;
|
|
1166
|
+
o && (o.multiTouchActive = !1), He.current = performance.now() + 350;
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
Nt?.addEventListener("touchstart", qe, { passive: !1 }), Nt?.addEventListener("touchmove", Ze, { passive: !1 }), Nt?.addEventListener("touchend", ze), Nt?.addEventListener("touchcancel", ze), X = qe, A = Ze, Z = ze, vt.on("rightclick", (f) => {
|
|
1170
|
+
if (f.preventDefault?.(), F.current?.didRightPan) return;
|
|
1171
|
+
const o = it.current(f.global.x, f.global.y), i = W.current.nodes;
|
|
1172
|
+
let p = null;
|
|
1173
|
+
for (let b = i.length - 1; b >= 0; b--) if (Yt(o.x, o.y, i[b])) {
|
|
1174
|
+
p = i[b].id;
|
|
1183
1175
|
break;
|
|
1184
1176
|
}
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
x:
|
|
1188
|
-
y:
|
|
1189
|
-
nodeId:
|
|
1177
|
+
const N = f.nativeEvent, k = N?.clientX ?? f.global.x, z = N?.clientY ?? f.global.y;
|
|
1178
|
+
te({
|
|
1179
|
+
x: k,
|
|
1180
|
+
y: z,
|
|
1181
|
+
nodeId: p
|
|
1190
1182
|
});
|
|
1191
|
-
}),
|
|
1192
|
-
if (
|
|
1193
|
-
const
|
|
1194
|
-
if (
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1183
|
+
}), vt.on("pointertap", (f) => {
|
|
1184
|
+
if (F.current?.multiTouchActive || performance.now() < He.current || f.button !== 0) return;
|
|
1185
|
+
const o = Date.now(), i = it.current(f.global.x, f.global.y), p = ce.current;
|
|
1186
|
+
if (p) {
|
|
1187
|
+
const b = xn("node"), T = i.x - p.width / 2, c = i.y - p.height / 2, h = le([{
|
|
1188
|
+
id: "__ghost__",
|
|
1189
|
+
type: p.type,
|
|
1190
|
+
position: {
|
|
1191
|
+
x: T,
|
|
1192
|
+
y: c
|
|
1193
|
+
},
|
|
1194
|
+
width: p.width,
|
|
1195
|
+
height: p.height,
|
|
1196
|
+
data: {}
|
|
1197
|
+
}], W.current.nodes), u = T + h.dx, n = c + h.dy;
|
|
1198
|
+
J((g) => {
|
|
1199
|
+
const x = g.canvases[B.current];
|
|
1200
|
+
if (!x) return g;
|
|
1201
|
+
const t = {};
|
|
1202
|
+
p.type === "animAnchor" && (t.animIndex = Sn(g));
|
|
1203
|
+
const r = Math.max(0, ...x.nodes.map((d) => d.zIndex ?? 0), ...x.lines.map((d) => d.zIndex ?? 0));
|
|
1204
|
+
return {
|
|
1205
|
+
...g,
|
|
1206
|
+
canvases: {
|
|
1207
|
+
...g.canvases,
|
|
1208
|
+
[B.current]: {
|
|
1209
|
+
...x,
|
|
1210
|
+
nodes: [...x.nodes, {
|
|
1211
|
+
id: b,
|
|
1212
|
+
type: p.type,
|
|
1213
|
+
position: {
|
|
1214
|
+
x: u,
|
|
1215
|
+
y: n
|
|
1216
|
+
},
|
|
1217
|
+
width: p.width,
|
|
1218
|
+
height: p.height,
|
|
1219
|
+
zIndex: r + 1,
|
|
1220
|
+
data: {
|
|
1221
|
+
...p.data,
|
|
1222
|
+
...t
|
|
1223
|
+
}
|
|
1224
|
+
}]
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
}), ht({
|
|
1229
|
+
nodeIds: /* @__PURE__ */ new Set([b]),
|
|
1230
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
1231
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
1232
|
+
}), Ut.current && window.setTimeout(() => {
|
|
1233
|
+
jt.current(u, n, p.width, p.height, {
|
|
1234
|
+
padding: 80,
|
|
1235
|
+
preserveZoom: !0,
|
|
1236
|
+
duration: 280
|
|
1237
|
+
});
|
|
1238
|
+
}, 0), kt.current = {
|
|
1239
|
+
time: 0,
|
|
1240
|
+
wx: 0,
|
|
1241
|
+
wy: 0
|
|
1242
|
+
};
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
const N = kt.current, k = i.x - N.wx, z = i.y - N.wy;
|
|
1246
|
+
if (o - N.time < 400 && Math.abs(k) < 10 && Math.abs(z) < 10) {
|
|
1247
|
+
const b = W.current.nodes;
|
|
1248
|
+
for (let u = b.length - 1; u >= 0; u--) if (Yt(i.x, i.y, b[u])) {
|
|
1249
|
+
const n = b[u], g = n.data.childCanvasId;
|
|
1250
|
+
if (g) {
|
|
1251
|
+
dn(g), kt.current = {
|
|
1200
1252
|
time: 0,
|
|
1201
1253
|
wx: 0,
|
|
1202
1254
|
wy: 0
|
|
1203
1255
|
};
|
|
1204
1256
|
return;
|
|
1205
1257
|
}
|
|
1206
|
-
|
|
1258
|
+
de.current("node", n.id, n.data.label ?? ""), kt.current = {
|
|
1207
1259
|
time: 0,
|
|
1208
1260
|
wx: 0,
|
|
1209
1261
|
wy: 0
|
|
1210
1262
|
};
|
|
1211
1263
|
return;
|
|
1212
1264
|
}
|
|
1213
|
-
const
|
|
1214
|
-
for (const
|
|
1215
|
-
const
|
|
1216
|
-
for (let
|
|
1217
|
-
|
|
1265
|
+
const T = W.current.edges, c = /* @__PURE__ */ new Map();
|
|
1266
|
+
for (const u of b) c.set(u.id, u);
|
|
1267
|
+
const h = F.current?.state.zoom ?? 1;
|
|
1268
|
+
for (let u = T.length - 1; u >= 0; u--) if (Ee(i.x, i.y, T[u], c, $(h, 8, 12))) {
|
|
1269
|
+
de.current("edge", T[u].id, T[u].data.labelText ?? ""), kt.current = {
|
|
1218
1270
|
time: 0,
|
|
1219
1271
|
wx: 0,
|
|
1220
1272
|
wy: 0
|
|
@@ -1222,161 +1274,169 @@ function Wn({ onPixiReady: F }) {
|
|
|
1222
1274
|
return;
|
|
1223
1275
|
}
|
|
1224
1276
|
}
|
|
1225
|
-
|
|
1226
|
-
time:
|
|
1227
|
-
wx:
|
|
1228
|
-
wy:
|
|
1277
|
+
kt.current = {
|
|
1278
|
+
time: o,
|
|
1279
|
+
wx: i.x,
|
|
1280
|
+
wy: i.y
|
|
1229
1281
|
};
|
|
1230
1282
|
});
|
|
1231
|
-
let
|
|
1232
|
-
l.app.ticker.add((
|
|
1283
|
+
let Ve = !1;
|
|
1284
|
+
l.app.ticker.add((f) => {
|
|
1233
1285
|
if (l.destroyed) return;
|
|
1234
|
-
const
|
|
1286
|
+
const o = f.deltaMS, i = l.app.screen, p = F.current?.state ?? {
|
|
1235
1287
|
x: 0,
|
|
1236
1288
|
y: 0,
|
|
1237
1289
|
zoom: 1
|
|
1238
1290
|
};
|
|
1239
|
-
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
showAnchors:
|
|
1247
|
-
presentation:
|
|
1248
|
-
presentationAnchorId:
|
|
1249
|
-
presentationAnchorVisible:
|
|
1291
|
+
H.current?.update(p, i.width, i.height);
|
|
1292
|
+
const N = F.current?.isPanning ?? !1;
|
|
1293
|
+
N !== Ve && (Ve = N, S.current && (S.current.style.cursor = N ? "grabbing" : ""));
|
|
1294
|
+
const k = W.current, z = Bt.current, b = Rn(Ge.current), T = /* @__PURE__ */ new Map();
|
|
1295
|
+
b.forEach((t, r) => T.set(t.node.id, r + 1)), ee.current?.advanceAnimation(o);
|
|
1296
|
+
const c = Ht.current ? b[Ht.current.current] : void 0;
|
|
1297
|
+
ee.current?.sync(k.nodes, z.nodeIds, oe.current, T, {
|
|
1298
|
+
showAnchors: We.current,
|
|
1299
|
+
presentation: Ht.current !== null,
|
|
1300
|
+
presentationAnchorId: c?.node.id,
|
|
1301
|
+
presentationAnchorVisible: Ht.current?.showAnchor ?? !1
|
|
1250
1302
|
});
|
|
1251
|
-
const
|
|
1252
|
-
for (const
|
|
1253
|
-
|
|
1254
|
-
const
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1303
|
+
const h = /* @__PURE__ */ new Map();
|
|
1304
|
+
for (const t of k.nodes) h.set(t.id, t);
|
|
1305
|
+
ne.current?.advanceAnimation(o), ne.current?.sync(k.edges, h, z.edgeIds, null, { presentation: Ht.current !== null }), re.current?.advanceAnimation(o), re.current?.sync(k.lines, z.lineIds), se.current?.update(Dt.current, i.width, i.height, p);
|
|
1306
|
+
const u = qt.current;
|
|
1307
|
+
if (u) {
|
|
1308
|
+
u.clear();
|
|
1309
|
+
const t = xe.current;
|
|
1310
|
+
t && (u.circle(t.wx, t.wy, 10).fill({
|
|
1259
1311
|
color: 3900150,
|
|
1260
1312
|
alpha: 0.12
|
|
1261
1313
|
}).stroke({
|
|
1262
1314
|
color: 3900150,
|
|
1263
1315
|
width: 1.5,
|
|
1264
1316
|
alpha: 0.5
|
|
1265
|
-
}),
|
|
1317
|
+
}), u.circle(t.wx, t.wy, 4).fill({
|
|
1266
1318
|
color: 3900150,
|
|
1267
1319
|
alpha: 0.9
|
|
1268
1320
|
}));
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1321
|
+
const r = ge.current;
|
|
1322
|
+
r && !t && (u.circle(r.worldX, r.worldY, 10).fill({
|
|
1271
1323
|
color: 16347926,
|
|
1272
1324
|
alpha: 0.12
|
|
1273
1325
|
}).stroke({
|
|
1274
1326
|
color: 16347926,
|
|
1275
1327
|
width: 1.5,
|
|
1276
1328
|
alpha: 0.5
|
|
1277
|
-
}),
|
|
1329
|
+
}), u.circle(r.worldX, r.worldY, 4).fill({
|
|
1278
1330
|
color: 16347926,
|
|
1279
1331
|
alpha: 0.9
|
|
1280
1332
|
}));
|
|
1281
1333
|
}
|
|
1282
|
-
const
|
|
1283
|
-
if (
|
|
1284
|
-
|
|
1285
|
-
const
|
|
1286
|
-
if (
|
|
1287
|
-
const
|
|
1334
|
+
const n = Vt.current;
|
|
1335
|
+
if (n) {
|
|
1336
|
+
n.clear();
|
|
1337
|
+
const t = ce.current;
|
|
1338
|
+
if (t) {
|
|
1339
|
+
const r = Pe.current, d = r.x - t.width / 2, a = r.y - t.height / 2, e = le([{
|
|
1288
1340
|
id: "__ghost__",
|
|
1289
|
-
type:
|
|
1341
|
+
type: t.type,
|
|
1290
1342
|
position: {
|
|
1291
|
-
x:
|
|
1292
|
-
y:
|
|
1343
|
+
x: d,
|
|
1344
|
+
y: a
|
|
1293
1345
|
},
|
|
1294
|
-
width:
|
|
1295
|
-
height:
|
|
1346
|
+
width: t.width,
|
|
1347
|
+
height: t.height,
|
|
1296
1348
|
data: {}
|
|
1297
|
-
}],
|
|
1298
|
-
|
|
1299
|
-
width:
|
|
1300
|
-
height:
|
|
1349
|
+
}], k.nodes);
|
|
1350
|
+
Dt.current = e.guides, n.position.set(d + e.dx, a + e.dy), (je[t.type] ?? je.shapeRect)(n, {
|
|
1351
|
+
width: t.width,
|
|
1352
|
+
height: t.height,
|
|
1301
1353
|
fill: "#3b82f6",
|
|
1302
1354
|
stroke: "#3b82f6",
|
|
1303
1355
|
strokeWidth: 1.5,
|
|
1304
|
-
borderStyle:
|
|
1356
|
+
borderStyle: t.data.borderStyle
|
|
1305
1357
|
});
|
|
1306
1358
|
} else
|
|
1307
|
-
|
|
1359
|
+
n.position.set(0, 0), !st.current?.active && !yt.current?.active && (Dt.current = []);
|
|
1308
1360
|
}
|
|
1309
|
-
const
|
|
1310
|
-
if (
|
|
1311
|
-
const
|
|
1312
|
-
for (const
|
|
1313
|
-
if (!
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1361
|
+
const g = Zt.current;
|
|
1362
|
+
if (g && (g.clear(), z.edgeIds.size > 0 && Kt.current === "select")) {
|
|
1363
|
+
const t = 1 / p.zoom;
|
|
1364
|
+
for (const r of k.edges) {
|
|
1365
|
+
if (!z.edgeIds.has(r.id)) continue;
|
|
1366
|
+
const d = Mt(r, h);
|
|
1367
|
+
d && (g.circle(d.sx, d.sy, 5 * t).fill({ color: 16777215 }).stroke({
|
|
1368
|
+
color: 16347926,
|
|
1369
|
+
width: 1.5 * t
|
|
1370
|
+
}), g.circle(d.tx, d.ty, 5 * t).fill({ color: 16777215 }).stroke({
|
|
1371
|
+
color: 16347926,
|
|
1372
|
+
width: 1.5 * t
|
|
1373
|
+
}));
|
|
1374
|
+
const a = r.data.waypoints;
|
|
1375
|
+
if (a) for (const e of a) g.circle(e.x, e.y, 5 * t).fill({ color: 16777215 }).stroke({
|
|
1316
1376
|
color: 3900150,
|
|
1317
|
-
width: 1.5 *
|
|
1377
|
+
width: 1.5 * t
|
|
1318
1378
|
});
|
|
1319
|
-
if (
|
|
1320
|
-
const
|
|
1321
|
-
if (!
|
|
1322
|
-
const
|
|
1379
|
+
if (r.type === "simplebezier") {
|
|
1380
|
+
const e = Mt(r, h);
|
|
1381
|
+
if (!e) continue;
|
|
1382
|
+
const s = a ?? [], w = [
|
|
1323
1383
|
{
|
|
1324
|
-
x:
|
|
1325
|
-
y:
|
|
1384
|
+
x: e.sx,
|
|
1385
|
+
y: e.sy
|
|
1326
1386
|
},
|
|
1327
|
-
...
|
|
1387
|
+
...s,
|
|
1328
1388
|
{
|
|
1329
|
-
x:
|
|
1330
|
-
y:
|
|
1389
|
+
x: e.tx,
|
|
1390
|
+
y: e.ty
|
|
1331
1391
|
}
|
|
1332
|
-
],
|
|
1333
|
-
for (let
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1392
|
+
], m = r.data.bezierControls, R = w.length - 2;
|
|
1393
|
+
for (let G = 0; G <= R; G++) {
|
|
1394
|
+
const y = w[G], v = w[G + 1], U = m?.[G], et = Math.hypot(v.x - y.x, v.y - y.y), Lt = Math.max(30, et * 0.3), ae = U?.c1x ?? (G === 0 ? y.x + e.snx * Lt : y.x + (v.x - y.x) * 0.4), Gt = U?.c1y ?? (G === 0 ? y.y + e.sny * Lt : y.y), Be = U?.c2x ?? (G === R ? v.x + e.tnx * Lt : v.x - (v.x - y.x) * 0.4), Ke = U?.c2y ?? (G === R ? v.y + e.tny * Lt : v.y);
|
|
1395
|
+
g.moveTo(y.x, y.y).lineTo(ae, Gt).stroke({
|
|
1336
1396
|
color: 10265519,
|
|
1337
|
-
width: 1 *
|
|
1338
|
-
}),
|
|
1397
|
+
width: 1 * t
|
|
1398
|
+
}), g.moveTo(v.x, v.y).lineTo(Be, Ke).stroke({
|
|
1339
1399
|
color: 10265519,
|
|
1340
|
-
width: 1 *
|
|
1400
|
+
width: 1 * t
|
|
1341
1401
|
});
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1402
|
+
const Ue = 4 * t;
|
|
1403
|
+
g.circle(ae, Gt, Ue).fill({ color: 16777215 }).stroke({
|
|
1344
1404
|
color: 3900150,
|
|
1345
|
-
width: 1.5 *
|
|
1346
|
-
}),
|
|
1405
|
+
width: 1.5 * t
|
|
1406
|
+
}), g.circle(Be, Ke, Ue).fill({ color: 16777215 }).stroke({
|
|
1347
1407
|
color: 3900150,
|
|
1348
|
-
width: 1.5 *
|
|
1408
|
+
width: 1.5 * t
|
|
1349
1409
|
});
|
|
1350
1410
|
}
|
|
1351
1411
|
}
|
|
1352
1412
|
}
|
|
1353
1413
|
}
|
|
1354
|
-
const
|
|
1355
|
-
if (
|
|
1356
|
-
const
|
|
1357
|
-
if (
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1414
|
+
const x = Ot.current;
|
|
1415
|
+
if (x && (x.clear(), z.nodeIds.size === 1 && Kt.current === "select")) {
|
|
1416
|
+
const t = [...z.nodeIds][0], r = k.nodes.find((d) => d.id === t);
|
|
1417
|
+
if (r) {
|
|
1418
|
+
const d = p.zoom, a = r.position.x * d + p.x, e = r.position.y * d + p.y, s = r.width * d, w = r.height * d;
|
|
1419
|
+
x.rect(a, e, s, w).stroke({
|
|
1360
1420
|
color: 3900150,
|
|
1361
1421
|
width: 1.5
|
|
1362
1422
|
});
|
|
1363
|
-
const
|
|
1364
|
-
[
|
|
1365
|
-
[
|
|
1366
|
-
[
|
|
1367
|
-
[
|
|
1423
|
+
const m = 7, R = m / 2, G = [
|
|
1424
|
+
[a, e],
|
|
1425
|
+
[a + s, e],
|
|
1426
|
+
[a + s, e + w],
|
|
1427
|
+
[a, e + w]
|
|
1368
1428
|
];
|
|
1369
|
-
for (const [
|
|
1429
|
+
for (const [U, et] of G) x.rect(U - R, et - R, m, m).fill({ color: 16777215 }).stroke({
|
|
1370
1430
|
color: 3900150,
|
|
1371
1431
|
width: 1.5
|
|
1372
1432
|
});
|
|
1373
|
-
const
|
|
1374
|
-
[
|
|
1375
|
-
[
|
|
1376
|
-
[
|
|
1377
|
-
[
|
|
1433
|
+
const y = 4, v = [
|
|
1434
|
+
[a + s / 2, e],
|
|
1435
|
+
[a + s, e + w / 2],
|
|
1436
|
+
[a + s / 2, e + w],
|
|
1437
|
+
[a, e + w / 2]
|
|
1378
1438
|
];
|
|
1379
|
-
for (const [
|
|
1439
|
+
for (const [U, et] of v) x.circle(U, et, y).fill({
|
|
1380
1440
|
color: 3900150,
|
|
1381
1441
|
alpha: 0.9
|
|
1382
1442
|
});
|
|
@@ -1384,72 +1444,87 @@ function Wn({ onPixiReady: F }) {
|
|
|
1384
1444
|
}
|
|
1385
1445
|
});
|
|
1386
1446
|
};
|
|
1387
|
-
return
|
|
1388
|
-
if (
|
|
1447
|
+
return O(), () => {
|
|
1448
|
+
if (P = !0, l && !l.destroyed) try {
|
|
1389
1449
|
l.app.stage.removeAllListeners();
|
|
1390
1450
|
} catch {
|
|
1391
1451
|
}
|
|
1392
|
-
|
|
1452
|
+
const Y = S.current;
|
|
1453
|
+
X && Y?.removeEventListener("touchstart", X), A && Y?.removeEventListener("touchmove", A), Z && (Y?.removeEventListener("touchend", Z), Y?.removeEventListener("touchcancel", Z)), H.current?.destroy(), Ct.current?.destroy(), ee.current?.destroy(), ne.current?.destroy(), re.current?.destroy(), ye.current?.destroy(), pe.current?.destroy(), xt.current?.destroy(), Ot.current && (Ot.current.destroy(), Ot.current = null), qt.current && (qt.current.destroy(), qt.current = null), Zt.current && (Zt.current.destroy(), Zt.current = null), Vt.current && (Vt.current.destroy(), Vt.current = null), se.current?.destroy();
|
|
1393
1454
|
};
|
|
1394
|
-
}, [
|
|
1395
|
-
const l =
|
|
1396
|
-
if (!(!l || !
|
|
1397
|
-
switch (l.deactivate(),
|
|
1455
|
+
}, [E.current]), bt(() => {
|
|
1456
|
+
const l = ye.current, P = pe.current;
|
|
1457
|
+
if (!(!l || !P))
|
|
1458
|
+
switch (l.deactivate(), P.deactivate(), K) {
|
|
1398
1459
|
case "freehand":
|
|
1399
1460
|
l.activate();
|
|
1400
1461
|
break;
|
|
1401
1462
|
case "line":
|
|
1402
|
-
|
|
1463
|
+
P.activate("straight");
|
|
1403
1464
|
break;
|
|
1404
1465
|
case "polyline":
|
|
1405
|
-
|
|
1466
|
+
P.activate("polyline");
|
|
1406
1467
|
break;
|
|
1407
1468
|
case "arrow":
|
|
1408
|
-
|
|
1469
|
+
P.activate("arrow");
|
|
1409
1470
|
break;
|
|
1410
1471
|
}
|
|
1411
|
-
}, [K]),
|
|
1412
|
-
|
|
1413
|
-
}, [
|
|
1414
|
-
const l =
|
|
1472
|
+
}, [K]), bt(() => {
|
|
1473
|
+
H.current && (H.current.visible = j, H.current.gridSize = nt);
|
|
1474
|
+
}, [j, nt]), bt(() => {
|
|
1475
|
+
const l = S.current;
|
|
1415
1476
|
if (!l) return;
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
const
|
|
1419
|
-
if (!
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1477
|
+
const P = 1e-3, X = (A) => {
|
|
1478
|
+
A.preventDefault();
|
|
1479
|
+
const Z = F.current;
|
|
1480
|
+
if (!Z) return;
|
|
1481
|
+
const O = l.getBoundingClientRect(), Y = A.clientX - O.left, dt = A.clientY - O.top, wt = A.ctrlKey ? 3 : 1, mt = -A.deltaY * P * wt;
|
|
1482
|
+
Z.zoomAt(Y, dt, 1 + mt);
|
|
1422
1483
|
};
|
|
1423
|
-
return l.addEventListener("wheel",
|
|
1424
|
-
}, [
|
|
1484
|
+
return l.addEventListener("wheel", X, { passive: !1 }), () => l.removeEventListener("wheel", X);
|
|
1485
|
+
}, [F]), /* @__PURE__ */ Je("div", {
|
|
1425
1486
|
style: {
|
|
1426
1487
|
position: "relative",
|
|
1427
1488
|
width: "100%",
|
|
1428
1489
|
height: "100%"
|
|
1429
1490
|
},
|
|
1430
|
-
children: [
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1491
|
+
children: [
|
|
1492
|
+
/* @__PURE__ */ Ce("div", {
|
|
1493
|
+
ref: S,
|
|
1494
|
+
className: "flow-canvas-wrapper",
|
|
1495
|
+
tabIndex: -1,
|
|
1496
|
+
onContextMenu: (l) => l.preventDefault()
|
|
1497
|
+
}),
|
|
1498
|
+
ut && Ie && /* @__PURE__ */ Ce("input", {
|
|
1499
|
+
className: "flow-label-editor",
|
|
1500
|
+
autoFocus: !0,
|
|
1501
|
+
defaultValue: ut.value,
|
|
1502
|
+
style: {
|
|
1503
|
+
left: Ie.x,
|
|
1504
|
+
top: Ie.y
|
|
1505
|
+
},
|
|
1506
|
+
onFocus: (l) => l.currentTarget.select(),
|
|
1507
|
+
onKeyDown: (l) => {
|
|
1508
|
+
l.key === "Enter" ? (l.preventDefault(), _e(l.target.value)) : l.key === "Escape" && (l.preventDefault(), an()), l.stopPropagation();
|
|
1509
|
+
},
|
|
1510
|
+
onBlur: (l) => _e(l.target.value),
|
|
1511
|
+
onPointerDown: (l) => l.stopPropagation()
|
|
1512
|
+
}),
|
|
1513
|
+
Xt && !St && /* @__PURE__ */ Je("button", {
|
|
1514
|
+
type: "button",
|
|
1515
|
+
className: "flow-esc-button",
|
|
1516
|
+
onClick: () => Tt(null),
|
|
1517
|
+
title: "取消连续放置 (Esc)",
|
|
1518
|
+
children: [/* @__PURE__ */ Ce("span", {
|
|
1519
|
+
"aria-hidden": !0,
|
|
1520
|
+
children: "⎋"
|
|
1521
|
+
}), " 取消放置 (ESC)"]
|
|
1522
|
+
})
|
|
1523
|
+
]
|
|
1449
1524
|
});
|
|
1450
1525
|
}
|
|
1451
1526
|
export {
|
|
1452
|
-
|
|
1527
|
+
$n as default
|
|
1453
1528
|
};
|
|
1454
1529
|
|
|
1455
1530
|
//# sourceMappingURL=FlowCanvas.js.map
|