@html-graph/html-graph 3.10.0 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/html-graph.d.ts +45 -11
- package/dist/html-graph.js +1497 -1389
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
x:
|
|
14
|
-
y:
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var ye = (r, e, t) => e in r ? ve(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => ye(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const me = () => {
|
|
5
|
+
const r = document.createElement("div");
|
|
6
|
+
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
7
|
+
}, Ae = () => {
|
|
8
|
+
const r = document.createElement("div");
|
|
9
|
+
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
10
|
+
}, Ee = (r) => {
|
|
11
|
+
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
12
|
+
}, D = (r, e) => ({
|
|
13
|
+
x: r.scale * e.x + r.x,
|
|
14
|
+
y: r.scale * e.y + r.y
|
|
15
15
|
});
|
|
16
|
-
class
|
|
17
|
-
constructor(e,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
class ne {
|
|
17
|
+
constructor(e, t, s) {
|
|
18
|
+
o(this, "host", Ae());
|
|
19
|
+
o(this, "container", me());
|
|
20
|
+
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
|
+
o(this, "applyTransform", () => {
|
|
22
22
|
const e = this.viewportStore.getContentMatrix();
|
|
23
23
|
this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
|
|
24
24
|
});
|
|
25
|
-
this.graphStore = e, this.viewportStore =
|
|
25
|
+
this.graphStore = e, this.viewportStore = t, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
|
|
26
26
|
}
|
|
27
27
|
attachNode(e) {
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const t = this.graphStore.getNode(e);
|
|
29
|
+
Ee(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
30
30
|
}
|
|
31
31
|
detachNode(e) {
|
|
32
|
-
const
|
|
33
|
-
this.container.removeChild(
|
|
32
|
+
const t = this.graphStore.getNode(e);
|
|
33
|
+
this.container.removeChild(t.element);
|
|
34
34
|
}
|
|
35
35
|
attachEdge(e) {
|
|
36
|
-
const
|
|
37
|
-
this.edgeIdToElementMap.set(e,
|
|
36
|
+
const t = this.graphStore.getEdge(e).shape.svg;
|
|
37
|
+
this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
|
|
38
38
|
}
|
|
39
39
|
detachEdge(e) {
|
|
40
|
-
const
|
|
41
|
-
this.container.removeChild(
|
|
40
|
+
const t = this.edgeIdToElementMap.get(e);
|
|
41
|
+
this.container.removeChild(t), this.edgeIdToElementMap.delete(e);
|
|
42
42
|
}
|
|
43
43
|
clear() {
|
|
44
|
-
this.edgeIdToElementMap.forEach((e,
|
|
45
|
-
this.detachEdge(
|
|
44
|
+
this.edgeIdToElementMap.forEach((e, t) => {
|
|
45
|
+
this.detachEdge(t);
|
|
46
46
|
}), this.graphStore.getAllNodeIds().forEach((e) => {
|
|
47
47
|
this.detachNode(e);
|
|
48
48
|
});
|
|
@@ -51,100 +51,100 @@ class he {
|
|
|
51
51
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
52
52
|
}
|
|
53
53
|
updateNodePosition(e) {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, h = t.centerFn(s, i), a = t.x - n * h.x, d = t.y - n * h.y;
|
|
55
|
+
t.element.style.transform = `translate(${a}px, ${d}px)`;
|
|
56
56
|
}
|
|
57
57
|
updateNodePriority(e) {
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const t = this.graphStore.getNode(e);
|
|
59
|
+
t.element.style.zIndex = `${t.priority}`;
|
|
60
60
|
}
|
|
61
61
|
updateEdgeShape(e) {
|
|
62
|
-
const
|
|
63
|
-
this.container.removeChild(
|
|
64
|
-
const
|
|
65
|
-
this.edgeIdToElementMap.set(e,
|
|
62
|
+
const t = this.edgeIdToElementMap.get(e);
|
|
63
|
+
this.container.removeChild(t);
|
|
64
|
+
const s = this.graphStore.getEdge(e);
|
|
65
|
+
this.edgeIdToElementMap.set(e, s.shape.svg), this.container.appendChild(s.shape.svg);
|
|
66
66
|
}
|
|
67
67
|
renderEdge(e) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
i,
|
|
71
|
-
h,
|
|
72
|
-
d,
|
|
73
|
-
c
|
|
74
|
-
), l = this.createEdgeRenderPort(
|
|
75
|
-
o.to,
|
|
68
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), h = i.element.getBoundingClientRect(), a = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
|
|
69
|
+
t.from,
|
|
76
70
|
s,
|
|
77
71
|
n,
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
a,
|
|
73
|
+
d
|
|
74
|
+
), g = this.createEdgeRenderPort(
|
|
75
|
+
t.to,
|
|
76
|
+
i,
|
|
77
|
+
h,
|
|
78
|
+
a,
|
|
79
|
+
d
|
|
80
80
|
);
|
|
81
|
-
|
|
81
|
+
t.shape.render({ from: c, to: g });
|
|
82
82
|
}
|
|
83
83
|
updateEdgePriority(e) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
createEdgeRenderPort(e,
|
|
88
|
-
const
|
|
89
|
-
x:
|
|
90
|
-
y:
|
|
91
|
-
},
|
|
84
|
+
const t = this.graphStore.getEdge(e);
|
|
85
|
+
t.shape.svg.style.zIndex = `${t.priority}`;
|
|
86
|
+
}
|
|
87
|
+
createEdgeRenderPort(e, t, s, i, n) {
|
|
88
|
+
const h = {
|
|
89
|
+
x: s.left - i.left,
|
|
90
|
+
y: s.top - i.top
|
|
91
|
+
}, a = D(n, h);
|
|
92
92
|
return {
|
|
93
|
-
x:
|
|
94
|
-
y:
|
|
95
|
-
width:
|
|
96
|
-
height:
|
|
97
|
-
direction:
|
|
93
|
+
x: a.x,
|
|
94
|
+
y: a.y,
|
|
95
|
+
width: s.width * n.scale,
|
|
96
|
+
height: s.height * n.scale,
|
|
97
|
+
direction: t.direction,
|
|
98
98
|
portId: e,
|
|
99
|
-
nodeId:
|
|
99
|
+
nodeId: t.nodeId
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class xe {
|
|
104
104
|
constructor(e) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
o(this, "xFrom", 1 / 0);
|
|
106
|
+
o(this, "yFrom", 1 / 0);
|
|
107
|
+
o(this, "xTo", 1 / 0);
|
|
108
|
+
o(this, "yTo", 1 / 0);
|
|
109
109
|
this.graphStore = e;
|
|
110
110
|
}
|
|
111
111
|
setRenderingBox(e) {
|
|
112
112
|
this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
|
|
113
113
|
}
|
|
114
114
|
hasNode(e) {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
115
|
+
const t = this.graphStore.getNode(e);
|
|
116
|
+
return t.x >= this.xFrom && t.x <= this.xTo && t.y >= this.yFrom && t.y <= this.yTo;
|
|
117
117
|
}
|
|
118
118
|
hasEdge(e) {
|
|
119
|
-
const
|
|
120
|
-
return
|
|
119
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s), h = this.graphStore.getNode(i), a = Math.min(n.x, h.x), d = Math.max(n.x, h.x), c = Math.min(n.y, h.y), g = Math.max(n.y, h.y);
|
|
120
|
+
return a <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
124
|
-
constructor(e,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
class Se {
|
|
124
|
+
constructor(e, t, s) {
|
|
125
|
+
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
|
+
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
127
|
+
o(this, "renderingBox");
|
|
128
|
+
o(this, "updateViewport", (e) => {
|
|
129
129
|
this.renderingBox.setRenderingBox(e);
|
|
130
|
-
const
|
|
131
|
-
this.graphStore.getAllNodeIds().forEach((
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
}), this.graphStore.getAllEdgeIds().forEach((
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
}),
|
|
138
|
-
this.handleDetachEdge(
|
|
139
|
-
}),
|
|
140
|
-
this.handleDetachNode(
|
|
141
|
-
}),
|
|
142
|
-
this.attachedNodes.has(
|
|
143
|
-
}),
|
|
144
|
-
this.handleAttachEdge(
|
|
130
|
+
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
131
|
+
this.graphStore.getAllNodeIds().forEach((h) => {
|
|
132
|
+
const a = this.renderingBox.hasNode(h), d = this.attachedNodes.has(h);
|
|
133
|
+
a && !d ? t.add(h) : !a && d && s.add(h);
|
|
134
|
+
}), this.graphStore.getAllEdgeIds().forEach((h) => {
|
|
135
|
+
const a = this.renderingBox.hasEdge(h), d = this.attachedEdges.has(h), c = this.graphStore.getEdge(h), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
|
|
136
|
+
a && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), a && !d ? i.add(h) : !a && d && n.add(h);
|
|
137
|
+
}), n.forEach((h) => {
|
|
138
|
+
this.handleDetachEdge(h);
|
|
139
|
+
}), s.forEach((h) => {
|
|
140
|
+
this.handleDetachNode(h);
|
|
141
|
+
}), t.forEach((h) => {
|
|
142
|
+
this.attachedNodes.has(h) || this.handleAttachNode(h);
|
|
143
|
+
}), i.forEach((h) => {
|
|
144
|
+
this.handleAttachEdge(h);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore =
|
|
147
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new xe(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -159,8 +159,8 @@ class be {
|
|
|
159
159
|
this.attachedEdges.has(e) && this.handleDetachEdge(e);
|
|
160
160
|
}
|
|
161
161
|
updateNodePosition(e) {
|
|
162
|
-
this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((
|
|
163
|
-
this.attachEdgeEntities(
|
|
162
|
+
this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
|
|
163
|
+
this.attachEdgeEntities(t);
|
|
164
164
|
}));
|
|
165
165
|
}
|
|
166
166
|
updateNodePriority(e) {
|
|
@@ -182,8 +182,8 @@ class be {
|
|
|
182
182
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
183
183
|
}
|
|
184
184
|
attachEdgeEntities(e) {
|
|
185
|
-
const
|
|
186
|
-
this.attachedNodes.has(
|
|
185
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
|
|
186
|
+
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
|
|
187
187
|
}
|
|
188
188
|
handleAttachNode(e) {
|
|
189
189
|
this.attachedNodes.add(e), this.htmlView.attachNode(e);
|
|
@@ -198,9 +198,9 @@ class be {
|
|
|
198
198
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class he {
|
|
202
202
|
constructor() {
|
|
203
|
-
|
|
203
|
+
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
204
204
|
}
|
|
205
205
|
subscribe(e) {
|
|
206
206
|
this.callbacks.add(e);
|
|
@@ -209,19 +209,19 @@ class de {
|
|
|
209
209
|
this.callbacks.delete(e);
|
|
210
210
|
}
|
|
211
211
|
emit(e) {
|
|
212
|
-
this.callbacks.forEach((
|
|
213
|
-
|
|
212
|
+
this.callbacks.forEach((t) => {
|
|
213
|
+
t(e);
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
return [
|
|
217
|
+
const E = () => {
|
|
218
|
+
const r = new he();
|
|
219
|
+
return [r, r];
|
|
220
220
|
};
|
|
221
|
-
class
|
|
221
|
+
class be {
|
|
222
222
|
constructor(e) {
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
o(this, "onBeforeUpdated");
|
|
224
|
+
o(this, "onAfterUpdated");
|
|
225
225
|
this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
226
226
|
}
|
|
227
227
|
getViewportMatrix() {
|
|
@@ -231,31 +231,31 @@ class Te {
|
|
|
231
231
|
return { ...this.viewportStore.getContentMatrix() };
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
class
|
|
234
|
+
class Te {
|
|
235
235
|
constructor(e) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
236
|
+
o(this, "onAfterNodeAdded");
|
|
237
|
+
o(this, "onAfterNodeUpdated");
|
|
238
|
+
o(this, "onAfterNodePriorityUpdated");
|
|
239
|
+
o(this, "onBeforeNodeRemoved");
|
|
240
|
+
o(this, "onAfterPortMarked");
|
|
241
|
+
o(this, "onAfterPortUpdated");
|
|
242
|
+
o(this, "onBeforePortUnmarked");
|
|
243
|
+
o(this, "onAfterEdgeAdded");
|
|
244
|
+
o(this, "onAfterEdgeShapeUpdated");
|
|
245
|
+
o(this, "onAfterEdgeUpdated");
|
|
246
|
+
o(this, "onAfterEdgePriorityUpdated");
|
|
247
|
+
o(this, "onBeforeEdgeRemoved");
|
|
248
|
+
o(this, "onBeforeClear");
|
|
249
249
|
this.graphStore = e, this.onAfterNodeAdded = this.graphStore.onAfterNodeAdded, this.onAfterNodeUpdated = this.graphStore.onAfterNodeUpdated, this.onAfterNodePriorityUpdated = this.graphStore.onAfterNodePriorityUpdated, this.onBeforeNodeRemoved = this.graphStore.onBeforeNodeRemoved, this.onAfterPortMarked = this.graphStore.onAfterPortAdded, this.onAfterPortUpdated = this.graphStore.onAfterPortUpdated, this.onBeforePortUnmarked = this.graphStore.onBeforePortRemoved, this.onAfterEdgeAdded = this.graphStore.onAfterEdgeAdded, this.onAfterEdgeShapeUpdated = this.graphStore.onAfterEdgeShapeUpdated, this.onAfterEdgeUpdated = this.graphStore.onAfterEdgeUpdated, this.onAfterEdgePriorityUpdated = this.graphStore.onAfterEdgePriorityUpdated, this.onBeforeEdgeRemoved = this.graphStore.onBeforeEdgeRemoved, this.onBeforeClear = this.graphStore.onBeforeClear;
|
|
250
250
|
}
|
|
251
251
|
getNode(e) {
|
|
252
|
-
const
|
|
253
|
-
return
|
|
254
|
-
element:
|
|
255
|
-
x:
|
|
256
|
-
y:
|
|
257
|
-
centerFn:
|
|
258
|
-
priority:
|
|
252
|
+
const t = this.graphStore.getNode(e);
|
|
253
|
+
return t === void 0 ? null : {
|
|
254
|
+
element: t.element,
|
|
255
|
+
x: t.x,
|
|
256
|
+
y: t.y,
|
|
257
|
+
centerFn: t.centerFn,
|
|
258
|
+
priority: t.priority
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
getElementNodeId(e) {
|
|
@@ -266,11 +266,11 @@ class Pe {
|
|
|
266
266
|
return this.graphStore.getAllNodeIds();
|
|
267
267
|
}
|
|
268
268
|
getPort(e) {
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
element:
|
|
272
|
-
direction:
|
|
273
|
-
nodeId:
|
|
269
|
+
const t = this.graphStore.getPort(e);
|
|
270
|
+
return t === void 0 ? null : {
|
|
271
|
+
element: t.element,
|
|
272
|
+
direction: t.direction,
|
|
273
|
+
nodeId: t.nodeId
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
// TODO: use Set in v4
|
|
@@ -290,8 +290,8 @@ class Pe {
|
|
|
290
290
|
return this.graphStore.getAllEdgeIds();
|
|
291
291
|
}
|
|
292
292
|
getEdge(e) {
|
|
293
|
-
const
|
|
294
|
-
return
|
|
293
|
+
const t = this.graphStore.getEdge(e);
|
|
294
|
+
return t === void 0 ? null : { from: t.from, to: t.to, priority: t.priority };
|
|
295
295
|
}
|
|
296
296
|
// TODO: use Set in v4
|
|
297
297
|
getPortIncomingEdgeIds(e) {
|
|
@@ -326,9 +326,9 @@ class Pe {
|
|
|
326
326
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
class
|
|
329
|
+
class $ {
|
|
330
330
|
constructor(e) {
|
|
331
|
-
|
|
331
|
+
o(this, "counter", 0);
|
|
332
332
|
this.checkExists = e;
|
|
333
333
|
}
|
|
334
334
|
create(e) {
|
|
@@ -345,120 +345,120 @@ class W {
|
|
|
345
345
|
class S extends Error {
|
|
346
346
|
constructor() {
|
|
347
347
|
super(...arguments);
|
|
348
|
-
|
|
348
|
+
o(this, "name", "HtmlGraphError");
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
class
|
|
352
|
-
constructor(e,
|
|
351
|
+
class ae {
|
|
352
|
+
constructor(e, t, s, i, n) {
|
|
353
353
|
/**
|
|
354
354
|
* provides api for accessing model of rendered graph
|
|
355
355
|
*/
|
|
356
|
-
|
|
356
|
+
o(this, "graph");
|
|
357
357
|
/**
|
|
358
358
|
* provides api for accessing viewport state
|
|
359
359
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
o(this, "viewport");
|
|
361
|
+
o(this, "nodeIdGenerator", new $(
|
|
362
362
|
(e) => this.graph.getNode(e) !== null
|
|
363
363
|
));
|
|
364
|
-
|
|
364
|
+
o(this, "portIdGenerator", new $(
|
|
365
365
|
(e) => this.graph.getPort(e) !== null
|
|
366
366
|
));
|
|
367
|
-
|
|
367
|
+
o(this, "edgeIdGenerator", new $(
|
|
368
368
|
(e) => this.graph.getEdge(e) !== null
|
|
369
369
|
));
|
|
370
|
-
|
|
370
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
371
371
|
this.htmlView.attachNode(e);
|
|
372
372
|
});
|
|
373
|
-
|
|
374
|
-
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((
|
|
375
|
-
this.htmlView.renderEdge(
|
|
373
|
+
o(this, "onAfterNodeUpdated", (e) => {
|
|
374
|
+
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
|
|
375
|
+
this.htmlView.renderEdge(s);
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
|
-
|
|
378
|
+
o(this, "onAfterNodePriorityUpdated", (e) => {
|
|
379
379
|
this.htmlView.updateNodePriority(e);
|
|
380
380
|
});
|
|
381
|
-
|
|
382
|
-
this.graphStore.getNodePortIds(e).forEach((
|
|
383
|
-
this.unmarkPort(
|
|
381
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
382
|
+
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
383
|
+
this.unmarkPort(t);
|
|
384
384
|
}), this.htmlView.detachNode(e);
|
|
385
385
|
});
|
|
386
|
-
|
|
387
|
-
this.graphStore.getPortAdjacentEdgeIds(e).forEach((
|
|
388
|
-
this.htmlView.renderEdge(
|
|
386
|
+
o(this, "onAfterPortUpdated", (e) => {
|
|
387
|
+
this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
|
|
388
|
+
this.htmlView.renderEdge(s);
|
|
389
389
|
});
|
|
390
390
|
});
|
|
391
|
-
|
|
392
|
-
this.graphStore.getPortAdjacentEdgeIds(e).forEach((
|
|
393
|
-
this.removeEdge(
|
|
391
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
392
|
+
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
393
|
+
this.removeEdge(t);
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
|
-
|
|
396
|
+
o(this, "onAfterEdgeAdded", (e) => {
|
|
397
397
|
this.htmlView.attachEdge(e);
|
|
398
398
|
});
|
|
399
|
-
|
|
399
|
+
o(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
400
400
|
this.htmlView.updateEdgeShape(e);
|
|
401
401
|
});
|
|
402
|
-
|
|
402
|
+
o(this, "onAfterEdgeUpdated", (e) => {
|
|
403
403
|
this.htmlView.renderEdge(e);
|
|
404
404
|
});
|
|
405
|
-
|
|
405
|
+
o(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
406
406
|
this.htmlView.updateEdgePriority(e);
|
|
407
407
|
});
|
|
408
|
-
|
|
408
|
+
o(this, "onBeforeEdgeRemoved", (e) => {
|
|
409
409
|
this.htmlView.detachEdge(e);
|
|
410
410
|
});
|
|
411
|
-
|
|
411
|
+
o(this, "onBeforeClear", () => {
|
|
412
412
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
413
413
|
});
|
|
414
|
-
|
|
414
|
+
o(this, "onBeforeDestroyEmitter");
|
|
415
415
|
/**
|
|
416
416
|
* emits event just before destruction of canvas
|
|
417
417
|
*/
|
|
418
|
-
|
|
419
|
-
this.element = e, this.graphStore =
|
|
418
|
+
o(this, "onBeforeDestroy");
|
|
419
|
+
this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new Te(this.graphStore), this.viewport = new be(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
420
420
|
this.onAfterNodePriorityUpdated
|
|
421
421
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
422
422
|
this.onAfterEdgeShapeUpdated
|
|
423
423
|
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
424
424
|
this.onAfterEdgePriorityUpdated
|
|
425
|
-
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] =
|
|
425
|
+
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
428
428
|
* adds new node
|
|
429
429
|
*/
|
|
430
430
|
addNode(e) {
|
|
431
|
-
const
|
|
432
|
-
if (this.graph.getNode(
|
|
431
|
+
const t = this.nodeIdGenerator.create(e.id);
|
|
432
|
+
if (this.graph.getNode(t) !== null)
|
|
433
433
|
throw new S("failed to add node with existing id");
|
|
434
434
|
if (this.graphStore.getElementNodeId(e.element) !== void 0)
|
|
435
435
|
throw new S(
|
|
436
436
|
"failed to add node with html element already in use by another node"
|
|
437
437
|
);
|
|
438
438
|
if (this.graphStore.addNode({
|
|
439
|
-
id:
|
|
439
|
+
id: t,
|
|
440
440
|
element: e.element,
|
|
441
441
|
x: e.x,
|
|
442
442
|
y: e.y,
|
|
443
443
|
centerFn: e.centerFn ?? this.defaults.nodes.centerFn,
|
|
444
444
|
priority: e.priority ?? this.defaults.nodes.priorityFn()
|
|
445
445
|
}), e.ports !== void 0)
|
|
446
|
-
for (const
|
|
446
|
+
for (const s of e.ports)
|
|
447
447
|
this.markPort({
|
|
448
|
-
id:
|
|
449
|
-
element:
|
|
450
|
-
nodeId:
|
|
451
|
-
direction:
|
|
448
|
+
id: s.id,
|
|
449
|
+
element: s.element,
|
|
450
|
+
nodeId: t,
|
|
451
|
+
direction: s.direction
|
|
452
452
|
});
|
|
453
453
|
return this;
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
456
|
* updates node parameters
|
|
457
457
|
*/
|
|
458
|
-
updateNode(e,
|
|
458
|
+
updateNode(e, t) {
|
|
459
459
|
if (this.graph.getNode(e) === null)
|
|
460
460
|
throw new S("failed to update non existing node");
|
|
461
|
-
return this.graphStore.updateNode(e,
|
|
461
|
+
return this.graphStore.updateNode(e, t ?? {}), this;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
* removes specified node
|
|
@@ -474,13 +474,13 @@ class ce {
|
|
|
474
474
|
* marks specified element as a port for specified node
|
|
475
475
|
*/
|
|
476
476
|
markPort(e) {
|
|
477
|
-
const
|
|
478
|
-
if (this.graph.getPort(
|
|
477
|
+
const t = this.portIdGenerator.create(e.id);
|
|
478
|
+
if (this.graph.getPort(t) !== null)
|
|
479
479
|
throw new S("failed to add port with existing id");
|
|
480
480
|
if (this.graph.getNode(e.nodeId) === null)
|
|
481
481
|
throw new S("failed to mark port for nonexistent node");
|
|
482
482
|
return this.graphStore.addPort({
|
|
483
|
-
id:
|
|
483
|
+
id: t,
|
|
484
484
|
element: e.element,
|
|
485
485
|
nodeId: e.nodeId,
|
|
486
486
|
direction: e.direction ?? this.defaults.ports.direction
|
|
@@ -489,10 +489,10 @@ class ce {
|
|
|
489
489
|
/**
|
|
490
490
|
* updates port and edges attached to it
|
|
491
491
|
*/
|
|
492
|
-
updatePort(e,
|
|
492
|
+
updatePort(e, t) {
|
|
493
493
|
if (this.graph.getPort(e) === null)
|
|
494
494
|
throw new S("failed to update nonexistent port");
|
|
495
|
-
return this.graphStore.updatePort(e,
|
|
495
|
+
return this.graphStore.updatePort(e, t ?? {}), this;
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
498
498
|
* unmarks specified port
|
|
@@ -507,28 +507,28 @@ class ce {
|
|
|
507
507
|
* adds new edge
|
|
508
508
|
*/
|
|
509
509
|
addEdge(e) {
|
|
510
|
-
const
|
|
511
|
-
if (this.graph.getEdge(
|
|
510
|
+
const t = this.edgeIdGenerator.create(e.id);
|
|
511
|
+
if (this.graph.getEdge(t) !== null)
|
|
512
512
|
throw new S("failed to add edge with existing id");
|
|
513
513
|
if (this.graph.getPort(e.from) === null)
|
|
514
514
|
throw new S("failed to add edge from nonexistent port");
|
|
515
515
|
if (this.graph.getPort(e.to) === null)
|
|
516
516
|
throw new S("failed to add edge to nonexistent port");
|
|
517
517
|
return this.graphStore.addEdge({
|
|
518
|
-
id:
|
|
518
|
+
id: t,
|
|
519
519
|
from: e.from,
|
|
520
520
|
to: e.to,
|
|
521
|
-
shape: e.shape ?? this.defaults.edges.shapeFactory(
|
|
521
|
+
shape: e.shape ?? this.defaults.edges.shapeFactory(t),
|
|
522
522
|
priority: e.priority ?? this.defaults.edges.priorityFn()
|
|
523
523
|
}), this;
|
|
524
524
|
}
|
|
525
525
|
/**
|
|
526
526
|
* updates specified edge
|
|
527
527
|
*/
|
|
528
|
-
updateEdge(e,
|
|
528
|
+
updateEdge(e, t) {
|
|
529
529
|
if (this.graph.getEdge(e) === null)
|
|
530
530
|
throw new S("failed to update nonexistent edge");
|
|
531
|
-
return this.graphStore.updateEdge(e,
|
|
531
|
+
return this.graphStore.updateEdge(e, t ?? {}), this;
|
|
532
532
|
}
|
|
533
533
|
/**
|
|
534
534
|
* removes specified edge
|
|
@@ -571,37 +571,37 @@ class ce {
|
|
|
571
571
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
class
|
|
574
|
+
class Pe {
|
|
575
575
|
constructor() {
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
577
|
+
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
578
578
|
}
|
|
579
|
-
addRecord(e,
|
|
580
|
-
const
|
|
581
|
-
|
|
579
|
+
addRecord(e, t) {
|
|
580
|
+
const s = this.singleToMultiMap.get(e);
|
|
581
|
+
s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
|
|
582
582
|
}
|
|
583
583
|
getMultiBySingle(e) {
|
|
584
|
-
const
|
|
585
|
-
return Array.from(
|
|
584
|
+
const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
|
|
585
|
+
return Array.from(t.values());
|
|
586
586
|
}
|
|
587
587
|
removeByMulti(e) {
|
|
588
|
-
const
|
|
589
|
-
|
|
588
|
+
const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
|
|
589
|
+
s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
|
|
590
590
|
}
|
|
591
591
|
getByMulti(e) {
|
|
592
592
|
return this.multiToSingleMap.get(e);
|
|
593
593
|
}
|
|
594
594
|
removeBySingle(e) {
|
|
595
|
-
this.singleToMultiMap.get(e).forEach((
|
|
596
|
-
this.multiToSingleMap.delete(
|
|
595
|
+
this.singleToMultiMap.get(e).forEach((s) => {
|
|
596
|
+
this.multiToSingleMap.delete(s);
|
|
597
597
|
}), this.singleToMultiMap.delete(e);
|
|
598
598
|
}
|
|
599
599
|
clear() {
|
|
600
600
|
this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
|
|
601
601
|
}
|
|
602
602
|
forEachSingle(e) {
|
|
603
|
-
this.singleToMultiMap.forEach((
|
|
604
|
-
e(
|
|
603
|
+
this.singleToMultiMap.forEach((t, s) => {
|
|
604
|
+
e(s);
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
hasSingle(e) {
|
|
@@ -611,54 +611,54 @@ class De {
|
|
|
611
611
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
class
|
|
614
|
+
class de {
|
|
615
615
|
constructor() {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
616
|
+
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
617
|
+
o(this, "ports", /* @__PURE__ */ new Map());
|
|
618
|
+
o(this, "edges", /* @__PURE__ */ new Map());
|
|
619
|
+
o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
620
|
+
o(this, "incomingEdges", /* @__PURE__ */ new Map());
|
|
621
|
+
o(this, "outcomingEdges", /* @__PURE__ */ new Map());
|
|
622
|
+
o(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
623
|
+
o(this, "elementPorts", new Pe());
|
|
624
|
+
o(this, "afterNodeAddedEmitter");
|
|
625
|
+
o(this, "onAfterNodeAdded");
|
|
626
|
+
o(this, "afterNodeUpdatedEmitter");
|
|
627
|
+
o(this, "onAfterNodeUpdated");
|
|
628
|
+
o(this, "afterNodePriorityUpdatedEmitter");
|
|
629
|
+
o(this, "onAfterNodePriorityUpdated");
|
|
630
|
+
o(this, "beforeNodeRemovedEmitter");
|
|
631
|
+
o(this, "onBeforeNodeRemoved");
|
|
632
|
+
o(this, "afterPortAddedEmitter");
|
|
633
|
+
o(this, "onAfterPortAdded");
|
|
634
|
+
o(this, "afterPortUpdatedEmitter");
|
|
635
|
+
o(this, "onAfterPortUpdated");
|
|
636
|
+
o(this, "beforePortRemovedEmitter");
|
|
637
|
+
o(this, "onBeforePortRemoved");
|
|
638
|
+
o(this, "afterEdgeAddedEmitter");
|
|
639
|
+
o(this, "onAfterEdgeAdded");
|
|
640
|
+
o(this, "afterEdgeShapeUpdatedEmitter");
|
|
641
|
+
o(this, "onAfterEdgeShapeUpdated");
|
|
642
|
+
o(this, "afterEdgeUpdatedEmitter");
|
|
643
|
+
o(this, "onAfterEdgeUpdated");
|
|
644
|
+
o(this, "afterEdgePriorityUpdatedEmitter");
|
|
645
|
+
o(this, "onAfterEdgePriorityUpdated");
|
|
646
|
+
o(this, "beforeEdgeRemovedEmitter");
|
|
647
|
+
o(this, "onBeforeEdgeRemoved");
|
|
648
|
+
o(this, "beforeClearEmitter");
|
|
649
|
+
o(this, "onBeforeClear");
|
|
650
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
|
|
651
651
|
}
|
|
652
652
|
addNode(e) {
|
|
653
|
-
const
|
|
653
|
+
const t = /* @__PURE__ */ new Map(), s = {
|
|
654
654
|
element: e.element,
|
|
655
655
|
x: e.x,
|
|
656
656
|
y: e.y,
|
|
657
657
|
centerFn: e.centerFn,
|
|
658
658
|
priority: e.priority,
|
|
659
|
-
ports:
|
|
659
|
+
ports: t
|
|
660
660
|
};
|
|
661
|
-
this.nodes.set(e.id,
|
|
661
|
+
this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
|
|
662
662
|
}
|
|
663
663
|
getAllNodeIds() {
|
|
664
664
|
return Array.from(this.nodes.keys());
|
|
@@ -669,14 +669,14 @@ class ae {
|
|
|
669
669
|
getElementNodeId(e) {
|
|
670
670
|
return this.nodesElementsMap.get(e);
|
|
671
671
|
}
|
|
672
|
-
updateNode(e,
|
|
673
|
-
const
|
|
674
|
-
|
|
672
|
+
updateNode(e, t) {
|
|
673
|
+
const s = this.nodes.get(e);
|
|
674
|
+
s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
|
|
675
675
|
}
|
|
676
676
|
removeNode(e) {
|
|
677
677
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
678
|
-
const
|
|
679
|
-
this.nodesElementsMap.delete(
|
|
678
|
+
const t = this.nodes.get(e);
|
|
679
|
+
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
680
680
|
}
|
|
681
681
|
addPort(e) {
|
|
682
682
|
this.ports.set(e.id, {
|
|
@@ -688,9 +688,9 @@ class ae {
|
|
|
688
688
|
getPort(e) {
|
|
689
689
|
return this.ports.get(e);
|
|
690
690
|
}
|
|
691
|
-
updatePort(e,
|
|
692
|
-
const
|
|
693
|
-
|
|
691
|
+
updatePort(e, t) {
|
|
692
|
+
const s = this.ports.get(e);
|
|
693
|
+
s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
694
694
|
}
|
|
695
695
|
getAllPortIds() {
|
|
696
696
|
return Array.from(this.ports.keys());
|
|
@@ -699,30 +699,30 @@ class ae {
|
|
|
699
699
|
return this.elementPorts.getMultiBySingle(e);
|
|
700
700
|
}
|
|
701
701
|
getNodePortIds(e) {
|
|
702
|
-
const
|
|
703
|
-
if (
|
|
704
|
-
return Array.from(
|
|
702
|
+
const t = this.nodes.get(e);
|
|
703
|
+
if (t !== void 0)
|
|
704
|
+
return Array.from(t.ports.keys());
|
|
705
705
|
}
|
|
706
706
|
removePort(e) {
|
|
707
|
-
const
|
|
708
|
-
this.beforePortRemovedEmitter.emit(e), this.nodes.get(
|
|
707
|
+
const t = this.ports.get(e).nodeId;
|
|
708
|
+
this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
709
709
|
}
|
|
710
710
|
addEdge(e) {
|
|
711
711
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
712
712
|
}
|
|
713
|
-
updateEdge(e,
|
|
714
|
-
if (
|
|
715
|
-
const
|
|
713
|
+
updateEdge(e, t) {
|
|
714
|
+
if (t.from !== void 0 || t.to !== void 0) {
|
|
715
|
+
const i = this.edges.get(e);
|
|
716
716
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
717
717
|
id: e,
|
|
718
|
-
from:
|
|
719
|
-
to:
|
|
720
|
-
shape:
|
|
721
|
-
priority:
|
|
718
|
+
from: t.from ?? i.from,
|
|
719
|
+
to: t.to ?? i.to,
|
|
720
|
+
shape: i.shape,
|
|
721
|
+
priority: i.priority
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
|
-
const
|
|
725
|
-
|
|
724
|
+
const s = this.edges.get(e);
|
|
725
|
+
t.shape !== void 0 && (s.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
|
|
726
726
|
}
|
|
727
727
|
getAllEdgeIds() {
|
|
728
728
|
return Array.from(this.edges.keys());
|
|
@@ -753,25 +753,25 @@ class ae {
|
|
|
753
753
|
];
|
|
754
754
|
}
|
|
755
755
|
getNodeIncomingEdgeIds(e) {
|
|
756
|
-
const
|
|
757
|
-
let
|
|
758
|
-
return
|
|
759
|
-
|
|
760
|
-
}),
|
|
756
|
+
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
757
|
+
let s = [];
|
|
758
|
+
return t.forEach((i) => {
|
|
759
|
+
s = [...s, ...this.getPortIncomingEdgeIds(i)];
|
|
760
|
+
}), s;
|
|
761
761
|
}
|
|
762
762
|
getNodeOutcomingEdgeIds(e) {
|
|
763
|
-
const
|
|
764
|
-
let
|
|
765
|
-
return
|
|
766
|
-
|
|
767
|
-
}),
|
|
763
|
+
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
764
|
+
let s = [];
|
|
765
|
+
return t.forEach((i) => {
|
|
766
|
+
s = [...s, ...this.getPortOutcomingEdgeIds(i)];
|
|
767
|
+
}), s;
|
|
768
768
|
}
|
|
769
769
|
getNodeCycleEdgeIds(e) {
|
|
770
|
-
const
|
|
771
|
-
let
|
|
772
|
-
return
|
|
773
|
-
|
|
774
|
-
}),
|
|
770
|
+
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
771
|
+
let s = [];
|
|
772
|
+
return t.forEach((i) => {
|
|
773
|
+
s = [...s, ...this.getPortCycleEdgeIds(i)];
|
|
774
|
+
}), s;
|
|
775
775
|
}
|
|
776
776
|
getNodeAdjacentEdgeIds(e) {
|
|
777
777
|
return [
|
|
@@ -789,28 +789,28 @@ class ae {
|
|
|
789
789
|
}), e.from !== e.to ? (this.outcomingEdges.get(e.from).add(e.id), this.incomingEdges.get(e.to).add(e.id)) : this.cycleEdges.get(e.from).add(e.id);
|
|
790
790
|
}
|
|
791
791
|
removeEdgeInternal(e) {
|
|
792
|
-
const
|
|
793
|
-
this.cycleEdges.get(
|
|
792
|
+
const t = this.edges.get(e), s = t.from, i = t.to;
|
|
793
|
+
this.cycleEdges.get(s).delete(e), this.cycleEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.edges.delete(e);
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
|
-
const q = (
|
|
797
|
-
scale: 1 /
|
|
798
|
-
x: -
|
|
799
|
-
y: -
|
|
796
|
+
const q = (r) => ({
|
|
797
|
+
scale: 1 / r.scale,
|
|
798
|
+
x: -r.x / r.scale,
|
|
799
|
+
y: -r.y / r.scale
|
|
800
800
|
}), ee = {
|
|
801
801
|
scale: 1,
|
|
802
802
|
x: 0,
|
|
803
803
|
y: 0
|
|
804
804
|
};
|
|
805
|
-
class
|
|
805
|
+
class De {
|
|
806
806
|
constructor() {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
[this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
807
|
+
o(this, "viewportMatrix", ee);
|
|
808
|
+
o(this, "contentMatrix", ee);
|
|
809
|
+
o(this, "afterUpdateEmitter");
|
|
810
|
+
o(this, "onAfterUpdated");
|
|
811
|
+
o(this, "beforeUpdateEmitter");
|
|
812
|
+
o(this, "onBeforeUpdated");
|
|
813
|
+
[this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E();
|
|
814
814
|
}
|
|
815
815
|
getViewportMatrix() {
|
|
816
816
|
return this.viewportMatrix;
|
|
@@ -835,26 +835,26 @@ class Ne {
|
|
|
835
835
|
}
|
|
836
836
|
class k {
|
|
837
837
|
constructor(e) {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
const
|
|
842
|
-
this.elementToNodeId.set(
|
|
838
|
+
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
839
|
+
o(this, "nodesResizeObserver");
|
|
840
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
841
|
+
const t = this.canvas.graph.getNode(e);
|
|
842
|
+
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
843
843
|
});
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
this.elementToNodeId.delete(
|
|
844
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
845
|
+
const t = this.canvas.graph.getNode(e);
|
|
846
|
+
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
847
847
|
});
|
|
848
|
-
|
|
848
|
+
o(this, "onBeforeClear", () => {
|
|
849
849
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
850
850
|
});
|
|
851
|
-
|
|
851
|
+
o(this, "onBeforeDestroy", () => {
|
|
852
852
|
this.canvas.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
853
853
|
});
|
|
854
|
-
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
this.handleNodeResize(
|
|
854
|
+
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
855
|
+
t.forEach((s) => {
|
|
856
|
+
const i = s.target;
|
|
857
|
+
this.handleNodeResize(i);
|
|
858
858
|
});
|
|
859
859
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
860
860
|
}
|
|
@@ -862,91 +862,91 @@ class k {
|
|
|
862
862
|
new k(e);
|
|
863
863
|
}
|
|
864
864
|
handleNodeResize(e) {
|
|
865
|
-
const
|
|
866
|
-
this.canvas.updateNode(
|
|
865
|
+
const t = this.elementToNodeId.get(e);
|
|
866
|
+
this.canvas.updateNode(t);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
const
|
|
870
|
-
var v,
|
|
871
|
-
const e = ((v =
|
|
872
|
-
}),
|
|
873
|
-
}),
|
|
869
|
+
const Ne = (r) => {
|
|
870
|
+
var v, p, f, A, m, x;
|
|
871
|
+
const e = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
|
|
872
|
+
}), t = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onBeforeNodeDrag) ?? (() => !0), s = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
|
|
873
|
+
}), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.dragCursor, a = h !== void 0 ? h : "grab", d = (m = r == null ? void 0 : r.mouse) == null ? void 0 : m.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (x = r == null ? void 0 : r.mouse) == null ? void 0 : x.mouseUpEventVerifier;
|
|
874
874
|
return {
|
|
875
|
-
moveOnTop:
|
|
876
|
-
moveEdgesOnTop:
|
|
877
|
-
dragCursor:
|
|
878
|
-
mouseDownEventVerifier:
|
|
879
|
-
mouseUpEventVerifier:
|
|
875
|
+
moveOnTop: i,
|
|
876
|
+
moveEdgesOnTop: n,
|
|
877
|
+
dragCursor: a,
|
|
878
|
+
mouseDownEventVerifier: c,
|
|
879
|
+
mouseUpEventVerifier: g !== void 0 ? g : (b) => b.button === 0,
|
|
880
880
|
onNodeDrag: e,
|
|
881
|
-
onBeforeNodeDrag:
|
|
882
|
-
onNodeDragFinished:
|
|
881
|
+
onBeforeNodeDrag: t,
|
|
882
|
+
onNodeDragFinished: s
|
|
883
883
|
};
|
|
884
|
-
}, Me = (
|
|
885
|
-
const { x:
|
|
886
|
-
return e >=
|
|
887
|
-
}, Le = (
|
|
888
|
-
e !== null ?
|
|
884
|
+
}, Me = (r, e, t) => {
|
|
885
|
+
const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
|
|
886
|
+
return e >= s && e <= s + n && t >= i && t <= i + h;
|
|
887
|
+
}, Le = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Me(e, t, s) && Le(r, t, s), B = (r, e) => {
|
|
888
|
+
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
889
889
|
};
|
|
890
890
|
class z {
|
|
891
|
-
constructor(e,
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
891
|
+
constructor(e, t, s, i) {
|
|
892
|
+
o(this, "grabbedNodeId", null);
|
|
893
|
+
o(this, "maxNodePriority", 0);
|
|
894
|
+
o(this, "previousTouchCoordinates", null);
|
|
895
|
+
o(this, "graph");
|
|
896
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
897
897
|
this.updateMaxNodePriority(e);
|
|
898
|
-
const
|
|
899
|
-
|
|
898
|
+
const t = this.graph.getNode(e);
|
|
899
|
+
t.element.addEventListener("mousedown", this.onMouseDown, {
|
|
900
900
|
passive: !0
|
|
901
|
-
}),
|
|
901
|
+
}), t.element.addEventListener("touchstart", this.onTouchStart, {
|
|
902
902
|
passive: !0
|
|
903
903
|
});
|
|
904
904
|
});
|
|
905
|
-
|
|
905
|
+
o(this, "onAfterNodeUpdated", (e) => {
|
|
906
906
|
this.updateMaxNodePriority(e);
|
|
907
907
|
});
|
|
908
|
-
|
|
909
|
-
const
|
|
910
|
-
|
|
908
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
909
|
+
const t = this.graph.getNode(e);
|
|
910
|
+
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
911
911
|
});
|
|
912
|
-
|
|
912
|
+
o(this, "onBeforeDestroy", () => {
|
|
913
913
|
this.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy), this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
914
914
|
});
|
|
915
|
-
|
|
915
|
+
o(this, "onBeforeClear", () => {
|
|
916
916
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
917
|
-
const
|
|
918
|
-
|
|
917
|
+
const t = this.canvas.graph.getNode(e);
|
|
918
|
+
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
919
919
|
}), this.maxNodePriority = 0;
|
|
920
920
|
});
|
|
921
|
-
|
|
921
|
+
o(this, "onMouseDown", (e) => {
|
|
922
922
|
if (!this.config.mouseDownEventVerifier(e))
|
|
923
923
|
return;
|
|
924
|
-
const
|
|
924
|
+
const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
|
|
925
925
|
this.config.onBeforeNodeDrag({
|
|
926
|
-
nodeId:
|
|
927
|
-
element:
|
|
928
|
-
x:
|
|
929
|
-
y:
|
|
930
|
-
}) && (e.stopImmediatePropagation(), this.grabbedNodeId =
|
|
926
|
+
nodeId: s,
|
|
927
|
+
element: i.element,
|
|
928
|
+
x: i.x,
|
|
929
|
+
y: i.y
|
|
930
|
+
}) && (e.stopImmediatePropagation(), this.grabbedNodeId = s, B(this.element, this.config.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
931
931
|
passive: !0
|
|
932
932
|
}), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
933
933
|
passive: !0
|
|
934
934
|
}));
|
|
935
935
|
});
|
|
936
|
-
|
|
936
|
+
o(this, "onTouchStart", (e) => {
|
|
937
937
|
if (e.touches.length !== 1)
|
|
938
938
|
return;
|
|
939
939
|
e.stopImmediatePropagation(), this.previousTouchCoordinates = {
|
|
940
940
|
x: e.touches[0].clientX,
|
|
941
941
|
y: e.touches[0].clientY
|
|
942
942
|
};
|
|
943
|
-
const
|
|
943
|
+
const t = e.currentTarget, s = this.canvas.graph.getElementNodeId(t), i = this.graph.getNode(s);
|
|
944
944
|
this.config.onBeforeNodeDrag({
|
|
945
|
-
nodeId:
|
|
946
|
-
element:
|
|
947
|
-
x:
|
|
948
|
-
y:
|
|
949
|
-
}) && (this.grabbedNodeId =
|
|
945
|
+
nodeId: s,
|
|
946
|
+
element: i.element,
|
|
947
|
+
x: i.x,
|
|
948
|
+
y: i.y
|
|
949
|
+
}) && (this.grabbedNodeId = s, this.moveNodeOnTop(s), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
950
950
|
passive: !0
|
|
951
951
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
952
952
|
passive: !0
|
|
@@ -954,8 +954,8 @@ class z {
|
|
|
954
954
|
passive: !0
|
|
955
955
|
}));
|
|
956
956
|
});
|
|
957
|
-
|
|
958
|
-
if (!
|
|
957
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
958
|
+
if (!N(
|
|
959
959
|
this.window,
|
|
960
960
|
this.element,
|
|
961
961
|
e.clientX,
|
|
@@ -966,63 +966,63 @@ class z {
|
|
|
966
966
|
}
|
|
967
967
|
this.grabbedNodeId !== null && this.dragNode(this.grabbedNodeId, e.movementX, e.movementY);
|
|
968
968
|
});
|
|
969
|
-
|
|
969
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
970
970
|
this.config.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
971
971
|
});
|
|
972
|
-
|
|
972
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
973
973
|
if (e.touches.length !== 1)
|
|
974
974
|
return;
|
|
975
|
-
const
|
|
976
|
-
if (!
|
|
975
|
+
const t = e.touches[0];
|
|
976
|
+
if (!N(
|
|
977
977
|
this.window,
|
|
978
978
|
this.element,
|
|
979
|
-
|
|
980
|
-
|
|
979
|
+
t.clientX,
|
|
980
|
+
t.clientY
|
|
981
981
|
)) {
|
|
982
982
|
this.cancelTouchDrag();
|
|
983
983
|
return;
|
|
984
984
|
}
|
|
985
985
|
if (this.grabbedNodeId !== null && this.previousTouchCoordinates !== null) {
|
|
986
|
-
const
|
|
987
|
-
this.dragNode(this.grabbedNodeId,
|
|
986
|
+
const i = t.clientX - this.previousTouchCoordinates.x, n = t.clientY - this.previousTouchCoordinates.y;
|
|
987
|
+
this.dragNode(this.grabbedNodeId, i, n), this.previousTouchCoordinates = {
|
|
988
988
|
x: e.touches[0].clientX,
|
|
989
989
|
y: e.touches[0].clientY
|
|
990
990
|
};
|
|
991
991
|
}
|
|
992
992
|
});
|
|
993
|
-
|
|
993
|
+
o(this, "onWindowTouchFinish", () => {
|
|
994
994
|
this.previousTouchCoordinates = null, this.cancelTouchDrag();
|
|
995
995
|
});
|
|
996
|
-
|
|
997
|
-
this.canvas = e, this.element =
|
|
996
|
+
o(this, "config");
|
|
997
|
+
this.canvas = e, this.element = t, this.window = s, this.config = Ne(i), this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
998
998
|
}
|
|
999
|
-
static configure(e,
|
|
1000
|
-
new z(e,
|
|
999
|
+
static configure(e, t, s, i) {
|
|
1000
|
+
new z(e, t, s, i);
|
|
1001
1001
|
}
|
|
1002
|
-
dragNode(e,
|
|
1003
|
-
const
|
|
1004
|
-
if (
|
|
1002
|
+
dragNode(e, t, s) {
|
|
1003
|
+
const i = this.graph.getNode(e);
|
|
1004
|
+
if (i === null)
|
|
1005
1005
|
return;
|
|
1006
|
-
const
|
|
1007
|
-
x:
|
|
1008
|
-
y:
|
|
1009
|
-
}),
|
|
1010
|
-
{ scale: 1, x:
|
|
1011
|
-
|
|
1012
|
-
),
|
|
1013
|
-
this.canvas.updateNode(e, { x:
|
|
1006
|
+
const n = this.canvas.viewport.getContentMatrix(), h = D(n, {
|
|
1007
|
+
x: i.x,
|
|
1008
|
+
y: i.y
|
|
1009
|
+
}), a = D(
|
|
1010
|
+
{ scale: 1, x: t, y: s },
|
|
1011
|
+
h
|
|
1012
|
+
), d = this.canvas.viewport.getViewportMatrix(), c = D(d, a);
|
|
1013
|
+
this.canvas.updateNode(e, { x: c.x, y: c.y }), this.config.onNodeDrag({
|
|
1014
1014
|
nodeId: e,
|
|
1015
|
-
element:
|
|
1016
|
-
x:
|
|
1017
|
-
y:
|
|
1015
|
+
element: i.element,
|
|
1016
|
+
x: c.x,
|
|
1017
|
+
y: c.y
|
|
1018
1018
|
});
|
|
1019
1019
|
}
|
|
1020
1020
|
moveNodeOnTop(e) {
|
|
1021
1021
|
if (this.config.moveOnTop) {
|
|
1022
1022
|
if (this.maxNodePriority++, this.config.moveEdgesOnTop) {
|
|
1023
|
-
const
|
|
1024
|
-
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((
|
|
1025
|
-
this.canvas.updateEdge(
|
|
1023
|
+
const t = this.maxNodePriority;
|
|
1024
|
+
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
|
|
1025
|
+
this.canvas.updateEdge(i, { priority: t });
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
@@ -1054,166 +1054,166 @@ class z {
|
|
|
1054
1054
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
1055
1055
|
}
|
|
1056
1056
|
updateMaxNodePriority(e) {
|
|
1057
|
-
const
|
|
1058
|
-
this.maxNodePriority = Math.max(this.maxNodePriority,
|
|
1057
|
+
const t = this.graph.getNode(e).priority;
|
|
1058
|
+
this.maxNodePriority = Math.max(this.maxNodePriority, t);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
const Re = (
|
|
1062
|
-
const e =
|
|
1063
|
-
return (
|
|
1064
|
-
let
|
|
1065
|
-
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
const
|
|
1069
|
-
return
|
|
1061
|
+
const Re = (r) => {
|
|
1062
|
+
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
1063
|
+
return (n) => {
|
|
1064
|
+
let h = n.nextTransform.x, a = n.nextTransform.y;
|
|
1065
|
+
h < e && h < n.prevTransform.x && (h = Math.min(n.prevTransform.x, e));
|
|
1066
|
+
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
1067
|
+
h > c && h > n.prevTransform.x && (h = Math.max(n.prevTransform.x, c)), a < s && a < n.prevTransform.y && (a = Math.min(n.prevTransform.y, s));
|
|
1068
|
+
const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
|
|
1069
|
+
return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
|
|
1070
1070
|
};
|
|
1071
|
-
}, Ie = (
|
|
1072
|
-
const e =
|
|
1073
|
-
return (
|
|
1074
|
-
const
|
|
1075
|
-
let
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1071
|
+
}, Ie = (r) => {
|
|
1072
|
+
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
1073
|
+
return (n) => {
|
|
1074
|
+
const h = n.prevTransform, a = n.nextTransform;
|
|
1075
|
+
let d = a.scale, c = a.x, g = a.y;
|
|
1076
|
+
if (a.scale > i && a.scale > h.scale) {
|
|
1077
|
+
d = Math.max(h.scale, i), c = h.x, g = h.y;
|
|
1078
|
+
const l = (d - h.scale) / (a.scale - h.scale);
|
|
1079
|
+
c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
|
|
1080
1080
|
}
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1081
|
+
if (a.scale < s && a.scale < h.scale) {
|
|
1082
|
+
d = Math.min(h.scale, s), c = h.x, g = h.y;
|
|
1083
|
+
const l = (d - h.scale) / (a.scale - h.scale);
|
|
1084
|
+
c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
|
|
1085
1085
|
}
|
|
1086
1086
|
return {
|
|
1087
|
-
scale:
|
|
1088
|
-
x:
|
|
1089
|
-
y:
|
|
1087
|
+
scale: d,
|
|
1088
|
+
x: c,
|
|
1089
|
+
y: g
|
|
1090
1090
|
};
|
|
1091
1091
|
};
|
|
1092
|
-
}, Be = (
|
|
1093
|
-
(
|
|
1092
|
+
}, Be = (r) => (e) => r.reduce(
|
|
1093
|
+
(t, s) => s({
|
|
1094
1094
|
prevTransform: e.prevTransform,
|
|
1095
|
-
nextTransform:
|
|
1095
|
+
nextTransform: t,
|
|
1096
1096
|
canvasWidth: e.canvasWidth,
|
|
1097
1097
|
canvasHeight: e.canvasHeight
|
|
1098
1098
|
}),
|
|
1099
1099
|
e.nextTransform
|
|
1100
|
-
), te = (
|
|
1101
|
-
if (typeof
|
|
1102
|
-
return
|
|
1103
|
-
switch (
|
|
1100
|
+
), te = (r) => {
|
|
1101
|
+
if (typeof r == "function")
|
|
1102
|
+
return r;
|
|
1103
|
+
switch (r.type) {
|
|
1104
1104
|
case "scale-limit":
|
|
1105
1105
|
return Ie({
|
|
1106
|
-
minContentScale:
|
|
1107
|
-
maxContentScale:
|
|
1106
|
+
minContentScale: r.minContentScale ?? 0,
|
|
1107
|
+
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
1108
1108
|
});
|
|
1109
1109
|
case "shift-limit":
|
|
1110
1110
|
return Re({
|
|
1111
|
-
minX:
|
|
1112
|
-
maxX:
|
|
1113
|
-
minY:
|
|
1114
|
-
maxY:
|
|
1111
|
+
minX: r.minX ?? -1 / 0,
|
|
1112
|
+
maxX: r.maxX ?? 1 / 0,
|
|
1113
|
+
minY: r.minY ?? -1 / 0,
|
|
1114
|
+
maxY: r.maxY ?? 1 / 0
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
|
-
}, Ve = (
|
|
1118
|
-
var
|
|
1119
|
-
const e = (
|
|
1120
|
-
let
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
(
|
|
1117
|
+
}, Ve = (r) => {
|
|
1118
|
+
var f, A, m, x, b, T, M, L, J, K, Q, _;
|
|
1119
|
+
const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
1120
|
+
let i;
|
|
1121
|
+
s !== void 0 ? Array.isArray(s) ? i = Be(
|
|
1122
|
+
s.map(
|
|
1123
|
+
(P) => te(P)
|
|
1124
1124
|
)
|
|
1125
|
-
) :
|
|
1126
|
-
const
|
|
1127
|
-
}),
|
|
1128
|
-
}),
|
|
1125
|
+
) : i = te(s) : i = (P) => P.nextTransform;
|
|
1126
|
+
const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
|
|
1127
|
+
}), a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
1128
|
+
}), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, v = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, p = v !== void 0 ? v : () => !0;
|
|
1129
1129
|
return {
|
|
1130
|
-
wheelSensitivity:
|
|
1131
|
-
onTransformStarted: ((L =
|
|
1130
|
+
wheelSensitivity: t,
|
|
1131
|
+
onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
|
|
1132
1132
|
}),
|
|
1133
|
-
onTransformFinished: ((J =
|
|
1133
|
+
onTransformFinished: ((J = r == null ? void 0 : r.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
|
|
1134
1134
|
}),
|
|
1135
|
-
onBeforeTransformChange:
|
|
1136
|
-
onTransformChange:
|
|
1137
|
-
transformPreprocessor:
|
|
1138
|
-
shiftCursor:
|
|
1139
|
-
mouseDownEventVerifier:
|
|
1140
|
-
mouseUpEventVerifier:
|
|
1141
|
-
mouseWheelEventVerifier:
|
|
1142
|
-
scaleWheelFinishTimeout: ((K =
|
|
1143
|
-
onResizeTransformStarted: ((Q =
|
|
1135
|
+
onBeforeTransformChange: h,
|
|
1136
|
+
onTransformChange: a,
|
|
1137
|
+
transformPreprocessor: i,
|
|
1138
|
+
shiftCursor: n,
|
|
1139
|
+
mouseDownEventVerifier: c,
|
|
1140
|
+
mouseUpEventVerifier: l,
|
|
1141
|
+
mouseWheelEventVerifier: p,
|
|
1142
|
+
scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
|
|
1143
|
+
onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
|
|
1144
1144
|
}),
|
|
1145
|
-
onResizeTransformFinished: ((_ =
|
|
1145
|
+
onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
|
|
1146
1146
|
})
|
|
1147
1147
|
};
|
|
1148
|
-
},
|
|
1149
|
-
scale:
|
|
1150
|
-
x:
|
|
1151
|
-
y:
|
|
1152
|
-
}),
|
|
1153
|
-
scale:
|
|
1154
|
-
x:
|
|
1155
|
-
y:
|
|
1156
|
-
}), I = (
|
|
1157
|
-
const e = [],
|
|
1158
|
-
for (let
|
|
1159
|
-
e.push([
|
|
1160
|
-
const
|
|
1161
|
-
(
|
|
1148
|
+
}, Ce = (r, e, t) => ({
|
|
1149
|
+
scale: r.scale,
|
|
1150
|
+
x: r.x + r.scale * e,
|
|
1151
|
+
y: r.y + r.scale * t
|
|
1152
|
+
}), Ue = (r, e, t, s) => ({
|
|
1153
|
+
scale: r.scale * e,
|
|
1154
|
+
x: r.scale * (1 - e) * t + r.x,
|
|
1155
|
+
y: r.scale * (1 - e) * s + r.y
|
|
1156
|
+
}), I = (r) => {
|
|
1157
|
+
const e = [], t = r.touches.length;
|
|
1158
|
+
for (let a = 0; a < t; a++)
|
|
1159
|
+
e.push([r.touches[a].clientX, r.touches[a].clientY]);
|
|
1160
|
+
const s = e.reduce(
|
|
1161
|
+
(a, d) => [a[0] + d[0], a[1] + d[1]],
|
|
1162
1162
|
[0, 0]
|
|
1163
|
-
),
|
|
1164
|
-
(
|
|
1163
|
+
), i = [s[0] / t, s[1] / t], h = e.map((a) => [a[0] - i[0], a[1] - i[1]]).reduce(
|
|
1164
|
+
(a, d) => a + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
1165
1165
|
0
|
|
1166
1166
|
);
|
|
1167
1167
|
return {
|
|
1168
|
-
x:
|
|
1169
|
-
y:
|
|
1170
|
-
scale:
|
|
1171
|
-
touchesCnt:
|
|
1168
|
+
x: i[0],
|
|
1169
|
+
y: i[1],
|
|
1170
|
+
scale: h / t,
|
|
1171
|
+
touchesCnt: t,
|
|
1172
1172
|
touches: e
|
|
1173
1173
|
};
|
|
1174
1174
|
};
|
|
1175
|
-
class
|
|
1176
|
-
constructor(e,
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1175
|
+
class C {
|
|
1176
|
+
constructor(e, t, s, i) {
|
|
1177
|
+
o(this, "viewport");
|
|
1178
|
+
o(this, "prevTouches", null);
|
|
1179
|
+
o(this, "wheelFinishTimer", null);
|
|
1180
|
+
o(this, "transformInProgress", !1);
|
|
1181
|
+
o(this, "onBeforeDestroy", () => {
|
|
1182
1182
|
this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.element.removeEventListener("wheel", this.preventWheelScaleListener), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1183
1183
|
});
|
|
1184
|
-
|
|
1184
|
+
o(this, "onMouseDown", (e) => {
|
|
1185
1185
|
this.element === null || !this.config.mouseDownEventVerifier(e) || (B(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1186
1186
|
passive: !0
|
|
1187
1187
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1188
1188
|
passive: !0
|
|
1189
1189
|
}), this.startRegisteredTransform());
|
|
1190
1190
|
});
|
|
1191
|
-
|
|
1192
|
-
const
|
|
1191
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
1192
|
+
const t = N(
|
|
1193
1193
|
this.window,
|
|
1194
1194
|
this.element,
|
|
1195
1195
|
e.clientX,
|
|
1196
1196
|
e.clientY
|
|
1197
1197
|
);
|
|
1198
|
-
if (this.element === null || !
|
|
1198
|
+
if (this.element === null || !t) {
|
|
1199
1199
|
this.stopMouseDrag();
|
|
1200
1200
|
return;
|
|
1201
1201
|
}
|
|
1202
|
-
const
|
|
1203
|
-
this.moveViewport(
|
|
1202
|
+
const s = -e.movementX, i = -e.movementY;
|
|
1203
|
+
this.moveViewport(s, i);
|
|
1204
1204
|
});
|
|
1205
|
-
|
|
1205
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
1206
1206
|
this.element === null || !this.config.mouseUpEventVerifier(e) || this.stopMouseDrag();
|
|
1207
1207
|
});
|
|
1208
|
-
|
|
1208
|
+
o(this, "onWheelScroll", (e) => {
|
|
1209
1209
|
if (!this.config.mouseWheelEventVerifier(e))
|
|
1210
1210
|
return;
|
|
1211
|
-
const { left:
|
|
1212
|
-
this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(
|
|
1211
|
+
const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, a = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
|
|
1212
|
+
this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(a, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
1213
1213
|
this.transformInProgress || this.config.onTransformFinished(), this.wheelFinishTimer = null;
|
|
1214
1214
|
}, this.config.scaleWheelFinishTimeout);
|
|
1215
1215
|
});
|
|
1216
|
-
|
|
1216
|
+
o(this, "onTouchStart", (e) => {
|
|
1217
1217
|
if (this.prevTouches !== null) {
|
|
1218
1218
|
this.prevTouches = I(e);
|
|
1219
1219
|
return;
|
|
@@ -1226,42 +1226,42 @@ class U {
|
|
|
1226
1226
|
passive: !0
|
|
1227
1227
|
}), this.startRegisteredTransform();
|
|
1228
1228
|
});
|
|
1229
|
-
|
|
1230
|
-
const
|
|
1231
|
-
if (!
|
|
1232
|
-
(
|
|
1229
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
1230
|
+
const t = I(e);
|
|
1231
|
+
if (!t.touches.every(
|
|
1232
|
+
(i) => N(this.window, this.element, i[0], i[1])
|
|
1233
1233
|
)) {
|
|
1234
1234
|
this.stopTouchDrag();
|
|
1235
1235
|
return;
|
|
1236
1236
|
}
|
|
1237
|
-
if ((
|
|
1238
|
-
-(
|
|
1239
|
-
-(
|
|
1240
|
-
),
|
|
1241
|
-
const { left:
|
|
1242
|
-
this.scaleViewport(
|
|
1237
|
+
if ((t.touchesCnt === 1 || t.touchesCnt === 2) && this.moveViewport(
|
|
1238
|
+
-(t.x - this.prevTouches.x),
|
|
1239
|
+
-(t.y - this.prevTouches.y)
|
|
1240
|
+
), t.touchesCnt === 2) {
|
|
1241
|
+
const { left: i, top: n } = this.element.getBoundingClientRect(), h = this.prevTouches.x - i, a = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
|
|
1242
|
+
this.scaleViewport(c, h, a);
|
|
1243
1243
|
}
|
|
1244
|
-
this.prevTouches =
|
|
1244
|
+
this.prevTouches = t;
|
|
1245
1245
|
});
|
|
1246
|
-
|
|
1246
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
1247
1247
|
e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
|
|
1248
1248
|
});
|
|
1249
|
-
|
|
1250
|
-
const e = this.viewport.getViewportMatrix(), { width:
|
|
1249
|
+
o(this, "observer", new ResizeObserver(() => {
|
|
1250
|
+
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.config.transformPreprocessor({
|
|
1251
1251
|
prevTransform: e,
|
|
1252
1252
|
nextTransform: e,
|
|
1253
|
-
canvasWidth:
|
|
1254
|
-
canvasHeight:
|
|
1253
|
+
canvasWidth: t,
|
|
1254
|
+
canvasHeight: s
|
|
1255
1255
|
});
|
|
1256
|
-
this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(
|
|
1256
|
+
this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.config.onResizeTransformFinished();
|
|
1257
1257
|
}));
|
|
1258
|
-
|
|
1259
|
-
|
|
1258
|
+
o(this, "config");
|
|
1259
|
+
o(this, "preventWheelScaleListener", (e) => {
|
|
1260
1260
|
e.preventDefault();
|
|
1261
1261
|
});
|
|
1262
|
-
this.canvas = e, this.element =
|
|
1262
|
+
this.canvas = e, this.element = t, this.window = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
1263
1263
|
passive: !1
|
|
1264
|
-
}), this.config = Ve(
|
|
1264
|
+
}), this.config = Ve(i), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
1265
1265
|
passive: !0
|
|
1266
1266
|
}), this.element.addEventListener("wheel", this.onWheelScroll, {
|
|
1267
1267
|
passive: !0
|
|
@@ -1269,32 +1269,32 @@ class U {
|
|
|
1269
1269
|
passive: !0
|
|
1270
1270
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1271
1271
|
}
|
|
1272
|
-
static configure(e,
|
|
1273
|
-
new
|
|
1272
|
+
static configure(e, t, s, i) {
|
|
1273
|
+
new C(
|
|
1274
1274
|
e,
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1275
|
+
t,
|
|
1276
|
+
s,
|
|
1277
|
+
i
|
|
1278
1278
|
);
|
|
1279
1279
|
}
|
|
1280
|
-
moveViewport(e,
|
|
1281
|
-
const
|
|
1280
|
+
moveViewport(e, t) {
|
|
1281
|
+
const s = this.viewport.getViewportMatrix(), i = Ce(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.config.transformPreprocessor({
|
|
1282
|
+
prevTransform: s,
|
|
1283
|
+
nextTransform: i,
|
|
1284
|
+
canvasWidth: n,
|
|
1285
|
+
canvasHeight: h
|
|
1286
|
+
});
|
|
1287
|
+
this.performTransform(a);
|
|
1288
|
+
}
|
|
1289
|
+
scaleViewport(e, t, s) {
|
|
1290
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = Ue(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
|
|
1282
1291
|
prevTransform: i,
|
|
1283
|
-
nextTransform:
|
|
1292
|
+
nextTransform: n,
|
|
1284
1293
|
canvasWidth: h,
|
|
1285
|
-
canvasHeight:
|
|
1294
|
+
canvasHeight: a
|
|
1286
1295
|
});
|
|
1287
1296
|
this.performTransform(d);
|
|
1288
1297
|
}
|
|
1289
|
-
scaleViewport(e, o, i) {
|
|
1290
|
-
const s = this.canvas.viewport.getViewportMatrix(), h = Ce(s, e, o, i), { width: n, height: d } = this.element.getBoundingClientRect(), c = this.config.transformPreprocessor({
|
|
1291
|
-
prevTransform: s,
|
|
1292
|
-
nextTransform: h,
|
|
1293
|
-
canvasWidth: n,
|
|
1294
|
-
canvasHeight: d
|
|
1295
|
-
});
|
|
1296
|
-
this.performTransform(c);
|
|
1297
|
-
}
|
|
1298
1298
|
stopMouseDrag() {
|
|
1299
1299
|
B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
1300
1300
|
}
|
|
@@ -1318,21 +1318,21 @@ class U {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
1320
|
class X {
|
|
1321
|
-
constructor(e,
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1321
|
+
constructor(e, t, s, i, n, h) {
|
|
1322
|
+
o(this, "canvasResizeObserver");
|
|
1323
|
+
o(this, "nodeHorizontal");
|
|
1324
|
+
o(this, "nodeVertical");
|
|
1325
|
+
o(this, "viewport");
|
|
1326
|
+
o(this, "viewportWidth", 0);
|
|
1327
|
+
o(this, "viewportHeight", 0);
|
|
1328
|
+
o(this, "viewportMatrix");
|
|
1329
|
+
o(this, "loadedArea", {
|
|
1330
1330
|
xFrom: 1 / 0,
|
|
1331
1331
|
xTo: 1 / 0,
|
|
1332
1332
|
yFrom: 1 / 0,
|
|
1333
1333
|
yTo: 1 / 0
|
|
1334
1334
|
});
|
|
1335
|
-
|
|
1335
|
+
o(this, "updateLoadedArea", (e) => {
|
|
1336
1336
|
this.loadedArea = {
|
|
1337
1337
|
xFrom: e.x,
|
|
1338
1338
|
xTo: e.x + e.width,
|
|
@@ -1340,63 +1340,63 @@ class X {
|
|
|
1340
1340
|
yTo: e.y + e.height
|
|
1341
1341
|
};
|
|
1342
1342
|
});
|
|
1343
|
-
|
|
1343
|
+
o(this, "onBeforeDestroy", () => {
|
|
1344
1344
|
this.trigger.unsubscribe(this.updateLoadedArea), this.canvasResizeObserver.unobserve(this.element), this.canvas.viewport.onAfterUpdated.unsubscribe(
|
|
1345
1345
|
this.onAfterViewportUpdated
|
|
1346
1346
|
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1347
1347
|
});
|
|
1348
|
-
|
|
1348
|
+
o(this, "onAfterViewportUpdated", () => {
|
|
1349
1349
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
1350
1350
|
});
|
|
1351
|
-
|
|
1352
|
-
var
|
|
1353
|
-
this.canvas = e, this.element =
|
|
1354
|
-
const
|
|
1355
|
-
this.viewportWidth =
|
|
1351
|
+
o(this, "userTransformInProgress", !1);
|
|
1352
|
+
var p, f, A, m, x;
|
|
1353
|
+
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.virtualScrollOptions = h, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((b) => {
|
|
1354
|
+
const T = b[0];
|
|
1355
|
+
this.viewportWidth = T.contentRect.width, this.viewportHeight = T.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
1356
1356
|
}), this.viewport = e.viewport;
|
|
1357
|
-
const
|
|
1358
|
-
}),
|
|
1359
|
-
}),
|
|
1360
|
-
}),
|
|
1361
|
-
}),
|
|
1357
|
+
const a = ((p = i == null ? void 0 : i.events) == null ? void 0 : p.onResizeTransformStarted) ?? (() => {
|
|
1358
|
+
}), d = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.onResizeTransformFinished) ?? (() => {
|
|
1359
|
+
}), c = ((A = i == null ? void 0 : i.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
1360
|
+
}), g = ((m = i == null ? void 0 : i.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
|
|
1361
|
+
}), l = ((x = i == null ? void 0 : i.events) == null ? void 0 : x.onTransformFinished) ?? (() => {
|
|
1362
1362
|
}), v = {
|
|
1363
|
-
...
|
|
1363
|
+
...i,
|
|
1364
1364
|
events: {
|
|
1365
|
-
...
|
|
1365
|
+
...i == null ? void 0 : i.events,
|
|
1366
1366
|
onResizeTransformStarted: () => {
|
|
1367
|
-
this.userTransformInProgress = !0,
|
|
1367
|
+
this.userTransformInProgress = !0, a();
|
|
1368
1368
|
},
|
|
1369
1369
|
onResizeTransformFinished: () => {
|
|
1370
|
-
this.userTransformInProgress = !1,
|
|
1370
|
+
this.userTransformInProgress = !1, d();
|
|
1371
1371
|
},
|
|
1372
1372
|
onBeforeTransformChange: () => {
|
|
1373
|
-
this.userTransformInProgress = !0,
|
|
1373
|
+
this.userTransformInProgress = !0, g();
|
|
1374
1374
|
},
|
|
1375
1375
|
onTransformChange: () => {
|
|
1376
1376
|
this.userTransformInProgress = !1;
|
|
1377
|
-
const
|
|
1378
|
-
this.viewportMatrix = this.viewport.getViewportMatrix(),
|
|
1377
|
+
const b = this.viewportMatrix;
|
|
1378
|
+
this.viewportMatrix = this.viewport.getViewportMatrix(), b.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), c();
|
|
1379
1379
|
},
|
|
1380
1380
|
onTransformFinished: () => {
|
|
1381
|
-
this.scheduleLoadAreaAroundViewport(),
|
|
1381
|
+
this.scheduleLoadAreaAroundViewport(), l();
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
};
|
|
1385
|
-
|
|
1385
|
+
C.configure(
|
|
1386
1386
|
e,
|
|
1387
1387
|
this.element,
|
|
1388
1388
|
this.window,
|
|
1389
1389
|
v
|
|
1390
1390
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1391
1391
|
}
|
|
1392
|
-
static configure(e,
|
|
1392
|
+
static configure(e, t, s, i, n, h) {
|
|
1393
1393
|
new X(
|
|
1394
1394
|
e,
|
|
1395
|
-
|
|
1396
|
-
i,
|
|
1395
|
+
t,
|
|
1397
1396
|
s,
|
|
1398
|
-
|
|
1399
|
-
n
|
|
1397
|
+
i,
|
|
1398
|
+
n,
|
|
1399
|
+
h
|
|
1400
1400
|
);
|
|
1401
1401
|
}
|
|
1402
1402
|
scheduleLoadAreaAroundViewport() {
|
|
@@ -1405,130 +1405,130 @@ class X {
|
|
|
1405
1405
|
});
|
|
1406
1406
|
}
|
|
1407
1407
|
scheduleEnsureViewportAreaLoaded() {
|
|
1408
|
-
const e = this.viewportWidth * this.viewportMatrix.scale,
|
|
1409
|
-
this.loadedArea.xFrom <
|
|
1408
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, h = this.viewportMatrix.y + t + this.nodeVertical;
|
|
1409
|
+
this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > h || this.scheduleLoadAreaAroundViewport();
|
|
1410
1410
|
}
|
|
1411
1411
|
loadAreaAroundViewport() {
|
|
1412
|
-
const e = this.viewportWidth * this.viewportMatrix.scale,
|
|
1413
|
-
this.trigger.emit({ x:
|
|
1412
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, i = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, h = 3 * t + 2 * this.nodeVertical;
|
|
1413
|
+
this.trigger.emit({ x: s, y: i, width: n, height: h });
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
|
-
const
|
|
1417
|
-
const
|
|
1418
|
-
return
|
|
1419
|
-
},
|
|
1420
|
-
const
|
|
1421
|
-
return
|
|
1416
|
+
const $e = () => {
|
|
1417
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1418
|
+
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
1419
|
+
}, We = () => {
|
|
1420
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1421
|
+
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
1422
1422
|
}, Fe = () => {
|
|
1423
|
-
const
|
|
1423
|
+
const r = document.createElementNS(
|
|
1424
1424
|
"http://www.w3.org/2000/svg",
|
|
1425
1425
|
"pattern"
|
|
1426
1426
|
);
|
|
1427
|
-
return
|
|
1428
|
-
}, Oe = (
|
|
1429
|
-
const
|
|
1427
|
+
return r.setAttribute("id", "pattern"), r;
|
|
1428
|
+
}, Oe = (r, e) => {
|
|
1429
|
+
const t = document.createElementNS(
|
|
1430
1430
|
"http://www.w3.org/2000/svg",
|
|
1431
1431
|
"circle"
|
|
1432
1432
|
);
|
|
1433
|
-
return
|
|
1434
|
-
}, ke = (
|
|
1435
|
-
(
|
|
1436
|
-
(
|
|
1437
|
-
), ze = (
|
|
1438
|
-
const e =
|
|
1433
|
+
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
1434
|
+
}, ke = (r) => r instanceof SVGElement ? r : Oe(
|
|
1435
|
+
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
1436
|
+
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
1437
|
+
), ze = (r) => {
|
|
1438
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = ke(r.renderer ?? {});
|
|
1439
1439
|
return {
|
|
1440
|
-
tileWidth:
|
|
1441
|
-
tileHeight:
|
|
1442
|
-
renderer:
|
|
1443
|
-
maxViewportScale:
|
|
1440
|
+
tileWidth: t,
|
|
1441
|
+
tileHeight: s,
|
|
1442
|
+
renderer: i,
|
|
1443
|
+
maxViewportScale: r.maxViewportScale ?? 10
|
|
1444
1444
|
};
|
|
1445
1445
|
};
|
|
1446
1446
|
class Y {
|
|
1447
|
-
constructor(e,
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
const
|
|
1460
|
-
this.svg.setAttribute("width", `${
|
|
1461
|
-
const
|
|
1462
|
-
this.pattern.setAttribute("width", `${
|
|
1447
|
+
constructor(e, t, s) {
|
|
1448
|
+
o(this, "svg", $e());
|
|
1449
|
+
o(this, "patternRenderingRectangle", We());
|
|
1450
|
+
o(this, "pattern", Fe());
|
|
1451
|
+
o(this, "patternContent");
|
|
1452
|
+
o(this, "tileWidth");
|
|
1453
|
+
o(this, "tileHeight");
|
|
1454
|
+
o(this, "halfTileWidth");
|
|
1455
|
+
o(this, "halfTileHeight");
|
|
1456
|
+
o(this, "maxViewportScale");
|
|
1457
|
+
o(this, "visible", !1);
|
|
1458
|
+
o(this, "resizeObserver", new ResizeObserver((e) => {
|
|
1459
|
+
const t = e[0], { width: s, height: i } = t.contentRect;
|
|
1460
|
+
this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
|
|
1461
|
+
const n = this.tileWidth / s, h = this.tileHeight / i;
|
|
1462
|
+
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${h}`);
|
|
1463
1463
|
}));
|
|
1464
|
-
|
|
1465
|
-
const e = this.canvas.viewport.getContentMatrix(),
|
|
1466
|
-
this.pattern.setAttribute("patternTransform",
|
|
1464
|
+
o(this, "onAfterTransformUpdated", () => {
|
|
1465
|
+
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
|
|
1466
|
+
this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
|
|
1467
1467
|
});
|
|
1468
|
-
|
|
1468
|
+
o(this, "onBeforeDestroy", () => {
|
|
1469
1469
|
this.resizeObserver.unobserve(this.host), this.host.removeChild(this.svg), this.canvas.viewport.onAfterUpdated.unsubscribe(
|
|
1470
1470
|
this.onAfterTransformUpdated
|
|
1471
1471
|
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1472
1472
|
});
|
|
1473
|
-
this.canvas = e, this.host =
|
|
1474
|
-
const
|
|
1475
|
-
this.tileWidth =
|
|
1476
|
-
const
|
|
1477
|
-
this.patternContent.setAttribute("transform",
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1473
|
+
this.canvas = e, this.host = s;
|
|
1474
|
+
const i = ze(t);
|
|
1475
|
+
this.tileWidth = i.tileWidth, this.tileHeight = i.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = i.renderer, this.maxViewportScale = i.maxViewportScale;
|
|
1476
|
+
const n = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
1477
|
+
this.patternContent.setAttribute("transform", n), this.pattern.appendChild(this.patternContent);
|
|
1478
|
+
const h = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
1479
|
+
h.appendChild(this.pattern), this.svg.appendChild(h), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1480
1480
|
}
|
|
1481
|
-
static configure(e,
|
|
1482
|
-
new Y(e,
|
|
1481
|
+
static configure(e, t, s) {
|
|
1482
|
+
new Y(e, t, s);
|
|
1483
1483
|
}
|
|
1484
1484
|
updateVisibility() {
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1485
|
+
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
1486
|
+
t && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
const Xe = (
|
|
1490
|
-
var d, c
|
|
1491
|
-
const e = () => "direct",
|
|
1492
|
-
}, h = () => {
|
|
1489
|
+
const Xe = (r) => {
|
|
1490
|
+
var a, d, c;
|
|
1491
|
+
const e = () => "direct", t = (g) => g, s = (g) => g.button === 0, i = () => {
|
|
1493
1492
|
}, n = () => {
|
|
1493
|
+
}, h = () => {
|
|
1494
1494
|
};
|
|
1495
1495
|
return {
|
|
1496
|
-
connectionTypeResolver:
|
|
1497
|
-
connectionPreprocessor:
|
|
1498
|
-
mouseDownEventVerifier:
|
|
1499
|
-
mouseUpEventVerifier:
|
|
1500
|
-
onAfterEdgeCreated: ((
|
|
1501
|
-
onEdgeCreationInterrupted: ((
|
|
1502
|
-
onEdgeCreationPrevented: ((
|
|
1503
|
-
dragPortDirection:
|
|
1496
|
+
connectionTypeResolver: r.connectionTypeResolver ?? e,
|
|
1497
|
+
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
1498
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
1499
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
|
|
1500
|
+
onAfterEdgeCreated: ((a = r.events) == null ? void 0 : a.onAfterEdgeCreated) ?? i,
|
|
1501
|
+
onEdgeCreationInterrupted: ((d = r.events) == null ? void 0 : d.onEdgeCreationInterrupted) ?? h,
|
|
1502
|
+
onEdgeCreationPrevented: ((c = r.events) == null ? void 0 : c.onEdgeCreationPrevented) ?? n,
|
|
1503
|
+
dragPortDirection: r.dragPortDirection ?? void 0
|
|
1504
1504
|
};
|
|
1505
1505
|
};
|
|
1506
1506
|
class H {
|
|
1507
|
-
constructor(e,
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
const
|
|
1516
|
-
this.canvas.graph.getElementPortsIds(
|
|
1517
|
-
});
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1520
|
-
this.canvas.graph.getElementPortsIds(
|
|
1521
|
-
});
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(
|
|
1507
|
+
constructor(e, t, s, i, n, h) {
|
|
1508
|
+
o(this, "config");
|
|
1509
|
+
o(this, "overlayCanvas");
|
|
1510
|
+
o(this, "staticOverlayPortId", "static");
|
|
1511
|
+
o(this, "draggingOverlayPortId", "dragging");
|
|
1512
|
+
o(this, "staticPortId", null);
|
|
1513
|
+
o(this, "isDirect", !0);
|
|
1514
|
+
o(this, "onAfterPortMarked", (e) => {
|
|
1515
|
+
const t = this.canvas.graph.getPort(e);
|
|
1516
|
+
this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
1517
|
+
});
|
|
1518
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
1519
|
+
const t = this.canvas.graph.getPort(e);
|
|
1520
|
+
this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
1521
|
+
});
|
|
1522
|
+
o(this, "onPortMouseDown", (e) => {
|
|
1523
|
+
const t = e.currentTarget;
|
|
1524
|
+
this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(t) && (e.stopPropagation(), this.grabPort(t, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1525
1525
|
passive: !0
|
|
1526
1526
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1527
1527
|
passive: !0
|
|
1528
1528
|
}));
|
|
1529
1529
|
});
|
|
1530
|
-
|
|
1531
|
-
if (!
|
|
1530
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
1531
|
+
if (!N(
|
|
1532
1532
|
this.window,
|
|
1533
1533
|
this.overlayLayer,
|
|
1534
1534
|
e.clientX,
|
|
@@ -1539,16 +1539,16 @@ class H {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
this.moveDraggingNode({ x: e.clientX, y: e.clientY });
|
|
1541
1541
|
});
|
|
1542
|
-
|
|
1542
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
1543
1543
|
this.config.mouseUpEventVerifier(e) && (this.tryCreateConnection({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
1544
1544
|
});
|
|
1545
|
-
|
|
1546
|
-
const
|
|
1547
|
-
if (!(e.touches.length === 1 && this.isPortConnectionAllowed(
|
|
1545
|
+
o(this, "onPortTouchStart", (e) => {
|
|
1546
|
+
const t = e.currentTarget;
|
|
1547
|
+
if (!(e.touches.length === 1 && this.isPortConnectionAllowed(t)))
|
|
1548
1548
|
return;
|
|
1549
1549
|
e.stopPropagation();
|
|
1550
|
-
const
|
|
1551
|
-
this.grabPort(
|
|
1550
|
+
const i = e.touches[0];
|
|
1551
|
+
this.grabPort(t, { x: i.clientX, y: i.clientY }), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
1552
1552
|
passive: !0
|
|
1553
1553
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
1554
1554
|
passive: !0
|
|
@@ -1556,82 +1556,82 @@ class H {
|
|
|
1556
1556
|
passive: !0
|
|
1557
1557
|
});
|
|
1558
1558
|
});
|
|
1559
|
-
|
|
1560
|
-
const
|
|
1561
|
-
if (!
|
|
1559
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
1560
|
+
const t = e.touches[0];
|
|
1561
|
+
if (!N(
|
|
1562
1562
|
this.window,
|
|
1563
1563
|
this.overlayLayer,
|
|
1564
|
-
|
|
1565
|
-
|
|
1564
|
+
t.clientX,
|
|
1565
|
+
t.clientY
|
|
1566
1566
|
)) {
|
|
1567
1567
|
this.stopTouchDrag();
|
|
1568
1568
|
return;
|
|
1569
1569
|
}
|
|
1570
|
-
this.moveDraggingNode({ x:
|
|
1570
|
+
this.moveDraggingNode({ x: t.clientX, y: t.clientY });
|
|
1571
1571
|
});
|
|
1572
|
-
|
|
1573
|
-
const
|
|
1574
|
-
this.tryCreateConnection({ x:
|
|
1572
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
1573
|
+
const t = e.changedTouches[0];
|
|
1574
|
+
this.tryCreateConnection({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
1575
1575
|
});
|
|
1576
|
-
|
|
1576
|
+
o(this, "onBeforeClear", () => {
|
|
1577
1577
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
1578
|
-
const
|
|
1579
|
-
this.unhookPortEvents(
|
|
1578
|
+
const t = this.canvas.graph.getPort(e);
|
|
1579
|
+
this.unhookPortEvents(t.element);
|
|
1580
1580
|
});
|
|
1581
1581
|
});
|
|
1582
|
-
|
|
1582
|
+
o(this, "onBeforeDestroy", () => {
|
|
1583
1583
|
this.stopMouseDrag(), this.stopTouchDrag(), this.canvas.graph.onAfterPortMarked.unsubscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.unsubscribe(
|
|
1584
1584
|
this.onBeforePortUnmarked
|
|
1585
1585
|
), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1586
1586
|
});
|
|
1587
|
-
|
|
1587
|
+
o(this, "onEdgeCreated", (e) => {
|
|
1588
1588
|
this.config.onAfterEdgeCreated(e);
|
|
1589
1589
|
});
|
|
1590
|
-
this.canvas = e, this.overlayLayer =
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1590
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = Xe(h);
|
|
1591
|
+
const a = new de(), d = new ne(
|
|
1592
|
+
a,
|
|
1593
1593
|
this.viewportStore,
|
|
1594
1594
|
this.overlayLayer
|
|
1595
1595
|
);
|
|
1596
|
-
this.overlayCanvas = new
|
|
1596
|
+
this.overlayCanvas = new ae(
|
|
1597
1597
|
this.overlayLayer,
|
|
1598
|
-
|
|
1598
|
+
a,
|
|
1599
1599
|
this.viewportStore,
|
|
1600
|
-
|
|
1601
|
-
|
|
1600
|
+
d,
|
|
1601
|
+
n
|
|
1602
1602
|
), this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1603
1603
|
}
|
|
1604
|
-
static configure(e,
|
|
1604
|
+
static configure(e, t, s, i, n, h) {
|
|
1605
1605
|
new H(
|
|
1606
1606
|
e,
|
|
1607
|
-
|
|
1608
|
-
i,
|
|
1607
|
+
t,
|
|
1609
1608
|
s,
|
|
1610
|
-
|
|
1611
|
-
n
|
|
1609
|
+
i,
|
|
1610
|
+
n,
|
|
1611
|
+
h
|
|
1612
1612
|
);
|
|
1613
1613
|
}
|
|
1614
|
-
grabPort(e,
|
|
1615
|
-
const
|
|
1616
|
-
this.staticPortId =
|
|
1617
|
-
const
|
|
1618
|
-
x:
|
|
1619
|
-
y:
|
|
1620
|
-
}), v =
|
|
1621
|
-
x:
|
|
1622
|
-
y:
|
|
1623
|
-
}),
|
|
1614
|
+
grabPort(e, t) {
|
|
1615
|
+
const s = this.canvas.graph.getElementPortsIds(e)[0], i = this.canvas.graph.getPort(s);
|
|
1616
|
+
this.staticPortId = s;
|
|
1617
|
+
const n = this.config.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = D(g, {
|
|
1618
|
+
x: a - c.x,
|
|
1619
|
+
y: d - c.y
|
|
1620
|
+
}), v = D(g, {
|
|
1621
|
+
x: t.x - c.x,
|
|
1622
|
+
y: t.y - c.y
|
|
1623
|
+
}), p = {
|
|
1624
1624
|
overlayId: this.staticOverlayPortId,
|
|
1625
|
-
portCoords:
|
|
1626
|
-
portDirection:
|
|
1627
|
-
},
|
|
1625
|
+
portCoords: l,
|
|
1626
|
+
portDirection: i.direction
|
|
1627
|
+
}, f = {
|
|
1628
1628
|
overlayId: this.draggingOverlayPortId,
|
|
1629
1629
|
portCoords: v,
|
|
1630
1630
|
portDirection: this.config.dragPortDirection
|
|
1631
1631
|
};
|
|
1632
|
-
this.isDirect =
|
|
1633
|
-
const
|
|
1634
|
-
this.createOverlayGraph(
|
|
1632
|
+
this.isDirect = n === "direct";
|
|
1633
|
+
const A = this.isDirect ? p : f, m = this.isDirect ? f : p;
|
|
1634
|
+
this.createOverlayGraph(A, m);
|
|
1635
1635
|
}
|
|
1636
1636
|
hookPortEvents(e) {
|
|
1637
1637
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -1652,351 +1652,468 @@ class H {
|
|
|
1652
1652
|
resetDragState() {
|
|
1653
1653
|
this.staticPortId = null, this.isDirect = !0, this.overlayCanvas.clear();
|
|
1654
1654
|
}
|
|
1655
|
-
createOverlayGraph(e,
|
|
1656
|
-
const
|
|
1657
|
-
this.overlayCanvas.addNode(
|
|
1658
|
-
const
|
|
1659
|
-
this.overlayCanvas.addNode(
|
|
1655
|
+
createOverlayGraph(e, t) {
|
|
1656
|
+
const s = this.createAddNodeRequest(e);
|
|
1657
|
+
this.overlayCanvas.addNode(s);
|
|
1658
|
+
const i = this.createAddNodeRequest(t);
|
|
1659
|
+
this.overlayCanvas.addNode(i), this.overlayCanvas.addEdge({
|
|
1660
1660
|
from: e.overlayId,
|
|
1661
|
-
to:
|
|
1661
|
+
to: t.overlayId
|
|
1662
1662
|
});
|
|
1663
1663
|
}
|
|
1664
1664
|
createAddNodeRequest(e) {
|
|
1665
|
-
const
|
|
1665
|
+
const t = document.createElement("div");
|
|
1666
1666
|
return {
|
|
1667
1667
|
id: e.overlayId,
|
|
1668
|
-
element:
|
|
1668
|
+
element: t,
|
|
1669
1669
|
x: e.portCoords.x,
|
|
1670
1670
|
y: e.portCoords.y,
|
|
1671
1671
|
ports: [
|
|
1672
1672
|
{
|
|
1673
1673
|
id: e.overlayId,
|
|
1674
|
-
element:
|
|
1674
|
+
element: t,
|
|
1675
1675
|
direction: e.portDirection
|
|
1676
1676
|
}
|
|
1677
1677
|
]
|
|
1678
1678
|
};
|
|
1679
1679
|
}
|
|
1680
1680
|
tryCreateConnection(e) {
|
|
1681
|
-
const
|
|
1682
|
-
if (
|
|
1681
|
+
const t = this.findPortAtPoint(e);
|
|
1682
|
+
if (t === null) {
|
|
1683
1683
|
this.config.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
|
|
1684
1684
|
return;
|
|
1685
1685
|
}
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1686
|
+
const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.config.connectionPreprocessor(n);
|
|
1687
|
+
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(n);
|
|
1688
1688
|
}
|
|
1689
1689
|
moveDraggingNode(e) {
|
|
1690
|
-
const
|
|
1691
|
-
x: e.x -
|
|
1692
|
-
y: e.y -
|
|
1693
|
-
},
|
|
1690
|
+
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
1691
|
+
x: e.x - t.x,
|
|
1692
|
+
y: e.y - t.y
|
|
1693
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
1694
1694
|
this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
|
|
1695
|
-
x:
|
|
1696
|
-
y:
|
|
1695
|
+
x: n.x,
|
|
1696
|
+
y: n.y
|
|
1697
1697
|
});
|
|
1698
1698
|
}
|
|
1699
1699
|
findPortAtPoint(e) {
|
|
1700
|
-
const
|
|
1701
|
-
for (const
|
|
1702
|
-
const
|
|
1703
|
-
if (
|
|
1704
|
-
return
|
|
1700
|
+
const t = document.elementsFromPoint(e.x, e.y);
|
|
1701
|
+
for (const s of t) {
|
|
1702
|
+
const i = this.findPortAtElement(s);
|
|
1703
|
+
if (i !== null)
|
|
1704
|
+
return i;
|
|
1705
1705
|
}
|
|
1706
1706
|
return null;
|
|
1707
1707
|
}
|
|
1708
1708
|
findPortAtElement(e) {
|
|
1709
|
-
let
|
|
1710
|
-
for (;
|
|
1711
|
-
|
|
1712
|
-
return
|
|
1709
|
+
let t = e, s = null;
|
|
1710
|
+
for (; t !== null && (s = this.canvas.graph.getElementPortsIds(t)[0] ?? null, s === null); )
|
|
1711
|
+
t = t.parentElement;
|
|
1712
|
+
return s;
|
|
1713
1713
|
}
|
|
1714
1714
|
isPortConnectionAllowed(e) {
|
|
1715
|
-
const
|
|
1716
|
-
return this.config.connectionTypeResolver(
|
|
1715
|
+
const t = this.canvas.graph.getElementPortsIds(e)[0];
|
|
1716
|
+
return this.config.connectionTypeResolver(t) !== null;
|
|
1717
1717
|
}
|
|
1718
1718
|
}
|
|
1719
1719
|
const Ye = () => {
|
|
1720
|
-
const
|
|
1721
|
-
return
|
|
1722
|
-
},
|
|
1723
|
-
const
|
|
1724
|
-
return
|
|
1720
|
+
const r = document.createElement("div");
|
|
1721
|
+
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
1722
|
+
}, W = () => {
|
|
1723
|
+
const r = document.createElement("div");
|
|
1724
|
+
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
1725
1725
|
};
|
|
1726
1726
|
class He {
|
|
1727
1727
|
constructor(e) {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1728
|
+
o(this, "background", W());
|
|
1729
|
+
o(this, "main", W());
|
|
1730
|
+
o(this, "overlay", W());
|
|
1731
|
+
o(this, "host", Ye());
|
|
1732
1732
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
|
|
1733
1733
|
}
|
|
1734
1734
|
destroy() {
|
|
1735
1735
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
const je = (
|
|
1739
|
-
x:
|
|
1738
|
+
const je = (r, e) => ({
|
|
1739
|
+
x: r / 2,
|
|
1740
1740
|
y: e / 2
|
|
1741
|
-
}), F = (
|
|
1742
|
-
let
|
|
1743
|
-
return () =>
|
|
1744
|
-
}, Ze = (
|
|
1745
|
-
let
|
|
1746
|
-
const
|
|
1747
|
-
return
|
|
1748
|
-
nodesPriorityFn:
|
|
1749
|
-
edgesPriorityFn:
|
|
1741
|
+
}), F = (r) => () => r, re = F(0), Ge = () => {
|
|
1742
|
+
let r = 0;
|
|
1743
|
+
return () => r++;
|
|
1744
|
+
}, Ze = (r, e) => {
|
|
1745
|
+
let t = re, s = re;
|
|
1746
|
+
const i = Ge();
|
|
1747
|
+
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = F(r)), typeof e == "number" && (s = F(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
1748
|
+
nodesPriorityFn: t,
|
|
1749
|
+
edgesPriorityFn: s
|
|
1750
1750
|
};
|
|
1751
|
-
},
|
|
1752
|
-
x: e.x *
|
|
1753
|
-
y: e.y *
|
|
1754
|
-
}),
|
|
1751
|
+
}, y = (r, e, t) => ({
|
|
1752
|
+
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
1753
|
+
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
1754
|
+
}), w = {
|
|
1755
1755
|
x: 0,
|
|
1756
1756
|
y: 0
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
t.
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
t.
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
},
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1757
|
+
};
|
|
1758
|
+
class Je {
|
|
1759
|
+
constructor(e) {
|
|
1760
|
+
o(this, "path");
|
|
1761
|
+
o(this, "median");
|
|
1762
|
+
this.params = e;
|
|
1763
|
+
const t = this.params.to;
|
|
1764
|
+
this.median = { x: t.x / 2, y: t.y / 2 };
|
|
1765
|
+
const s = y(
|
|
1766
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1767
|
+
this.params.sourceDirection,
|
|
1768
|
+
w
|
|
1769
|
+
), i = y(
|
|
1770
|
+
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
1771
|
+
this.params.targetDirection,
|
|
1772
|
+
this.params.to
|
|
1773
|
+
), n = {
|
|
1774
|
+
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
1775
|
+
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
1776
|
+
}, h = {
|
|
1777
|
+
x: i.x - this.params.targetDirection.x * this.params.curvature,
|
|
1778
|
+
y: i.y - this.params.targetDirection.y * this.params.curvature
|
|
1779
|
+
}, a = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${h.x} ${h.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
1780
|
+
this.path = `${d}${a}${c}`;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
const ce = (r, e, t, s) => ({
|
|
1784
|
+
x: e * r.x + (1 - e) / 2 * s.x,
|
|
1785
|
+
y: t * r.y + (1 - t) / 2 * s.y
|
|
1786
|
+
});
|
|
1787
|
+
class Ke {
|
|
1788
|
+
constructor(e) {
|
|
1789
|
+
o(this, "path");
|
|
1790
|
+
o(this, "median");
|
|
1791
|
+
this.params = e;
|
|
1792
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1793
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1794
|
+
this.params.sourceDirection,
|
|
1795
|
+
w
|
|
1796
|
+
) : w, s = this.params.hasTargetArrow ? y(
|
|
1797
|
+
{
|
|
1798
|
+
x: this.params.to.x - this.params.arrowLength,
|
|
1799
|
+
y: this.params.to.y
|
|
1800
|
+
},
|
|
1801
|
+
this.params.targetDirection,
|
|
1802
|
+
this.params.to
|
|
1803
|
+
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = y(
|
|
1804
|
+
{ x: i, y: w.y },
|
|
1805
|
+
this.params.sourceDirection,
|
|
1806
|
+
w
|
|
1807
|
+
), g = {
|
|
1808
|
+
x: c.x + a,
|
|
1809
|
+
y: c.y + d
|
|
1810
|
+
}, l = y(
|
|
1811
|
+
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1812
|
+
this.params.targetDirection,
|
|
1813
|
+
this.params.to
|
|
1814
|
+
), v = {
|
|
1815
|
+
x: l.x + a,
|
|
1816
|
+
y: l.y + d
|
|
1817
|
+
}, p = {
|
|
1818
|
+
x: (g.x + v.x) / 2,
|
|
1819
|
+
y: (g.y + v.y) / 2
|
|
1820
|
+
}, f = {
|
|
1821
|
+
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1822
|
+
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1823
|
+
}, A = {
|
|
1824
|
+
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
1825
|
+
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
1826
|
+
}, m = {
|
|
1827
|
+
x: c.x + a,
|
|
1828
|
+
y: c.y + d
|
|
1829
|
+
}, x = {
|
|
1830
|
+
x: l.x + a,
|
|
1831
|
+
y: l.y + d
|
|
1832
|
+
};
|
|
1833
|
+
this.path = [
|
|
1834
|
+
`M ${t.x} ${t.y}`,
|
|
1835
|
+
`L ${c.x} ${c.y}`,
|
|
1836
|
+
`C ${f.x} ${f.y} ${m.x} ${m.y} ${p.x} ${p.y}`,
|
|
1837
|
+
`C ${x.x} ${x.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
|
|
1838
|
+
`L ${s.x} ${s.y}`
|
|
1839
|
+
].join(" "), this.median = ce(p, e.flipX, e.flipY, e.to);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const R = (r, e) => {
|
|
1843
|
+
const t = [];
|
|
1844
|
+
if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
1845
|
+
const s = r.length - 1;
|
|
1846
|
+
let i = 0, n = 0, h = 0;
|
|
1847
|
+
r.forEach((a, d) => {
|
|
1848
|
+
let c = 0, g = 0, l = 0;
|
|
1849
|
+
const v = d > 0, p = d < s, f = v && p;
|
|
1850
|
+
if (v && (c = -i, g = -n, l = h), p) {
|
|
1851
|
+
const L = r[d + 1];
|
|
1852
|
+
i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
|
|
1828
1853
|
}
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
`C ${
|
|
1854
|
+
const m = h !== 0 ? Math.min((f ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = f ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = f ? { x: a.x + c * T, y: a.y + g * T } : a;
|
|
1855
|
+
d > 0 && t.push(`L ${M.x} ${M.y}`), f && t.push(
|
|
1856
|
+
`C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
|
|
1832
1857
|
);
|
|
1833
1858
|
});
|
|
1834
1859
|
}
|
|
1835
|
-
return
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
t.
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
{ x:
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
{ x:
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
{ x:
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
t.
|
|
1913
|
-
t.
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1860
|
+
return t.join(" ");
|
|
1861
|
+
};
|
|
1862
|
+
class Qe {
|
|
1863
|
+
constructor(e) {
|
|
1864
|
+
o(this, "path");
|
|
1865
|
+
o(this, "median");
|
|
1866
|
+
this.params = e;
|
|
1867
|
+
const t = this.params.to;
|
|
1868
|
+
this.median = { x: t.x / 2, y: t.y / 2 };
|
|
1869
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1870
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1871
|
+
this.params.sourceDirection,
|
|
1872
|
+
w
|
|
1873
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1874
|
+
{
|
|
1875
|
+
x: this.params.to.x - this.params.arrowLength,
|
|
1876
|
+
y: this.params.to.y
|
|
1877
|
+
},
|
|
1878
|
+
this.params.targetDirection,
|
|
1879
|
+
this.params.to
|
|
1880
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
|
|
1881
|
+
{ x: h, y: w.y },
|
|
1882
|
+
this.params.sourceDirection,
|
|
1883
|
+
w
|
|
1884
|
+
), d = y(
|
|
1885
|
+
{ x: this.params.to.x - h, y: this.params.to.y },
|
|
1886
|
+
this.params.targetDirection,
|
|
1887
|
+
this.params.to
|
|
1888
|
+
), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1889
|
+
x: this.params.flipX > 0 ? c : -n,
|
|
1890
|
+
y: a.y
|
|
1891
|
+
}, v = { x: l.x, y: g }, p = {
|
|
1892
|
+
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1893
|
+
y: d.y
|
|
1894
|
+
}, f = { x: p.x, y: g };
|
|
1895
|
+
this.path = R(
|
|
1896
|
+
[s, a, l, v, f, p, d, i],
|
|
1897
|
+
this.params.roundness
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
class j {
|
|
1902
|
+
constructor(e) {
|
|
1903
|
+
o(this, "path");
|
|
1904
|
+
o(this, "median");
|
|
1905
|
+
this.params = e;
|
|
1906
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1907
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1908
|
+
this.params.sourceDirection,
|
|
1909
|
+
w
|
|
1910
|
+
) : w, s = this.params.hasTargetArrow ? y(
|
|
1911
|
+
{
|
|
1912
|
+
x: this.params.to.x - this.params.arrowLength,
|
|
1913
|
+
y: this.params.to.y
|
|
1914
|
+
},
|
|
1915
|
+
this.params.targetDirection,
|
|
1916
|
+
this.params.to
|
|
1917
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1918
|
+
{ x: i, y: w.y },
|
|
1919
|
+
this.params.sourceDirection,
|
|
1920
|
+
w
|
|
1921
|
+
), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
|
|
1922
|
+
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1923
|
+
this.params.targetDirection,
|
|
1924
|
+
this.params.to
|
|
1925
|
+
), v = { x: l.x + d, y: l.y + c }, p = { x: (g.x + v.x) / 2, y: (g.y + v.y) / 2 };
|
|
1926
|
+
this.median = ce(p, e.flipX, e.flipY, e.to), this.path = R(
|
|
1927
|
+
[t, n, g, v, l, s],
|
|
1928
|
+
this.params.roundness
|
|
1929
|
+
);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
class _e {
|
|
1933
|
+
constructor(e) {
|
|
1934
|
+
o(this, "path");
|
|
1935
|
+
o(this, "median");
|
|
1936
|
+
this.params = e;
|
|
1937
|
+
const t = this.params.to;
|
|
1938
|
+
this.median = { x: t.x / 2, y: t.y / 2 };
|
|
1939
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1940
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1941
|
+
this.params.sourceDirection,
|
|
1942
|
+
w
|
|
1943
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1944
|
+
{
|
|
1945
|
+
x: this.params.to.x - this.params.arrowLength,
|
|
1946
|
+
y: this.params.to.y
|
|
1947
|
+
},
|
|
1948
|
+
this.params.targetDirection,
|
|
1949
|
+
this.params.to
|
|
1950
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = y(
|
|
1951
|
+
{ x: n, y: w.y },
|
|
1952
|
+
this.params.sourceDirection,
|
|
1953
|
+
w
|
|
1954
|
+
), a = y(
|
|
1955
|
+
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1956
|
+
this.params.targetDirection,
|
|
1957
|
+
this.params.to
|
|
1958
|
+
);
|
|
1959
|
+
this.path = R([s, h, a, i], this.params.roundness);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
class qe {
|
|
1963
|
+
constructor(e) {
|
|
1964
|
+
o(this, "path");
|
|
1965
|
+
o(this, "median");
|
|
1966
|
+
this.params = e;
|
|
1967
|
+
const t = this.params.to;
|
|
1968
|
+
this.median = { x: t.x / 2, y: t.y / 2 };
|
|
1969
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1970
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1971
|
+
this.params.sourceDirection,
|
|
1972
|
+
w
|
|
1973
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1974
|
+
{
|
|
1975
|
+
x: this.params.to.x - this.params.arrowLength,
|
|
1976
|
+
y: this.params.to.y
|
|
1977
|
+
},
|
|
1978
|
+
this.params.targetDirection,
|
|
1979
|
+
this.params.to
|
|
1980
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
|
|
1981
|
+
{ x: h, y: w.y },
|
|
1982
|
+
this.params.sourceDirection,
|
|
1983
|
+
w
|
|
1984
|
+
), d = y(
|
|
1985
|
+
{ x: this.params.to.x - h, y: this.params.to.y },
|
|
1986
|
+
this.params.targetDirection,
|
|
1987
|
+
this.params.to
|
|
1988
|
+
), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1989
|
+
x: a.x,
|
|
1990
|
+
y: this.params.flipY > 0 ? c : -n
|
|
1991
|
+
}, v = { x: g, y: l.y }, p = {
|
|
1992
|
+
x: d.x,
|
|
1993
|
+
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1994
|
+
}, f = { x: g, y: p.y };
|
|
1995
|
+
this.path = R(
|
|
1996
|
+
[s, a, l, v, f, p, d, i],
|
|
1997
|
+
this.params.roundness
|
|
1998
|
+
);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
class G {
|
|
2002
|
+
constructor(e) {
|
|
2003
|
+
o(this, "path");
|
|
2004
|
+
o(this, "median");
|
|
2005
|
+
this.params = e;
|
|
2006
|
+
const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, a = [
|
|
2007
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
2008
|
+
{ x: i, y: w.y },
|
|
2009
|
+
{ x: i, y: this.params.side },
|
|
2010
|
+
{ x: n, y: this.params.side },
|
|
2011
|
+
{ x: n, y: -this.params.side },
|
|
2012
|
+
{ x: i, y: -this.params.side },
|
|
2013
|
+
{ x: i, y: w.y },
|
|
2014
|
+
{ x: this.params.arrowLength, y: w.y }
|
|
2015
|
+
].map(
|
|
2016
|
+
(c) => y(c, this.params.sourceDirection, w)
|
|
2017
|
+
), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
|
|
2018
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.median = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
class et {
|
|
2022
|
+
constructor(e) {
|
|
2023
|
+
o(this, "path");
|
|
2024
|
+
o(this, "median");
|
|
2025
|
+
this.params = e;
|
|
2026
|
+
const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, h = Math.sqrt(i * i - t * t), a = h * t / i, d = h + s + this.params.arrowLength, c = this.params.arrowLength + a, l = [
|
|
2027
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
2028
|
+
{ x: c, y: n },
|
|
2029
|
+
{ x: c, y: -n },
|
|
2030
|
+
{ x: d, y: 0 }
|
|
2031
|
+
].map(
|
|
2032
|
+
(f) => y(f, this.params.sourceDirection, w)
|
|
2033
|
+
), v = [
|
|
2034
|
+
`M ${l[0].x} ${l[0].y}`,
|
|
2035
|
+
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
2036
|
+
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
2037
|
+
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
2038
|
+
].join(" "), p = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
2039
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${v}`, this.median = l[3];
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
class tt {
|
|
2043
|
+
constructor(e) {
|
|
2044
|
+
o(this, "path");
|
|
2045
|
+
o(this, "median");
|
|
2046
|
+
o(this, "diagonalDistance");
|
|
2047
|
+
this.params = e;
|
|
2048
|
+
const t = this.params.to;
|
|
2049
|
+
if (this.median = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
2050
|
+
this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
|
|
2051
|
+
), Math.sqrt(
|
|
2052
|
+
this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
|
|
2053
|
+
) === 0) {
|
|
2054
|
+
this.path = "";
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
const i = this.createDirectLinePoint({
|
|
2058
|
+
offset: this.params.sourceOffset,
|
|
2059
|
+
hasArrow: this.params.hasSourceArrow,
|
|
2060
|
+
flip: 1,
|
|
2061
|
+
shift: w
|
|
2062
|
+
}), n = this.createDirectLinePoint({
|
|
2063
|
+
offset: this.params.targetOffset,
|
|
2064
|
+
hasArrow: this.params.hasTargetArrow,
|
|
2065
|
+
flip: -1,
|
|
2066
|
+
shift: this.params.to
|
|
2067
|
+
});
|
|
2068
|
+
this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
|
|
2069
|
+
}
|
|
2070
|
+
createDirectLinePoint(e) {
|
|
2071
|
+
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
|
|
2072
|
+
return {
|
|
2073
|
+
x: this.params.to.x * i + e.shift.x,
|
|
2074
|
+
y: this.params.to.y * i + e.shift.y
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
const le = (r, e) => {
|
|
2079
|
+
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
1963
2080
|
}, Z = Object.freeze({
|
|
1964
2081
|
edgeColor: "--edge-color"
|
|
1965
|
-
}),
|
|
2082
|
+
}), ge = (r) => {
|
|
1966
2083
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1967
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor,
|
|
2084
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
|
|
1968
2085
|
}, V = () => {
|
|
1969
|
-
const
|
|
1970
|
-
return
|
|
1971
|
-
},
|
|
1972
|
-
const
|
|
1973
|
-
return
|
|
1974
|
-
}, we = (
|
|
2086
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2087
|
+
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
2088
|
+
}, ue = () => {
|
|
2089
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2090
|
+
return r.style.transformOrigin = "50% 50%", r;
|
|
2091
|
+
}, we = (r) => {
|
|
1975
2092
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1976
|
-
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${
|
|
1977
|
-
},
|
|
1978
|
-
const
|
|
1979
|
-
x:
|
|
1980
|
-
y:
|
|
1981
|
-
},
|
|
2093
|
+
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
2094
|
+
}, pe = (r, e) => {
|
|
2095
|
+
const t = {
|
|
2096
|
+
x: r.x + r.width / 2,
|
|
2097
|
+
y: r.y + r.height / 2
|
|
2098
|
+
}, s = {
|
|
1982
2099
|
x: e.x + e.width / 2,
|
|
1983
2100
|
y: e.y + e.height / 2
|
|
1984
|
-
},
|
|
2101
|
+
}, i = Math.min(t.x, s.x), n = Math.min(t.y, s.y), h = Math.abs(s.x - t.x), a = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
|
|
1985
2102
|
return {
|
|
1986
|
-
x:
|
|
1987
|
-
y:
|
|
1988
|
-
width:
|
|
1989
|
-
height:
|
|
1990
|
-
flipX:
|
|
1991
|
-
flipY:
|
|
2103
|
+
x: i,
|
|
2104
|
+
y: n,
|
|
2105
|
+
width: h,
|
|
2106
|
+
height: a,
|
|
2107
|
+
flipX: d,
|
|
2108
|
+
flipY: c
|
|
1992
2109
|
};
|
|
1993
|
-
}, O = (
|
|
1994
|
-
const
|
|
1995
|
-
|
|
1996
|
-
{ x:
|
|
1997
|
-
{ x:
|
|
1998
|
-
].map((
|
|
1999
|
-
return `${
|
|
2110
|
+
}, O = (r, e, t, s) => {
|
|
2111
|
+
const n = [
|
|
2112
|
+
w,
|
|
2113
|
+
{ x: t, y: s },
|
|
2114
|
+
{ x: t, y: -s }
|
|
2115
|
+
].map((c) => y(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
|
|
2116
|
+
return `${h} ${a} ${d} Z`;
|
|
2000
2117
|
}, u = Object.freeze({
|
|
2001
2118
|
color: "#777777",
|
|
2002
2119
|
width: 1,
|
|
@@ -2015,81 +2132,85 @@ const je = (t, e) => ({
|
|
|
2015
2132
|
curvature: 90,
|
|
2016
2133
|
interactiveWidth: 10,
|
|
2017
2134
|
preOffset: 0
|
|
2018
|
-
}),
|
|
2019
|
-
class
|
|
2135
|
+
}), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
2136
|
+
class U {
|
|
2020
2137
|
constructor(e) {
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2138
|
+
o(this, "svg");
|
|
2139
|
+
o(this, "group", ue());
|
|
2140
|
+
o(this, "line");
|
|
2141
|
+
o(this, "sourceArrow", null);
|
|
2142
|
+
o(this, "targetArrow", null);
|
|
2143
|
+
o(this, "onAfterRender");
|
|
2144
|
+
o(this, "afterRenderEmitter");
|
|
2145
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = ge(e.color), this.svg.appendChild(this.group), this.line = we(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
|
|
2027
2146
|
}
|
|
2028
2147
|
render(e) {
|
|
2029
|
-
const { x:
|
|
2148
|
+
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
|
|
2030
2149
|
e.from,
|
|
2031
2150
|
e.to
|
|
2032
2151
|
);
|
|
2033
|
-
le(this.svg, { x:
|
|
2034
|
-
const
|
|
2152
|
+
le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2153
|
+
const d = oe(
|
|
2035
2154
|
e.from.direction,
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
),
|
|
2155
|
+
h,
|
|
2156
|
+
a
|
|
2157
|
+
), c = oe(
|
|
2039
2158
|
e.to.direction,
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
),
|
|
2043
|
-
x:
|
|
2044
|
-
y:
|
|
2159
|
+
h,
|
|
2160
|
+
a
|
|
2161
|
+
), g = {
|
|
2162
|
+
x: i,
|
|
2163
|
+
y: n
|
|
2045
2164
|
};
|
|
2046
|
-
let
|
|
2047
|
-
e.from.portId === e.to.portId ? (
|
|
2048
|
-
const
|
|
2165
|
+
let l = c, v = -this.params.arrowLength, p;
|
|
2166
|
+
e.from.portId === e.to.portId ? (p = this.params.createCyclePath, l = d, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? p = this.params.createDetourPath : p = this.params.createLinePath;
|
|
2167
|
+
const f = p(
|
|
2168
|
+
d,
|
|
2049
2169
|
c,
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
d
|
|
2170
|
+
g,
|
|
2171
|
+
h,
|
|
2172
|
+
a
|
|
2054
2173
|
);
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2174
|
+
this.line.setAttribute("d", f.path);
|
|
2175
|
+
let A = null;
|
|
2176
|
+
this.sourceArrow && (A = O(
|
|
2177
|
+
d,
|
|
2178
|
+
w,
|
|
2179
|
+
this.params.arrowLength,
|
|
2180
|
+
this.params.arrowWidth
|
|
2181
|
+
), this.sourceArrow.setAttribute("d", A));
|
|
2182
|
+
let m = null;
|
|
2183
|
+
this.targetArrow && (m = O(
|
|
2184
|
+
l,
|
|
2185
|
+
g,
|
|
2186
|
+
v,
|
|
2187
|
+
this.params.arrowWidth
|
|
2188
|
+
), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
|
|
2189
|
+
edgePath: f,
|
|
2190
|
+
sourceArrowPath: A,
|
|
2191
|
+
targetArrowPath: m
|
|
2192
|
+
});
|
|
2073
2193
|
}
|
|
2074
2194
|
}
|
|
2075
|
-
class
|
|
2195
|
+
class rt {
|
|
2076
2196
|
constructor(e) {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2197
|
+
o(this, "svg");
|
|
2198
|
+
o(this, "group");
|
|
2199
|
+
o(this, "line");
|
|
2200
|
+
o(this, "sourceArrow");
|
|
2201
|
+
o(this, "targetArrow");
|
|
2202
|
+
o(this, "onAfterRender");
|
|
2203
|
+
o(this, "arrowLength");
|
|
2204
|
+
o(this, "arrowWidth");
|
|
2205
|
+
o(this, "curvature");
|
|
2206
|
+
o(this, "portCycleRadius");
|
|
2207
|
+
o(this, "portCycleSmallRadius");
|
|
2208
|
+
o(this, "detourDirection");
|
|
2209
|
+
o(this, "detourDistance");
|
|
2210
|
+
o(this, "hasSourceArrow");
|
|
2211
|
+
o(this, "hasTargetArrow");
|
|
2212
|
+
o(this, "pathShape");
|
|
2213
|
+
o(this, "createCyclePath", (e) => new et({
|
|
2093
2214
|
sourceDirection: e,
|
|
2094
2215
|
radius: this.portCycleRadius,
|
|
2095
2216
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -2097,12 +2218,12 @@ class tt {
|
|
|
2097
2218
|
hasSourceArrow: this.hasSourceArrow,
|
|
2098
2219
|
hasTargetArrow: this.hasTargetArrow
|
|
2099
2220
|
}));
|
|
2100
|
-
|
|
2101
|
-
to:
|
|
2221
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new Ke({
|
|
2222
|
+
to: s,
|
|
2102
2223
|
sourceDirection: e,
|
|
2103
|
-
targetDirection:
|
|
2104
|
-
flipX:
|
|
2105
|
-
flipY:
|
|
2224
|
+
targetDirection: t,
|
|
2225
|
+
flipX: i,
|
|
2226
|
+
flipY: n,
|
|
2106
2227
|
arrowLength: this.arrowLength,
|
|
2107
2228
|
detourDirection: this.detourDirection,
|
|
2108
2229
|
detourDistance: this.detourDistance,
|
|
@@ -2110,16 +2231,16 @@ class tt {
|
|
|
2110
2231
|
hasSourceArrow: this.hasSourceArrow,
|
|
2111
2232
|
hasTargetArrow: this.hasTargetArrow
|
|
2112
2233
|
}));
|
|
2113
|
-
|
|
2114
|
-
to:
|
|
2234
|
+
o(this, "createLinePath", (e, t, s) => new Je({
|
|
2235
|
+
to: s,
|
|
2115
2236
|
sourceDirection: e,
|
|
2116
|
-
targetDirection:
|
|
2237
|
+
targetDirection: t,
|
|
2117
2238
|
arrowLength: this.arrowLength,
|
|
2118
2239
|
curvature: this.curvature,
|
|
2119
2240
|
hasSourceArrow: this.hasSourceArrow,
|
|
2120
2241
|
hasTargetArrow: this.hasTargetArrow
|
|
2121
2242
|
}));
|
|
2122
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.
|
|
2243
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
|
|
2123
2244
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2124
2245
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2125
2246
|
arrowLength: this.arrowLength,
|
|
@@ -2129,30 +2250,31 @@ class tt {
|
|
|
2129
2250
|
createCyclePath: this.createCyclePath,
|
|
2130
2251
|
createDetourPath: this.createDetourPath,
|
|
2131
2252
|
createLinePath: this.createLinePath
|
|
2132
|
-
}), this.svg = this.
|
|
2253
|
+
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
2133
2254
|
}
|
|
2134
2255
|
render(e) {
|
|
2135
|
-
this.
|
|
2256
|
+
this.pathShape.render(e);
|
|
2136
2257
|
}
|
|
2137
2258
|
}
|
|
2138
2259
|
class ot {
|
|
2139
2260
|
constructor(e) {
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2261
|
+
o(this, "svg");
|
|
2262
|
+
o(this, "group");
|
|
2263
|
+
o(this, "line");
|
|
2264
|
+
o(this, "sourceArrow");
|
|
2265
|
+
o(this, "targetArrow");
|
|
2266
|
+
o(this, "onAfterRender");
|
|
2267
|
+
o(this, "arrowLength");
|
|
2268
|
+
o(this, "arrowWidth");
|
|
2269
|
+
o(this, "arrowOffset");
|
|
2270
|
+
o(this, "roundness");
|
|
2271
|
+
o(this, "cycleSquareSide");
|
|
2272
|
+
o(this, "detourDirection");
|
|
2273
|
+
o(this, "detourDistance");
|
|
2274
|
+
o(this, "hasSourceArrow");
|
|
2275
|
+
o(this, "hasTargetArrow");
|
|
2276
|
+
o(this, "pathShape");
|
|
2277
|
+
o(this, "createCyclePath", (e) => new G({
|
|
2156
2278
|
sourceDirection: e,
|
|
2157
2279
|
arrowLength: this.arrowLength,
|
|
2158
2280
|
side: this.cycleSquareSide,
|
|
@@ -2161,12 +2283,12 @@ class ot {
|
|
|
2161
2283
|
hasSourceArrow: this.hasSourceArrow,
|
|
2162
2284
|
hasTargetArrow: this.hasTargetArrow
|
|
2163
2285
|
}));
|
|
2164
|
-
|
|
2165
|
-
to:
|
|
2286
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
2287
|
+
to: s,
|
|
2166
2288
|
sourceDirection: e,
|
|
2167
|
-
targetDirection:
|
|
2168
|
-
flipX:
|
|
2169
|
-
flipY:
|
|
2289
|
+
targetDirection: t,
|
|
2290
|
+
flipX: i,
|
|
2291
|
+
flipY: n,
|
|
2170
2292
|
arrowLength: this.arrowLength,
|
|
2171
2293
|
arrowOffset: this.arrowOffset,
|
|
2172
2294
|
roundness: this.roundness,
|
|
@@ -2175,11 +2297,11 @@ class ot {
|
|
|
2175
2297
|
hasSourceArrow: this.hasSourceArrow,
|
|
2176
2298
|
hasTargetArrow: this.hasTargetArrow
|
|
2177
2299
|
}));
|
|
2178
|
-
|
|
2179
|
-
to:
|
|
2300
|
+
o(this, "createLinePath", (e, t, s, i) => new Qe({
|
|
2301
|
+
to: s,
|
|
2180
2302
|
sourceDirection: e,
|
|
2181
|
-
targetDirection:
|
|
2182
|
-
flipX:
|
|
2303
|
+
targetDirection: t,
|
|
2304
|
+
flipX: i,
|
|
2183
2305
|
arrowLength: this.arrowLength,
|
|
2184
2306
|
arrowOffset: this.arrowOffset,
|
|
2185
2307
|
roundness: this.roundness,
|
|
@@ -2187,12 +2309,12 @@ class ot {
|
|
|
2187
2309
|
hasTargetArrow: this.hasTargetArrow
|
|
2188
2310
|
}));
|
|
2189
2311
|
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
|
|
2190
|
-
const
|
|
2312
|
+
const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
|
|
2191
2313
|
this.roundness = Math.min(
|
|
2192
|
-
|
|
2314
|
+
t,
|
|
2193
2315
|
this.arrowOffset,
|
|
2194
2316
|
this.cycleSquareSide / 2
|
|
2195
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.
|
|
2317
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
|
|
2196
2318
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2197
2319
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2198
2320
|
arrowLength: this.arrowLength,
|
|
@@ -2202,30 +2324,31 @@ class ot {
|
|
|
2202
2324
|
createCyclePath: this.createCyclePath,
|
|
2203
2325
|
createDetourPath: this.createDetourPath,
|
|
2204
2326
|
createLinePath: this.createLinePath
|
|
2205
|
-
}), this.svg = this.
|
|
2327
|
+
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
2206
2328
|
}
|
|
2207
2329
|
render(e) {
|
|
2208
|
-
this.
|
|
2330
|
+
this.pathShape.render(e);
|
|
2209
2331
|
}
|
|
2210
2332
|
}
|
|
2211
|
-
class
|
|
2333
|
+
class st {
|
|
2212
2334
|
constructor(e) {
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2335
|
+
o(this, "svg");
|
|
2336
|
+
o(this, "group");
|
|
2337
|
+
o(this, "line");
|
|
2338
|
+
o(this, "sourceArrow");
|
|
2339
|
+
o(this, "targetArrow");
|
|
2340
|
+
o(this, "onAfterRender");
|
|
2341
|
+
o(this, "arrowLength");
|
|
2342
|
+
o(this, "arrowWidth");
|
|
2343
|
+
o(this, "arrowOffset");
|
|
2344
|
+
o(this, "roundness");
|
|
2345
|
+
o(this, "cycleSquareSide");
|
|
2346
|
+
o(this, "detourDirection");
|
|
2347
|
+
o(this, "detourDistance");
|
|
2348
|
+
o(this, "hasSourceArrow");
|
|
2349
|
+
o(this, "hasTargetArrow");
|
|
2350
|
+
o(this, "pathShape");
|
|
2351
|
+
o(this, "createCyclePath", (e) => new G({
|
|
2229
2352
|
sourceDirection: e,
|
|
2230
2353
|
arrowLength: this.arrowLength,
|
|
2231
2354
|
side: this.cycleSquareSide,
|
|
@@ -2234,12 +2357,12 @@ class rt {
|
|
|
2234
2357
|
hasSourceArrow: this.hasSourceArrow,
|
|
2235
2358
|
hasTargetArrow: this.hasTargetArrow
|
|
2236
2359
|
}));
|
|
2237
|
-
|
|
2238
|
-
to:
|
|
2360
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
2361
|
+
to: s,
|
|
2239
2362
|
sourceDirection: e,
|
|
2240
|
-
targetDirection:
|
|
2241
|
-
flipX:
|
|
2242
|
-
flipY:
|
|
2363
|
+
targetDirection: t,
|
|
2364
|
+
flipX: i,
|
|
2365
|
+
flipY: n,
|
|
2243
2366
|
arrowLength: this.arrowLength,
|
|
2244
2367
|
arrowOffset: this.arrowOffset,
|
|
2245
2368
|
roundness: this.roundness,
|
|
@@ -2248,10 +2371,10 @@ class rt {
|
|
|
2248
2371
|
hasSourceArrow: this.hasSourceArrow,
|
|
2249
2372
|
hasTargetArrow: this.hasTargetArrow
|
|
2250
2373
|
}));
|
|
2251
|
-
|
|
2252
|
-
to:
|
|
2374
|
+
o(this, "createLinePath", (e, t, s) => new _e({
|
|
2375
|
+
to: s,
|
|
2253
2376
|
sourceDirection: e,
|
|
2254
|
-
targetDirection:
|
|
2377
|
+
targetDirection: t,
|
|
2255
2378
|
arrowLength: this.arrowLength,
|
|
2256
2379
|
arrowOffset: this.arrowOffset,
|
|
2257
2380
|
roundness: this.roundness,
|
|
@@ -2259,12 +2382,12 @@ class rt {
|
|
|
2259
2382
|
hasTargetArrow: this.hasTargetArrow
|
|
2260
2383
|
}));
|
|
2261
2384
|
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
|
|
2262
|
-
const
|
|
2385
|
+
const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
|
|
2263
2386
|
this.roundness = Math.min(
|
|
2264
|
-
|
|
2387
|
+
t,
|
|
2265
2388
|
this.arrowOffset,
|
|
2266
2389
|
this.cycleSquareSide / 2
|
|
2267
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.
|
|
2390
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
|
|
2268
2391
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2269
2392
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2270
2393
|
arrowLength: this.arrowLength,
|
|
@@ -2274,30 +2397,31 @@ class rt {
|
|
|
2274
2397
|
createCyclePath: this.createCyclePath,
|
|
2275
2398
|
createDetourPath: this.createDetourPath,
|
|
2276
2399
|
createLinePath: this.createLinePath
|
|
2277
|
-
}), this.svg = this.
|
|
2400
|
+
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
2278
2401
|
}
|
|
2279
2402
|
render(e) {
|
|
2280
|
-
this.
|
|
2403
|
+
this.pathShape.render(e);
|
|
2281
2404
|
}
|
|
2282
2405
|
}
|
|
2283
2406
|
class it {
|
|
2284
2407
|
constructor(e) {
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2408
|
+
o(this, "svg");
|
|
2409
|
+
o(this, "group");
|
|
2410
|
+
o(this, "line");
|
|
2411
|
+
o(this, "sourceArrow");
|
|
2412
|
+
o(this, "targetArrow");
|
|
2413
|
+
o(this, "onAfterRender");
|
|
2414
|
+
o(this, "arrowLength");
|
|
2415
|
+
o(this, "arrowWidth");
|
|
2416
|
+
o(this, "arrowOffset");
|
|
2417
|
+
o(this, "roundness");
|
|
2418
|
+
o(this, "cycleSquareSide");
|
|
2419
|
+
o(this, "detourDirection");
|
|
2420
|
+
o(this, "detourDistance");
|
|
2421
|
+
o(this, "hasSourceArrow");
|
|
2422
|
+
o(this, "hasTargetArrow");
|
|
2423
|
+
o(this, "pathShape");
|
|
2424
|
+
o(this, "createCyclePath", (e) => new G({
|
|
2301
2425
|
sourceDirection: e,
|
|
2302
2426
|
arrowLength: this.arrowLength,
|
|
2303
2427
|
side: this.cycleSquareSide,
|
|
@@ -2306,12 +2430,12 @@ class it {
|
|
|
2306
2430
|
hasSourceArrow: this.hasSourceArrow,
|
|
2307
2431
|
hasTargetArrow: this.hasTargetArrow
|
|
2308
2432
|
}));
|
|
2309
|
-
|
|
2310
|
-
to:
|
|
2433
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
2434
|
+
to: s,
|
|
2311
2435
|
sourceDirection: e,
|
|
2312
|
-
targetDirection:
|
|
2313
|
-
flipX:
|
|
2314
|
-
flipY:
|
|
2436
|
+
targetDirection: t,
|
|
2437
|
+
flipX: i,
|
|
2438
|
+
flipY: n,
|
|
2315
2439
|
arrowLength: this.arrowLength,
|
|
2316
2440
|
arrowOffset: this.arrowOffset,
|
|
2317
2441
|
roundness: this.roundness,
|
|
@@ -2320,11 +2444,11 @@ class it {
|
|
|
2320
2444
|
hasSourceArrow: this.hasSourceArrow,
|
|
2321
2445
|
hasTargetArrow: this.hasTargetArrow
|
|
2322
2446
|
}));
|
|
2323
|
-
|
|
2324
|
-
to:
|
|
2447
|
+
o(this, "createLinePath", (e, t, s, i, n) => new qe({
|
|
2448
|
+
to: s,
|
|
2325
2449
|
sourceDirection: e,
|
|
2326
|
-
targetDirection:
|
|
2327
|
-
flipY:
|
|
2450
|
+
targetDirection: t,
|
|
2451
|
+
flipY: n,
|
|
2328
2452
|
arrowLength: this.arrowLength,
|
|
2329
2453
|
arrowOffset: this.arrowOffset,
|
|
2330
2454
|
roundness: this.roundness,
|
|
@@ -2332,12 +2456,12 @@ class it {
|
|
|
2332
2456
|
hasTargetArrow: this.hasTargetArrow
|
|
2333
2457
|
}));
|
|
2334
2458
|
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
|
|
2335
|
-
const
|
|
2459
|
+
const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
|
|
2336
2460
|
this.roundness = Math.min(
|
|
2337
|
-
|
|
2461
|
+
t,
|
|
2338
2462
|
this.arrowOffset,
|
|
2339
2463
|
this.cycleSquareSide / 2
|
|
2340
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.
|
|
2464
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
|
|
2341
2465
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2342
2466
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2343
2467
|
arrowLength: this.arrowLength,
|
|
@@ -2347,270 +2471,253 @@ class it {
|
|
|
2347
2471
|
createCyclePath: this.createCyclePath,
|
|
2348
2472
|
createDetourPath: this.createDetourPath,
|
|
2349
2473
|
createLinePath: this.createLinePath
|
|
2350
|
-
}), this.svg = this.
|
|
2474
|
+
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
2351
2475
|
}
|
|
2352
2476
|
render(e) {
|
|
2353
|
-
this.
|
|
2477
|
+
this.pathShape.render(e);
|
|
2354
2478
|
}
|
|
2355
2479
|
}
|
|
2356
|
-
const
|
|
2357
|
-
if (
|
|
2480
|
+
const se = (r) => {
|
|
2481
|
+
if (r.diagonalDistance === 0)
|
|
2358
2482
|
return "";
|
|
2359
|
-
const e =
|
|
2360
|
-
x:
|
|
2361
|
-
y:
|
|
2362
|
-
},
|
|
2363
|
-
x:
|
|
2364
|
-
y:
|
|
2483
|
+
const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
|
|
2484
|
+
x: t * e + r.shift.x,
|
|
2485
|
+
y: s * e + r.shift.y
|
|
2486
|
+
}, n = {
|
|
2487
|
+
x: t / r.diagonalDistance,
|
|
2488
|
+
y: s / r.diagonalDistance
|
|
2365
2489
|
};
|
|
2366
2490
|
return O(
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2491
|
+
n,
|
|
2492
|
+
i,
|
|
2493
|
+
r.arrowLength,
|
|
2494
|
+
r.arrowWidth
|
|
2371
2495
|
);
|
|
2372
|
-
}, se = (t) => {
|
|
2373
|
-
const e = t.hasArrow ? t.arrowLength : 0, o = t.offset + e, i = t.flip * o / t.diagonalDistance;
|
|
2374
|
-
return {
|
|
2375
|
-
x: t.to.x * i + t.shift.x,
|
|
2376
|
-
y: t.to.y * i + t.shift.y
|
|
2377
|
-
};
|
|
2378
|
-
}, st = (t) => {
|
|
2379
|
-
const e = se({
|
|
2380
|
-
diagonalDistance: t.diagonalDistance,
|
|
2381
|
-
to: t.to,
|
|
2382
|
-
offset: t.sourceOffset,
|
|
2383
|
-
hasArrow: t.hasSourceArrow,
|
|
2384
|
-
flip: 1,
|
|
2385
|
-
shift: g,
|
|
2386
|
-
arrowLength: t.arrowLength
|
|
2387
|
-
}), o = se({
|
|
2388
|
-
diagonalDistance: t.diagonalDistance,
|
|
2389
|
-
to: t.to,
|
|
2390
|
-
offset: t.targetOffset,
|
|
2391
|
-
hasArrow: t.hasTargetArrow,
|
|
2392
|
-
flip: -1,
|
|
2393
|
-
shift: t.to,
|
|
2394
|
-
arrowLength: t.arrowLength
|
|
2395
|
-
});
|
|
2396
|
-
return `M ${e.x} ${e.y} L ${o.x} ${o.y}`;
|
|
2397
2496
|
};
|
|
2398
2497
|
class nt {
|
|
2399
2498
|
constructor(e) {
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2499
|
+
o(this, "svg");
|
|
2500
|
+
o(this, "group", ue());
|
|
2501
|
+
o(this, "line");
|
|
2502
|
+
o(this, "sourceArrow", null);
|
|
2503
|
+
o(this, "targetArrow", null);
|
|
2504
|
+
o(this, "color");
|
|
2505
|
+
o(this, "width");
|
|
2506
|
+
o(this, "arrowLength");
|
|
2507
|
+
o(this, "arrowWidth");
|
|
2508
|
+
o(this, "sourceOffset");
|
|
2509
|
+
o(this, "targetOffset");
|
|
2510
|
+
o(this, "onAfterRender");
|
|
2511
|
+
o(this, "afterRenderEmitter");
|
|
2512
|
+
[this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = ge(this.color), this.svg.appendChild(this.group), this.line = we(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
|
|
2412
2513
|
}
|
|
2413
2514
|
render(e) {
|
|
2414
|
-
const { x:
|
|
2515
|
+
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
|
|
2415
2516
|
e.from,
|
|
2416
2517
|
e.to
|
|
2417
2518
|
);
|
|
2418
|
-
le(this.svg, { x:
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
this.
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
arrowWidth: this.arrowWidth,
|
|
2453
|
-
arrowLength: this.arrowLength
|
|
2454
|
-
});
|
|
2455
|
-
this.targetArrow.setAttribute("d", l);
|
|
2456
|
-
}
|
|
2519
|
+
le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2520
|
+
const d = { x: i, y: n }, c = new tt({
|
|
2521
|
+
to: d,
|
|
2522
|
+
sourceOffset: this.sourceOffset,
|
|
2523
|
+
targetOffset: this.targetOffset,
|
|
2524
|
+
hasSourceArrow: this.sourceArrow !== null,
|
|
2525
|
+
hasTargetArrow: this.targetArrow !== null,
|
|
2526
|
+
arrowLength: this.arrowLength
|
|
2527
|
+
});
|
|
2528
|
+
this.line.setAttribute("d", c.path);
|
|
2529
|
+
let g = null;
|
|
2530
|
+
this.sourceArrow && (g = se({
|
|
2531
|
+
diagonalDistance: c.diagonalDistance,
|
|
2532
|
+
to: d,
|
|
2533
|
+
offset: this.sourceOffset,
|
|
2534
|
+
flip: 1,
|
|
2535
|
+
shift: w,
|
|
2536
|
+
arrowWidth: this.arrowWidth,
|
|
2537
|
+
arrowLength: this.arrowLength
|
|
2538
|
+
}), this.sourceArrow.setAttribute("d", g));
|
|
2539
|
+
let l = null;
|
|
2540
|
+
this.targetArrow && (l = se({
|
|
2541
|
+
diagonalDistance: c.diagonalDistance,
|
|
2542
|
+
to: d,
|
|
2543
|
+
offset: this.targetOffset,
|
|
2544
|
+
flip: -1,
|
|
2545
|
+
shift: d,
|
|
2546
|
+
arrowWidth: this.arrowWidth,
|
|
2547
|
+
arrowLength: this.arrowLength
|
|
2548
|
+
}), this.targetArrow.setAttribute("d", l)), this.afterRenderEmitter.emit({
|
|
2549
|
+
edgePath: c,
|
|
2550
|
+
sourceArrowPath: g,
|
|
2551
|
+
targetArrowPath: l
|
|
2552
|
+
});
|
|
2457
2553
|
}
|
|
2458
2554
|
}
|
|
2459
2555
|
const ht = () => {
|
|
2460
|
-
const
|
|
2461
|
-
return
|
|
2462
|
-
},
|
|
2556
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2557
|
+
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
2558
|
+
}, at = (r) => {
|
|
2463
2559
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2464
|
-
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${
|
|
2465
|
-
},
|
|
2560
|
+
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
2561
|
+
}, ie = (r) => {
|
|
2466
2562
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2467
|
-
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${
|
|
2563
|
+
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
2468
2564
|
};
|
|
2469
|
-
class
|
|
2565
|
+
class dt extends Error {
|
|
2470
2566
|
constructor(e) {
|
|
2471
2567
|
super(e), this.name = "InteractiveEdgeError";
|
|
2472
2568
|
}
|
|
2473
2569
|
}
|
|
2474
|
-
class
|
|
2475
|
-
constructor(e,
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2570
|
+
class fe {
|
|
2571
|
+
constructor(e, t) {
|
|
2572
|
+
o(this, "svg");
|
|
2573
|
+
o(this, "group");
|
|
2574
|
+
o(this, "line");
|
|
2575
|
+
o(this, "sourceArrow");
|
|
2576
|
+
o(this, "targetArrow");
|
|
2577
|
+
o(this, "handle", ht());
|
|
2578
|
+
o(this, "onAfterRender");
|
|
2579
|
+
o(this, "interactiveLine");
|
|
2580
|
+
o(this, "interactiveSourceArrow", null);
|
|
2581
|
+
o(this, "interactiveTargetArrow", null);
|
|
2582
|
+
if (this.baseEdge = e, e instanceof fe)
|
|
2583
|
+
throw new dt(
|
|
2487
2584
|
"interactive edge can be configured only once"
|
|
2488
2585
|
);
|
|
2489
|
-
this.svg = this.
|
|
2490
|
-
const
|
|
2491
|
-
this.interactiveLine =
|
|
2586
|
+
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
2587
|
+
const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
|
|
2588
|
+
this.interactiveLine = at(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ie(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ie(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
2589
|
+
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
2590
|
+
});
|
|
2492
2591
|
}
|
|
2493
2592
|
render(e) {
|
|
2494
|
-
this.
|
|
2495
|
-
const o = this.line.getAttribute("d");
|
|
2496
|
-
if (this.interactiveLine.setAttribute("d", o), this.sourceArrow) {
|
|
2497
|
-
const i = this.sourceArrow.getAttribute("d");
|
|
2498
|
-
this.interactiveSourceArrow.setAttribute("d", i);
|
|
2499
|
-
}
|
|
2500
|
-
if (this.targetArrow) {
|
|
2501
|
-
const i = this.targetArrow.getAttribute("d");
|
|
2502
|
-
this.interactiveTargetArrow.setAttribute("d", i);
|
|
2503
|
-
}
|
|
2593
|
+
this.baseEdge.render(e);
|
|
2504
2594
|
}
|
|
2505
2595
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2596
|
+
class ut {
|
|
2597
|
+
constructor(e, t) {
|
|
2598
|
+
o(this, "group");
|
|
2599
|
+
o(this, "line");
|
|
2600
|
+
o(this, "sourceArrow");
|
|
2601
|
+
o(this, "targetArrow");
|
|
2602
|
+
o(this, "onAfterRender");
|
|
2603
|
+
o(this, "svg");
|
|
2604
|
+
this.baseShape = e, this.medianElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.medianElement), this.baseShape.onAfterRender.subscribe((s) => {
|
|
2605
|
+
const i = s.edgePath.median, n = `translate(${i.x}px, ${i.y}px)`;
|
|
2606
|
+
this.medianElement.style.setProperty("transform", n);
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
render(e) {
|
|
2610
|
+
this.baseShape.render(e);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
const ct = (r) => {
|
|
2614
|
+
if (typeof r == "function")
|
|
2615
|
+
return r;
|
|
2616
|
+
switch (r == null ? void 0 : r.type) {
|
|
2510
2617
|
case "straight":
|
|
2511
|
-
return () => new
|
|
2512
|
-
color:
|
|
2513
|
-
width:
|
|
2514
|
-
arrowLength:
|
|
2515
|
-
arrowWidth:
|
|
2516
|
-
arrowOffset:
|
|
2517
|
-
hasSourceArrow:
|
|
2518
|
-
hasTargetArrow:
|
|
2519
|
-
cycleSquareSide:
|
|
2520
|
-
roundness:
|
|
2521
|
-
detourDistance:
|
|
2522
|
-
detourDirection:
|
|
2618
|
+
return () => new st({
|
|
2619
|
+
color: r.color,
|
|
2620
|
+
width: r.width,
|
|
2621
|
+
arrowLength: r.arrowLength,
|
|
2622
|
+
arrowWidth: r.arrowWidth,
|
|
2623
|
+
arrowOffset: r.arrowOffset,
|
|
2624
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
2625
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
2626
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
2627
|
+
roundness: r.roundness,
|
|
2628
|
+
detourDistance: r.detourDistance,
|
|
2629
|
+
detourDirection: r.detourDirection
|
|
2523
2630
|
});
|
|
2524
2631
|
case "horizontal":
|
|
2525
2632
|
return () => new ot({
|
|
2526
|
-
color:
|
|
2527
|
-
width:
|
|
2528
|
-
arrowLength:
|
|
2529
|
-
arrowWidth:
|
|
2530
|
-
arrowOffset:
|
|
2531
|
-
hasSourceArrow:
|
|
2532
|
-
hasTargetArrow:
|
|
2533
|
-
cycleSquareSide:
|
|
2534
|
-
roundness:
|
|
2535
|
-
detourDistance:
|
|
2536
|
-
detourDirection:
|
|
2633
|
+
color: r.color,
|
|
2634
|
+
width: r.width,
|
|
2635
|
+
arrowLength: r.arrowLength,
|
|
2636
|
+
arrowWidth: r.arrowWidth,
|
|
2637
|
+
arrowOffset: r.arrowOffset,
|
|
2638
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
2639
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
2640
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
2641
|
+
roundness: r.roundness,
|
|
2642
|
+
detourDistance: r.detourDistance,
|
|
2643
|
+
detourDirection: r.detourDirection
|
|
2537
2644
|
});
|
|
2538
2645
|
case "vertical":
|
|
2539
2646
|
return () => new it({
|
|
2540
|
-
color:
|
|
2541
|
-
width:
|
|
2542
|
-
arrowLength:
|
|
2543
|
-
arrowWidth:
|
|
2544
|
-
arrowOffset:
|
|
2545
|
-
hasSourceArrow:
|
|
2546
|
-
hasTargetArrow:
|
|
2547
|
-
cycleSquareSide:
|
|
2548
|
-
roundness:
|
|
2549
|
-
detourDistance:
|
|
2550
|
-
detourDirection:
|
|
2647
|
+
color: r.color,
|
|
2648
|
+
width: r.width,
|
|
2649
|
+
arrowLength: r.arrowLength,
|
|
2650
|
+
arrowWidth: r.arrowWidth,
|
|
2651
|
+
arrowOffset: r.arrowOffset,
|
|
2652
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
2653
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
2654
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
2655
|
+
roundness: r.roundness,
|
|
2656
|
+
detourDistance: r.detourDistance,
|
|
2657
|
+
detourDirection: r.detourDirection
|
|
2551
2658
|
});
|
|
2552
2659
|
case "direct":
|
|
2553
2660
|
return () => new nt({
|
|
2554
|
-
color:
|
|
2555
|
-
width:
|
|
2556
|
-
arrowLength:
|
|
2557
|
-
arrowWidth:
|
|
2558
|
-
hasSourceArrow:
|
|
2559
|
-
hasTargetArrow:
|
|
2560
|
-
sourceOffset:
|
|
2561
|
-
targetOffset:
|
|
2661
|
+
color: r.color,
|
|
2662
|
+
width: r.width,
|
|
2663
|
+
arrowLength: r.arrowLength,
|
|
2664
|
+
arrowWidth: r.arrowWidth,
|
|
2665
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
2666
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
2667
|
+
sourceOffset: r.sourceOffset,
|
|
2668
|
+
targetOffset: r.targetOffset
|
|
2562
2669
|
});
|
|
2563
2670
|
default:
|
|
2564
|
-
return () => new
|
|
2565
|
-
color:
|
|
2566
|
-
width:
|
|
2567
|
-
arrowLength:
|
|
2568
|
-
arrowWidth:
|
|
2569
|
-
hasSourceArrow:
|
|
2570
|
-
hasTargetArrow:
|
|
2571
|
-
cycleRadius:
|
|
2572
|
-
smallCycleRadius:
|
|
2573
|
-
curvature:
|
|
2574
|
-
detourDistance:
|
|
2575
|
-
detourDirection:
|
|
2671
|
+
return () => new rt({
|
|
2672
|
+
color: r.color,
|
|
2673
|
+
width: r.width,
|
|
2674
|
+
arrowLength: r.arrowLength,
|
|
2675
|
+
arrowWidth: r.arrowWidth,
|
|
2676
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
2677
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
2678
|
+
cycleRadius: r.cycleRadius,
|
|
2679
|
+
smallCycleRadius: r.smallCycleRadius,
|
|
2680
|
+
curvature: r.curvature,
|
|
2681
|
+
detourDistance: r.detourDistance,
|
|
2682
|
+
detourDirection: r.detourDirection
|
|
2576
2683
|
});
|
|
2577
2684
|
}
|
|
2578
|
-
}, lt = (
|
|
2579
|
-
var
|
|
2685
|
+
}, lt = (r) => {
|
|
2686
|
+
var t, s, i, n, h;
|
|
2580
2687
|
const e = Ze(
|
|
2581
|
-
(
|
|
2582
|
-
(
|
|
2688
|
+
(t = r.nodes) == null ? void 0 : t.priority,
|
|
2689
|
+
(s = r.edges) == null ? void 0 : s.priority
|
|
2583
2690
|
);
|
|
2584
2691
|
return {
|
|
2585
2692
|
nodes: {
|
|
2586
|
-
centerFn: ((
|
|
2693
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? je,
|
|
2587
2694
|
priorityFn: e.nodesPriorityFn
|
|
2588
2695
|
},
|
|
2589
2696
|
ports: {
|
|
2590
|
-
direction: ((
|
|
2697
|
+
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2591
2698
|
},
|
|
2592
2699
|
edges: {
|
|
2593
|
-
shapeFactory:
|
|
2700
|
+
shapeFactory: ct(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
|
|
2594
2701
|
priorityFn: e.edgesPriorityFn
|
|
2595
2702
|
}
|
|
2596
2703
|
};
|
|
2597
2704
|
};
|
|
2598
|
-
class
|
|
2705
|
+
class wt {
|
|
2599
2706
|
constructor(e) {
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2707
|
+
o(this, "element", null);
|
|
2708
|
+
o(this, "canvasDefaults", {});
|
|
2709
|
+
o(this, "dragConfig", {});
|
|
2710
|
+
o(this, "transformConfig", {});
|
|
2711
|
+
o(this, "backgroundConfig", {});
|
|
2712
|
+
o(this, "connectablePortsConfig", {});
|
|
2713
|
+
o(this, "virtualScrollConfig");
|
|
2714
|
+
o(this, "hasDraggableNode", !1);
|
|
2715
|
+
o(this, "hasTransformableViewport", !1);
|
|
2716
|
+
o(this, "hasResizeReactiveNodes", !1);
|
|
2717
|
+
o(this, "hasBackground", !1);
|
|
2718
|
+
o(this, "hasUserConnectablePorts", !1);
|
|
2719
|
+
o(this, "boxRenderingTrigger");
|
|
2720
|
+
o(this, "window", window);
|
|
2614
2721
|
e !== void 0 && (this.element = e);
|
|
2615
2722
|
}
|
|
2616
2723
|
/**
|
|
@@ -2678,52 +2785,52 @@ class gt {
|
|
|
2678
2785
|
"unable to build canvas when no attach element specified"
|
|
2679
2786
|
);
|
|
2680
2787
|
let e = this.boxRenderingTrigger;
|
|
2681
|
-
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new
|
|
2682
|
-
const
|
|
2683
|
-
let
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2788
|
+
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
|
|
2789
|
+
const t = new de(), s = new De(), i = new He(this.element);
|
|
2790
|
+
let n = new ne(
|
|
2791
|
+
t,
|
|
2792
|
+
s,
|
|
2793
|
+
i.main
|
|
2687
2794
|
);
|
|
2688
|
-
e !== void 0 && (
|
|
2689
|
-
const
|
|
2795
|
+
e !== void 0 && (n = new Se(n, t, e));
|
|
2796
|
+
const h = lt(this.canvasDefaults), a = new ae(
|
|
2690
2797
|
this.element,
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
),
|
|
2696
|
-
|
|
2798
|
+
t,
|
|
2799
|
+
s,
|
|
2800
|
+
n,
|
|
2801
|
+
h
|
|
2802
|
+
), d = () => {
|
|
2803
|
+
i.destroy(), a.onBeforeDestroy.unsubscribe(d);
|
|
2697
2804
|
};
|
|
2698
|
-
return
|
|
2699
|
-
|
|
2805
|
+
return a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
|
|
2806
|
+
a,
|
|
2700
2807
|
this.backgroundConfig,
|
|
2701
|
-
|
|
2702
|
-
), this.hasResizeReactiveNodes && k.configure(
|
|
2703
|
-
|
|
2704
|
-
|
|
2808
|
+
i.background
|
|
2809
|
+
), this.hasResizeReactiveNodes && k.configure(a), this.hasDraggableNode && z.configure(
|
|
2810
|
+
a,
|
|
2811
|
+
i.main,
|
|
2705
2812
|
this.window,
|
|
2706
2813
|
this.dragConfig
|
|
2707
2814
|
), this.hasUserConnectablePorts && H.configure(
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2815
|
+
a,
|
|
2816
|
+
i.overlay,
|
|
2817
|
+
s,
|
|
2711
2818
|
this.window,
|
|
2712
|
-
|
|
2819
|
+
h,
|
|
2713
2820
|
this.connectablePortsConfig
|
|
2714
2821
|
), this.virtualScrollConfig !== void 0 ? X.configure(
|
|
2715
|
-
|
|
2716
|
-
|
|
2822
|
+
a,
|
|
2823
|
+
i.main,
|
|
2717
2824
|
this.window,
|
|
2718
2825
|
this.transformConfig,
|
|
2719
2826
|
e,
|
|
2720
2827
|
this.virtualScrollConfig
|
|
2721
|
-
) : this.hasTransformableViewport &&
|
|
2722
|
-
|
|
2723
|
-
|
|
2828
|
+
) : this.hasTransformableViewport && C.configure(
|
|
2829
|
+
a,
|
|
2830
|
+
i.main,
|
|
2724
2831
|
this.window,
|
|
2725
2832
|
this.transformConfig
|
|
2726
|
-
), this.reset(),
|
|
2833
|
+
), this.reset(), a;
|
|
2727
2834
|
}
|
|
2728
2835
|
/**
|
|
2729
2836
|
* @deprecated
|
|
@@ -2734,15 +2841,16 @@ class gt {
|
|
|
2734
2841
|
}
|
|
2735
2842
|
}
|
|
2736
2843
|
export {
|
|
2737
|
-
|
|
2738
|
-
|
|
2844
|
+
rt as BezierEdgeShape,
|
|
2845
|
+
wt as CanvasBuilder,
|
|
2739
2846
|
nt as DirectEdgeShape,
|
|
2740
|
-
|
|
2847
|
+
he as EventSubject,
|
|
2741
2848
|
ot as HorizontalEdgeShape,
|
|
2742
2849
|
S as HtmlGraphError,
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2850
|
+
dt as InteractiveEdgeError,
|
|
2851
|
+
fe as InteractiveEdgeShape,
|
|
2852
|
+
U as LineEdgeShape,
|
|
2853
|
+
ut as MedianEdgeShape,
|
|
2854
|
+
st as StraightEdgeShape,
|
|
2747
2855
|
it as VerticalEdgeShape
|
|
2748
2856
|
};
|