@html-graph/html-graph 7.1.1 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +18 -0
- package/dist/html-graph.js +1390 -957
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var ze = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => ze(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
const D = (r, e) => ({
|
|
5
5
|
x: r.scale * e.x + r.x,
|
|
6
6
|
y: r.scale * e.y + r.y
|
|
7
7
|
});
|
|
8
|
-
var
|
|
9
|
-
const
|
|
8
|
+
var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
|
|
9
|
+
const He = () => {
|
|
10
10
|
const r = document.createElement("div");
|
|
11
11
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
12
|
-
},
|
|
12
|
+
}, Xe = () => {
|
|
13
13
|
const r = document.createElement("div");
|
|
14
14
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
15
|
-
},
|
|
15
|
+
}, Ye = (r) => {
|
|
16
16
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
18
|
+
class me {
|
|
19
19
|
constructor(e, t, s) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
i(this, "host", He());
|
|
21
|
+
i(this, "container", Xe());
|
|
22
|
+
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
23
|
+
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
24
|
+
i(this, "applyTransform", () => {
|
|
25
25
|
const e = this.viewportStore.getContentMatrix();
|
|
26
26
|
this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
|
|
27
27
|
});
|
|
@@ -29,7 +29,7 @@ class ye {
|
|
|
29
29
|
}
|
|
30
30
|
attachNode(e) {
|
|
31
31
|
const t = this.graphStore.getNode(e);
|
|
32
|
-
|
|
32
|
+
Ye(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
33
33
|
}
|
|
34
34
|
detachNode(e) {
|
|
35
35
|
const t = this.graphStore.getNode(e);
|
|
@@ -54,7 +54,7 @@ class ye {
|
|
|
54
54
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
55
55
|
}
|
|
56
56
|
updateNodePosition(e) {
|
|
57
|
-
const t = this.graphStore.getNode(e), { width: s, height:
|
|
57
|
+
const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
58
58
|
t.element.style.transform = `translate(${d}px, ${c}px)`;
|
|
59
59
|
}
|
|
60
60
|
updateNodePriority(e) {
|
|
@@ -64,87 +64,87 @@ class ye {
|
|
|
64
64
|
updateEdgeShape(e) {
|
|
65
65
|
const t = this.edgeIdToElementMap.get(e);
|
|
66
66
|
this.container.removeChild(t);
|
|
67
|
-
const
|
|
68
|
-
this.edgeIdToElementMap.set(e,
|
|
67
|
+
const o = this.graphStore.getEdge(e).payload.shape.svg;
|
|
68
|
+
this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
|
|
69
69
|
}
|
|
70
70
|
renderEdge(e) {
|
|
71
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from),
|
|
71
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = o.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
|
|
72
72
|
s,
|
|
73
73
|
n,
|
|
74
74
|
h,
|
|
75
75
|
d
|
|
76
76
|
), g = this.createEdgeRenderPort(
|
|
77
|
-
|
|
77
|
+
o,
|
|
78
78
|
a,
|
|
79
79
|
h,
|
|
80
80
|
d
|
|
81
81
|
);
|
|
82
|
-
let l =
|
|
83
|
-
s.element ===
|
|
82
|
+
let l = R.Line;
|
|
83
|
+
s.element === o.element ? l = R.PortCycle : s.nodeId === o.nodeId && (l = R.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
84
84
|
}
|
|
85
85
|
updateEdgePriority(e) {
|
|
86
86
|
const t = this.graphStore.getEdge(e);
|
|
87
87
|
t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
|
|
88
88
|
}
|
|
89
|
-
createEdgeRenderPort(e, t, s,
|
|
89
|
+
createEdgeRenderPort(e, t, s, o) {
|
|
90
90
|
const n = {
|
|
91
91
|
x: t.left - s.left,
|
|
92
92
|
y: t.top - s.top
|
|
93
|
-
}, a = D(
|
|
93
|
+
}, a = D(o, n);
|
|
94
94
|
return {
|
|
95
95
|
x: a.x,
|
|
96
96
|
y: a.y,
|
|
97
|
-
width: t.width *
|
|
98
|
-
height: t.height *
|
|
97
|
+
width: t.width * o.scale,
|
|
98
|
+
height: t.height * o.scale,
|
|
99
99
|
direction: e.payload.direction
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class Ge {
|
|
104
104
|
constructor(e) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
i(this, "xFrom", 1 / 0);
|
|
106
|
+
i(this, "yFrom", 1 / 0);
|
|
107
|
+
i(this, "xTo", 1 / 0);
|
|
108
|
+
i(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 t = this.graphStore.getNode(e).payload, { x: s, y:
|
|
116
|
-
return s >= this.xFrom && s <= this.xTo &&
|
|
115
|
+
const t = this.graphStore.getNode(e).payload, { x: s, y: o } = t;
|
|
116
|
+
return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
|
|
117
117
|
}
|
|
118
118
|
hasEdge(e) {
|
|
119
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId,
|
|
119
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(o).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
|
|
120
120
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
124
|
-
constructor(e, t, s,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
class je {
|
|
124
|
+
constructor(e, t, s, o) {
|
|
125
|
+
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
|
+
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
127
|
+
i(this, "renderingBox");
|
|
128
|
+
i(this, "updateViewport", (e) => {
|
|
129
129
|
this.renderingBox.setRenderingBox(e);
|
|
130
|
-
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(),
|
|
130
|
+
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
131
131
|
this.graphStore.getAllNodeIds().forEach((a) => {
|
|
132
132
|
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
133
133
|
h && !d ? t.add(a) : !h && d && s.add(a);
|
|
134
134
|
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
135
135
|
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
|
|
136
|
-
h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ?
|
|
136
|
+
h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? o.add(a) : !h && d && n.add(a);
|
|
137
137
|
}), n.forEach((a) => {
|
|
138
138
|
this.handleDetachEdge(a);
|
|
139
139
|
}), s.forEach((a) => {
|
|
140
140
|
this.handleDetachNode(a);
|
|
141
141
|
}), t.forEach((a) => {
|
|
142
142
|
this.attachedNodes.has(a) || this.handleAttachNode(a);
|
|
143
|
-
}),
|
|
143
|
+
}), o.forEach((a) => {
|
|
144
144
|
this.handleAttachEdge(a);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params =
|
|
147
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -182,8 +182,8 @@ class Ye {
|
|
|
182
182
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
183
183
|
}
|
|
184
184
|
attachEdgeEntities(e) {
|
|
185
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId,
|
|
186
|
-
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(
|
|
185
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId;
|
|
186
|
+
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(o) || this.handleAttachNode(o), this.handleAttachEdge(e);
|
|
187
187
|
}
|
|
188
188
|
handleAttachNode(e) {
|
|
189
189
|
this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
|
|
@@ -198,10 +198,10 @@ class Ye {
|
|
|
198
198
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class Ke {
|
|
202
202
|
constructor(e, t) {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
204
|
+
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
205
205
|
this.htmlView = e, this.graphStore = t;
|
|
206
206
|
}
|
|
207
207
|
attachNode(e) {
|
|
@@ -245,16 +245,16 @@ class He {
|
|
|
245
245
|
this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
|
|
246
246
|
}
|
|
247
247
|
isEdgeValid(e) {
|
|
248
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from),
|
|
249
|
-
return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(
|
|
248
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
|
|
249
|
+
return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
|
|
250
250
|
}
|
|
251
251
|
tryAttachEdge(e) {
|
|
252
252
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
class
|
|
255
|
+
class j {
|
|
256
256
|
constructor() {
|
|
257
|
-
|
|
257
|
+
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
258
258
|
}
|
|
259
259
|
subscribe(e) {
|
|
260
260
|
this.callbacks.add(e);
|
|
@@ -268,13 +268,13 @@ class G {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
const r = new
|
|
271
|
+
const E = () => {
|
|
272
|
+
const r = new j();
|
|
273
273
|
return [r, r];
|
|
274
274
|
};
|
|
275
|
-
class
|
|
275
|
+
class X {
|
|
276
276
|
constructor(e) {
|
|
277
|
-
|
|
277
|
+
i(this, "counter", 0);
|
|
278
278
|
this.checkExists = e;
|
|
279
279
|
}
|
|
280
280
|
create(e) {
|
|
@@ -288,80 +288,80 @@ class Y {
|
|
|
288
288
|
this.counter = 0;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
class
|
|
291
|
+
class b extends Error {
|
|
292
292
|
constructor() {
|
|
293
293
|
super(...arguments);
|
|
294
|
-
|
|
294
|
+
i(this, "name", "CanvasError");
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
class ve {
|
|
298
|
-
constructor(e, t, s,
|
|
299
|
-
|
|
298
|
+
constructor(e, t, s, o, n, a) {
|
|
299
|
+
i(this, "nodeIdGenerator", new X(
|
|
300
300
|
(e) => this.graphStore.getNode(e) !== void 0
|
|
301
301
|
));
|
|
302
|
-
|
|
302
|
+
i(this, "portIdGenerator", new X(
|
|
303
303
|
(e) => this.graphStore.getPort(e) !== void 0
|
|
304
304
|
));
|
|
305
|
-
|
|
305
|
+
i(this, "edgeIdGenerator", new X(
|
|
306
306
|
(e) => this.graphStore.getEdge(e) !== void 0
|
|
307
307
|
));
|
|
308
|
-
|
|
308
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
309
309
|
this.htmlView.attachNode(e);
|
|
310
310
|
});
|
|
311
|
-
|
|
311
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
312
312
|
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
|
|
313
313
|
this.htmlView.renderEdge(s);
|
|
314
314
|
});
|
|
315
315
|
});
|
|
316
|
-
|
|
316
|
+
i(this, "onAfterNodePriorityUpdated", (e) => {
|
|
317
317
|
this.htmlView.updateNodePriority(e);
|
|
318
318
|
});
|
|
319
|
-
|
|
319
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
320
320
|
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
321
321
|
this.unmarkPort(t);
|
|
322
322
|
}), this.htmlView.detachNode(e);
|
|
323
323
|
});
|
|
324
|
-
|
|
324
|
+
i(this, "onAfterPortUpdated", (e) => {
|
|
325
325
|
this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
|
|
326
326
|
this.htmlView.renderEdge(s);
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
|
-
|
|
329
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
330
330
|
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
331
331
|
this.removeEdge(t);
|
|
332
332
|
});
|
|
333
333
|
});
|
|
334
|
-
|
|
334
|
+
i(this, "onAfterEdgeAdded", (e) => {
|
|
335
335
|
this.htmlView.attachEdge(e);
|
|
336
336
|
});
|
|
337
|
-
|
|
337
|
+
i(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
338
338
|
this.htmlView.updateEdgeShape(e);
|
|
339
339
|
});
|
|
340
|
-
|
|
340
|
+
i(this, "onAfterEdgeUpdated", (e) => {
|
|
341
341
|
this.htmlView.renderEdge(e);
|
|
342
342
|
});
|
|
343
|
-
|
|
343
|
+
i(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
344
344
|
this.htmlView.updateEdgePriority(e);
|
|
345
345
|
});
|
|
346
|
-
|
|
346
|
+
i(this, "onBeforeEdgeRemoved", (e) => {
|
|
347
347
|
this.htmlView.detachEdge(e);
|
|
348
348
|
});
|
|
349
|
-
|
|
349
|
+
i(this, "onBeforeClear", () => {
|
|
350
350
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
351
351
|
});
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
i(this, "onBeforeDestroyEmitter");
|
|
353
|
+
i(this, "destroyed", !1);
|
|
354
354
|
/**
|
|
355
355
|
* emits event just before destruction of canvas
|
|
356
356
|
*/
|
|
357
|
-
|
|
358
|
-
this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore =
|
|
357
|
+
i(this, "onBeforeDestroy");
|
|
358
|
+
this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = o, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
359
359
|
this.onAfterNodePriorityUpdated
|
|
360
360
|
), 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(
|
|
361
361
|
this.onAfterEdgeShapeUpdated
|
|
362
362
|
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
363
363
|
this.onAfterEdgePriorityUpdated
|
|
364
|
-
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] =
|
|
364
|
+
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* adds new node
|
|
@@ -369,9 +369,9 @@ class ve {
|
|
|
369
369
|
addNode(e) {
|
|
370
370
|
const t = this.nodeIdGenerator.create(e.id);
|
|
371
371
|
if (this.graphStore.getNode(t) !== void 0)
|
|
372
|
-
throw new
|
|
372
|
+
throw new b("failed to add node with existing id");
|
|
373
373
|
if (this.graphStore.getElementNodeId(e.element) !== void 0)
|
|
374
|
-
throw new
|
|
374
|
+
throw new b(
|
|
375
375
|
"failed to add node with html element already in use by another node"
|
|
376
376
|
);
|
|
377
377
|
if (this.graphStore.addNode({
|
|
@@ -396,7 +396,7 @@ class ve {
|
|
|
396
396
|
*/
|
|
397
397
|
updateNode(e, t) {
|
|
398
398
|
if (this.graphStore.getNode(e) === void 0)
|
|
399
|
-
throw new
|
|
399
|
+
throw new b("failed to update nonexistent node");
|
|
400
400
|
return this.graphStore.updateNode(e, t ?? {}), this;
|
|
401
401
|
}
|
|
402
402
|
/**
|
|
@@ -406,7 +406,7 @@ class ve {
|
|
|
406
406
|
*/
|
|
407
407
|
removeNode(e) {
|
|
408
408
|
if (this.graphStore.getNode(e) === void 0)
|
|
409
|
-
throw new
|
|
409
|
+
throw new b("failed to remove nonexistent node");
|
|
410
410
|
return this.graphStore.removeNode(e), this;
|
|
411
411
|
}
|
|
412
412
|
/**
|
|
@@ -415,9 +415,9 @@ class ve {
|
|
|
415
415
|
markPort(e) {
|
|
416
416
|
const t = this.portIdGenerator.create(e.id);
|
|
417
417
|
if (this.graphStore.getPort(t) !== void 0)
|
|
418
|
-
throw new
|
|
418
|
+
throw new b("failed to add port with existing id");
|
|
419
419
|
if (this.graphStore.getNode(e.nodeId) === void 0)
|
|
420
|
-
throw new
|
|
420
|
+
throw new b("failed to mark port for nonexistent node");
|
|
421
421
|
return this.graphStore.addPort({
|
|
422
422
|
id: t,
|
|
423
423
|
element: e.element,
|
|
@@ -430,7 +430,7 @@ class ve {
|
|
|
430
430
|
*/
|
|
431
431
|
updatePort(e, t) {
|
|
432
432
|
if (this.graphStore.getPort(e) === void 0)
|
|
433
|
-
throw new
|
|
433
|
+
throw new b("failed to update nonexistent port");
|
|
434
434
|
return this.graphStore.updatePort(e, t ?? {}), this;
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
@@ -439,7 +439,7 @@ class ve {
|
|
|
439
439
|
*/
|
|
440
440
|
unmarkPort(e) {
|
|
441
441
|
if (this.graphStore.getPort(e) === void 0)
|
|
442
|
-
throw new
|
|
442
|
+
throw new b("failed to unmark nonexistent port");
|
|
443
443
|
return this.graphStore.removePort(e), this;
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
@@ -448,11 +448,11 @@ class ve {
|
|
|
448
448
|
addEdge(e) {
|
|
449
449
|
const t = this.edgeIdGenerator.create(e.id);
|
|
450
450
|
if (this.graphStore.getEdge(t) !== void 0)
|
|
451
|
-
throw new
|
|
451
|
+
throw new b("failed to add edge with existing id");
|
|
452
452
|
if (this.graphStore.getPort(e.from) === void 0)
|
|
453
|
-
throw new
|
|
453
|
+
throw new b("failed to add edge from nonexistent port");
|
|
454
454
|
if (this.graphStore.getPort(e.to) === void 0)
|
|
455
|
-
throw new
|
|
455
|
+
throw new b("failed to add edge to nonexistent port");
|
|
456
456
|
return this.graphStore.addEdge({
|
|
457
457
|
id: t,
|
|
458
458
|
from: e.from,
|
|
@@ -466,7 +466,7 @@ class ve {
|
|
|
466
466
|
*/
|
|
467
467
|
updateEdge(e, t) {
|
|
468
468
|
if (this.graphStore.getEdge(e) === void 0)
|
|
469
|
-
throw new
|
|
469
|
+
throw new b("failed to update nonexistent edge");
|
|
470
470
|
return this.graphStore.updateEdge(e, t ?? {}), this;
|
|
471
471
|
}
|
|
472
472
|
/**
|
|
@@ -474,7 +474,7 @@ class ve {
|
|
|
474
474
|
*/
|
|
475
475
|
removeEdge(e) {
|
|
476
476
|
if (this.graphStore.getEdge(e) === void 0)
|
|
477
|
-
throw new
|
|
477
|
+
throw new b("failed to remove nonexistent edge");
|
|
478
478
|
return this.graphStore.removeEdge(e), this;
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
@@ -510,10 +510,10 @@ class ve {
|
|
|
510
510
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
class
|
|
513
|
+
class Qe {
|
|
514
514
|
constructor() {
|
|
515
|
-
|
|
516
|
-
|
|
515
|
+
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
516
|
+
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
517
517
|
}
|
|
518
518
|
addRecord(e, t) {
|
|
519
519
|
const s = this.singleToMultiMap.get(e);
|
|
@@ -550,43 +550,43 @@ class je {
|
|
|
550
550
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
class
|
|
553
|
+
class xe {
|
|
554
554
|
constructor() {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
555
|
+
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
556
|
+
i(this, "ports", /* @__PURE__ */ new Map());
|
|
557
|
+
i(this, "edges", /* @__PURE__ */ new Map());
|
|
558
|
+
i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
559
|
+
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
560
|
+
i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
561
|
+
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
562
|
+
i(this, "elementPorts", new Qe());
|
|
563
|
+
i(this, "afterNodeAddedEmitter");
|
|
564
|
+
i(this, "onAfterNodeAdded");
|
|
565
|
+
i(this, "afterNodeUpdatedEmitter");
|
|
566
|
+
i(this, "onAfterNodeUpdated");
|
|
567
|
+
i(this, "afterNodePriorityUpdatedEmitter");
|
|
568
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
569
|
+
i(this, "beforeNodeRemovedEmitter");
|
|
570
|
+
i(this, "onBeforeNodeRemoved");
|
|
571
|
+
i(this, "afterPortAddedEmitter");
|
|
572
|
+
i(this, "onAfterPortAdded");
|
|
573
|
+
i(this, "afterPortUpdatedEmitter");
|
|
574
|
+
i(this, "onAfterPortUpdated");
|
|
575
|
+
i(this, "beforePortRemovedEmitter");
|
|
576
|
+
i(this, "onBeforePortRemoved");
|
|
577
|
+
i(this, "afterEdgeAddedEmitter");
|
|
578
|
+
i(this, "onAfterEdgeAdded");
|
|
579
|
+
i(this, "afterEdgeShapeUpdatedEmitter");
|
|
580
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
581
|
+
i(this, "afterEdgeUpdatedEmitter");
|
|
582
|
+
i(this, "onAfterEdgeUpdated");
|
|
583
|
+
i(this, "afterEdgePriorityUpdatedEmitter");
|
|
584
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
585
|
+
i(this, "beforeEdgeRemovedEmitter");
|
|
586
|
+
i(this, "onBeforeEdgeRemoved");
|
|
587
|
+
i(this, "beforeClearEmitter");
|
|
588
|
+
i(this, "onBeforeClear");
|
|
589
|
+
[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();
|
|
590
590
|
}
|
|
591
591
|
addNode(e) {
|
|
592
592
|
const t = /* @__PURE__ */ new Map(), s = {
|
|
@@ -655,11 +655,11 @@ class Ee {
|
|
|
655
655
|
}
|
|
656
656
|
updateEdge(e, t) {
|
|
657
657
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
658
|
-
const
|
|
658
|
+
const o = this.edges.get(e), n = o.payload;
|
|
659
659
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
660
660
|
id: e,
|
|
661
|
-
from: t.from ??
|
|
662
|
-
to: t.to ??
|
|
661
|
+
from: t.from ?? o.from,
|
|
662
|
+
to: t.to ?? o.to,
|
|
663
663
|
shape: n.shape,
|
|
664
664
|
priority: n.priority
|
|
665
665
|
});
|
|
@@ -697,8 +697,8 @@ class Ee {
|
|
|
697
697
|
}
|
|
698
698
|
getNodeIncomingEdgeIds(e) {
|
|
699
699
|
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
700
|
-
return t.forEach((
|
|
701
|
-
this.getPortIncomingEdgeIds(
|
|
700
|
+
return t.forEach((o) => {
|
|
701
|
+
this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
702
702
|
const a = this.getEdge(n);
|
|
703
703
|
return this.getPort(a.from).nodeId !== e;
|
|
704
704
|
}).forEach((n) => {
|
|
@@ -708,8 +708,8 @@ class Ee {
|
|
|
708
708
|
}
|
|
709
709
|
getNodeOutgoingEdgeIds(e) {
|
|
710
710
|
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
711
|
-
return t.forEach((
|
|
712
|
-
this.getPortOutgoingEdgeIds(
|
|
711
|
+
return t.forEach((o) => {
|
|
712
|
+
this.getPortOutgoingEdgeIds(o).filter((n) => {
|
|
713
713
|
const a = this.getEdge(n);
|
|
714
714
|
return this.getPort(a.to).nodeId !== e;
|
|
715
715
|
}).forEach((n) => {
|
|
@@ -719,10 +719,10 @@ class Ee {
|
|
|
719
719
|
}
|
|
720
720
|
getNodeCycleEdgeIds(e) {
|
|
721
721
|
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
722
|
-
return t.forEach((
|
|
723
|
-
this.getPortCycleEdgeIds(
|
|
722
|
+
return t.forEach((o) => {
|
|
723
|
+
this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
724
724
|
s.push(n);
|
|
725
|
-
}), this.getPortIncomingEdgeIds(
|
|
725
|
+
}), this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
726
726
|
const a = this.getEdge(n);
|
|
727
727
|
return this.getPort(a.to).nodeId === e;
|
|
728
728
|
}).forEach((n) => {
|
|
@@ -732,12 +732,12 @@ class Ee {
|
|
|
732
732
|
}
|
|
733
733
|
getNodeAdjacentEdgeIds(e) {
|
|
734
734
|
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
735
|
-
return t.forEach((
|
|
736
|
-
this.getPortIncomingEdgeIds(
|
|
735
|
+
return t.forEach((o) => {
|
|
736
|
+
this.getPortIncomingEdgeIds(o).forEach((n) => {
|
|
737
737
|
s.push(n);
|
|
738
|
-
}), this.getPortOutgoingEdgeIds(
|
|
738
|
+
}), this.getPortOutgoingEdgeIds(o).forEach((n) => {
|
|
739
739
|
s.push(n);
|
|
740
|
-
}), this.getPortCycleEdgeIds(
|
|
740
|
+
}), this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
741
741
|
s.push(n);
|
|
742
742
|
});
|
|
743
743
|
}), s;
|
|
@@ -753,8 +753,8 @@ class Ee {
|
|
|
753
753
|
}), e.from !== e.to ? (this.portOutcomingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
754
754
|
}
|
|
755
755
|
removeEdgeInternal(e) {
|
|
756
|
-
const t = this.edges.get(e), s = t.from,
|
|
757
|
-
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(
|
|
756
|
+
const t = this.edges.get(e), s = t.from, o = t.to;
|
|
757
|
+
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(o).delete(e), this.edges.delete(e);
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
const ce = (r) => ({
|
|
@@ -766,13 +766,13 @@ const ce = (r) => ({
|
|
|
766
766
|
x: 0,
|
|
767
767
|
y: 0
|
|
768
768
|
};
|
|
769
|
-
class
|
|
769
|
+
class Ze {
|
|
770
770
|
constructor() {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
[this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
771
|
+
i(this, "viewportMatrix", le);
|
|
772
|
+
i(this, "contentMatrix", le);
|
|
773
|
+
i(this, "afterUpdateEmitter");
|
|
774
|
+
i(this, "onAfterUpdated");
|
|
775
|
+
[this.afterUpdateEmitter, this.onAfterUpdated] = E();
|
|
776
776
|
}
|
|
777
777
|
getViewportMatrix() {
|
|
778
778
|
return this.viewportMatrix;
|
|
@@ -797,23 +797,23 @@ class Ge {
|
|
|
797
797
|
}
|
|
798
798
|
class K {
|
|
799
799
|
constructor(e) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
801
|
+
i(this, "nodesResizeObserver");
|
|
802
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
803
803
|
const t = this.canvas.graph.getNode(e);
|
|
804
804
|
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
805
805
|
});
|
|
806
|
-
|
|
806
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
807
807
|
const t = this.canvas.graph.getNode(e);
|
|
808
808
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
809
809
|
});
|
|
810
|
-
|
|
810
|
+
i(this, "onBeforeClear", () => {
|
|
811
811
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
812
812
|
});
|
|
813
813
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
814
814
|
t.forEach((s) => {
|
|
815
|
-
const
|
|
816
|
-
this.handleNodeResize(
|
|
815
|
+
const o = s.target;
|
|
816
|
+
this.handleNodeResize(o);
|
|
817
817
|
});
|
|
818
818
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
819
819
|
}
|
|
@@ -825,12 +825,12 @@ class K {
|
|
|
825
825
|
this.canvas.updateNode(t);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
|
-
const
|
|
829
|
-
const { x: s, y:
|
|
830
|
-
return e >= s && e <= s + n && t >=
|
|
831
|
-
},
|
|
828
|
+
const Je = (r, e, t) => {
|
|
829
|
+
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
830
|
+
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
831
|
+
}, qe = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, F = (r, e, t, s) => Je(e, t, s) && qe(r, t, s), U = (r, e) => {
|
|
832
832
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
833
|
-
},
|
|
833
|
+
}, B = (r) => {
|
|
834
834
|
const e = document.createElement("div");
|
|
835
835
|
return {
|
|
836
836
|
id: r.overlayId,
|
|
@@ -845,7 +845,7 @@ const Ke = (r, e, t) => {
|
|
|
845
845
|
}
|
|
846
846
|
]
|
|
847
847
|
};
|
|
848
|
-
},
|
|
848
|
+
}, _e = (r, e) => {
|
|
849
849
|
let t = e;
|
|
850
850
|
for (; t !== null; ) {
|
|
851
851
|
const s = r.getElementPortIds(t)[0] ?? null;
|
|
@@ -868,44 +868,44 @@ function* Ae(r, e) {
|
|
|
868
868
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
869
869
|
for (const s of t) {
|
|
870
870
|
if (s.shadowRoot !== null) {
|
|
871
|
-
const
|
|
872
|
-
for (const n of
|
|
871
|
+
const o = Ae(s.shadowRoot, e);
|
|
872
|
+
for (const n of o)
|
|
873
873
|
yield n;
|
|
874
874
|
}
|
|
875
875
|
yield s;
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
|
-
const
|
|
878
|
+
const Ee = (r, e) => {
|
|
879
879
|
const t = Ae(document, e);
|
|
880
880
|
for (const s of t) {
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
return
|
|
884
|
-
if (
|
|
881
|
+
const o = _e(r, s);
|
|
882
|
+
if (o.status === "portFound")
|
|
883
|
+
return o.portId;
|
|
884
|
+
if (o.status === "nodeEncountered")
|
|
885
885
|
return null;
|
|
886
886
|
}
|
|
887
887
|
return null;
|
|
888
888
|
};
|
|
889
|
-
var
|
|
889
|
+
var T = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(T || {});
|
|
890
890
|
const Se = (r, e) => ({
|
|
891
891
|
x: r / 2,
|
|
892
892
|
y: e / 2
|
|
893
893
|
}), p = {
|
|
894
894
|
x: 0,
|
|
895
895
|
y: 0
|
|
896
|
-
},
|
|
896
|
+
}, m = (r, e, t) => ({
|
|
897
897
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
898
898
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
899
|
-
}),
|
|
899
|
+
}), be = (r, e) => {
|
|
900
900
|
const t = {
|
|
901
901
|
x: r.x + r.width / 2,
|
|
902
902
|
y: r.y + r.height / 2
|
|
903
903
|
}, s = {
|
|
904
904
|
x: e.x + e.width / 2,
|
|
905
905
|
y: e.y + e.height / 2
|
|
906
|
-
},
|
|
906
|
+
}, o = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
|
|
907
907
|
return {
|
|
908
|
-
x:
|
|
908
|
+
x: o,
|
|
909
909
|
y: n,
|
|
910
910
|
width: a,
|
|
911
911
|
height: h,
|
|
@@ -916,18 +916,18 @@ const Se = (r, e) => ({
|
|
|
916
916
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
917
917
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
918
918
|
});
|
|
919
|
-
class
|
|
919
|
+
class et {
|
|
920
920
|
constructor(e) {
|
|
921
|
-
|
|
922
|
-
|
|
921
|
+
i(this, "path");
|
|
922
|
+
i(this, "midpoint");
|
|
923
923
|
this.params = e;
|
|
924
924
|
const t = this.params.to;
|
|
925
925
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
926
|
-
const s =
|
|
926
|
+
const s = m(
|
|
927
927
|
{ x: this.params.arrowLength, y: p.y },
|
|
928
928
|
this.params.sourceDirection,
|
|
929
929
|
p
|
|
930
|
-
),
|
|
930
|
+
), o = m(
|
|
931
931
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
932
932
|
this.params.targetDirection,
|
|
933
933
|
this.params.to
|
|
@@ -935,37 +935,37 @@ class Qe {
|
|
|
935
935
|
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
936
936
|
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
937
937
|
}, a = {
|
|
938
|
-
x:
|
|
939
|
-
y:
|
|
940
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${
|
|
938
|
+
x: o.x - this.params.targetDirection.x * this.params.curvature,
|
|
939
|
+
y: o.y - this.params.targetDirection.y * this.params.curvature
|
|
940
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
941
941
|
this.path = `${d}${h}${c}`;
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
class
|
|
944
|
+
class tt {
|
|
945
945
|
constructor(e) {
|
|
946
|
-
|
|
947
|
-
|
|
946
|
+
i(this, "path");
|
|
947
|
+
i(this, "midpoint");
|
|
948
948
|
this.params = e;
|
|
949
|
-
const t = this.params.hasSourceArrow ?
|
|
949
|
+
const t = this.params.hasSourceArrow ? m(
|
|
950
950
|
{ x: this.params.arrowLength, y: p.y },
|
|
951
951
|
this.params.sourceDirection,
|
|
952
952
|
p
|
|
953
|
-
) : p, s = this.params.hasTargetArrow ?
|
|
953
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
954
954
|
{
|
|
955
955
|
x: this.params.to.x - this.params.arrowLength,
|
|
956
956
|
y: this.params.to.y
|
|
957
957
|
},
|
|
958
958
|
this.params.targetDirection,
|
|
959
959
|
this.params.to
|
|
960
|
-
) : this.params.to,
|
|
961
|
-
{ x:
|
|
960
|
+
) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
|
|
961
|
+
{ x: o, y: p.y },
|
|
962
962
|
this.params.sourceDirection,
|
|
963
963
|
p
|
|
964
964
|
), g = {
|
|
965
965
|
x: c.x + h,
|
|
966
966
|
y: c.y + d
|
|
967
|
-
}, l =
|
|
968
|
-
{ x: this.params.to.x -
|
|
967
|
+
}, l = m(
|
|
968
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
969
969
|
this.params.targetDirection,
|
|
970
970
|
this.params.to
|
|
971
971
|
), u = {
|
|
@@ -974,87 +974,87 @@ class qe {
|
|
|
974
974
|
}, w = {
|
|
975
975
|
x: (g.x + u.x) / 2,
|
|
976
976
|
y: (g.y + u.y) / 2
|
|
977
|
-
},
|
|
977
|
+
}, y = {
|
|
978
978
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
979
979
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
980
|
-
},
|
|
980
|
+
}, x = {
|
|
981
981
|
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
982
982
|
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
983
|
-
},
|
|
983
|
+
}, A = {
|
|
984
984
|
x: c.x + h,
|
|
985
985
|
y: c.y + d
|
|
986
|
-
},
|
|
986
|
+
}, S = {
|
|
987
987
|
x: l.x + h,
|
|
988
988
|
y: l.y + d
|
|
989
989
|
};
|
|
990
990
|
this.path = [
|
|
991
991
|
`M ${t.x} ${t.y}`,
|
|
992
992
|
`L ${c.x} ${c.y}`,
|
|
993
|
-
`C ${
|
|
994
|
-
`C ${
|
|
993
|
+
`C ${y.x} ${y.y} ${A.x} ${A.y} ${w.x} ${w.y}`,
|
|
994
|
+
`C ${S.x} ${S.y} ${x.x} ${x.y} ${l.x} ${l.y}`,
|
|
995
995
|
`L ${s.x} ${s.y}`
|
|
996
996
|
].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
const
|
|
999
|
+
const Q = Object.freeze({
|
|
1000
1000
|
edgeColor: "--edge-color"
|
|
1001
|
-
}),
|
|
1001
|
+
}), Pe = (r) => {
|
|
1002
1002
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1003
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
1003
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Q.edgeColor, r), e;
|
|
1004
1004
|
}, Te = (r) => {
|
|
1005
1005
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1006
|
-
return e.setAttribute("stroke", `var(${
|
|
1006
|
+
return e.setAttribute("stroke", `var(${Q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1007
1007
|
}, O = () => {
|
|
1008
1008
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1009
|
-
return r.setAttribute("fill", `var(${
|
|
1010
|
-
},
|
|
1009
|
+
return r.setAttribute("fill", `var(${Q.edgeColor})`), r;
|
|
1010
|
+
}, Ce = () => {
|
|
1011
1011
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1012
1012
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1013
|
-
},
|
|
1013
|
+
}, De = (r, e) => {
|
|
1014
1014
|
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`;
|
|
1015
1015
|
}, L = (r, e) => {
|
|
1016
1016
|
const t = [];
|
|
1017
1017
|
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) {
|
|
1018
1018
|
const s = r.length - 1;
|
|
1019
|
-
let
|
|
1019
|
+
let o = 0, n = 0, a = 0;
|
|
1020
1020
|
r.forEach((h, d) => {
|
|
1021
1021
|
let c = 0, g = 0, l = 0;
|
|
1022
|
-
const u = d > 0, w = d < s,
|
|
1023
|
-
if (u && (c = -
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1022
|
+
const u = d > 0, w = d < s, y = u && w;
|
|
1023
|
+
if (u && (c = -o, g = -n, l = a), w) {
|
|
1024
|
+
const V = r[d + 1];
|
|
1025
|
+
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
1026
1026
|
}
|
|
1027
|
-
const
|
|
1028
|
-
d > 0 && t.push(`L ${N.x} ${N.y}`),
|
|
1029
|
-
`C ${h.x} ${h.y} ${h.x} ${h.y} ${
|
|
1027
|
+
const A = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, S = y ? { x: h.x + o * A, y: h.y + n * A } : h, P = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * P, y: h.y + g * P } : h;
|
|
1028
|
+
d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
|
|
1029
|
+
`C ${h.x} ${h.y} ${h.x} ${h.y} ${S.x} ${S.y}`
|
|
1030
1030
|
);
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
return t.join(" ");
|
|
1034
1034
|
};
|
|
1035
|
-
class
|
|
1035
|
+
class rt {
|
|
1036
1036
|
constructor(e) {
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
i(this, "path");
|
|
1038
|
+
i(this, "midpoint");
|
|
1039
1039
|
this.params = e;
|
|
1040
1040
|
const t = this.params.to;
|
|
1041
1041
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1042
|
-
const s = this.params.hasSourceArrow ?
|
|
1042
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1043
1043
|
{ x: this.params.arrowLength, y: p.y },
|
|
1044
1044
|
this.params.sourceDirection,
|
|
1045
1045
|
p
|
|
1046
|
-
) : p,
|
|
1046
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1047
1047
|
{
|
|
1048
1048
|
x: this.params.to.x - this.params.arrowLength,
|
|
1049
1049
|
y: this.params.to.y
|
|
1050
1050
|
},
|
|
1051
1051
|
this.params.targetDirection,
|
|
1052
1052
|
this.params.to
|
|
1053
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1053
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1054
1054
|
{ x: a, y: p.y },
|
|
1055
1055
|
this.params.sourceDirection,
|
|
1056
1056
|
p
|
|
1057
|
-
), d =
|
|
1057
|
+
), d = m(
|
|
1058
1058
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1059
1059
|
this.params.targetDirection,
|
|
1060
1060
|
this.params.to
|
|
@@ -1064,35 +1064,35 @@ class _e {
|
|
|
1064
1064
|
}, u = { x: l.x, y: g }, w = {
|
|
1065
1065
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1066
1066
|
y: d.y
|
|
1067
|
-
},
|
|
1067
|
+
}, y = { x: w.x, y: g };
|
|
1068
1068
|
this.path = L(
|
|
1069
|
-
[s, h, l, u,
|
|
1069
|
+
[s, h, l, u, y, w, d, o],
|
|
1070
1070
|
this.params.roundness
|
|
1071
1071
|
);
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
class
|
|
1074
|
+
class st {
|
|
1075
1075
|
constructor(e) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
i(this, "path");
|
|
1077
|
+
i(this, "midpoint");
|
|
1078
1078
|
this.params = e;
|
|
1079
|
-
const t = this.params.hasSourceArrow ?
|
|
1079
|
+
const t = this.params.hasSourceArrow ? m(
|
|
1080
1080
|
{ x: this.params.arrowLength, y: p.y },
|
|
1081
1081
|
this.params.sourceDirection,
|
|
1082
1082
|
p
|
|
1083
|
-
) : p, s = this.params.hasTargetArrow ?
|
|
1083
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1084
1084
|
{
|
|
1085
1085
|
x: this.params.to.x - this.params.arrowLength,
|
|
1086
1086
|
y: this.params.to.y
|
|
1087
1087
|
},
|
|
1088
1088
|
this.params.targetDirection,
|
|
1089
1089
|
this.params.to
|
|
1090
|
-
) : this.params.to,
|
|
1091
|
-
{ x:
|
|
1090
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1091
|
+
{ x: o, y: p.y },
|
|
1092
1092
|
this.params.sourceDirection,
|
|
1093
1093
|
p
|
|
1094
|
-
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l =
|
|
1095
|
-
{ x: this.params.to.x -
|
|
1094
|
+
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
|
|
1095
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1096
1096
|
this.params.targetDirection,
|
|
1097
1097
|
this.params.to
|
|
1098
1098
|
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
@@ -1102,59 +1102,59 @@ class et {
|
|
|
1102
1102
|
);
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
class
|
|
1105
|
+
class ot {
|
|
1106
1106
|
constructor(e) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1107
|
+
i(this, "path");
|
|
1108
|
+
i(this, "midpoint");
|
|
1109
1109
|
this.params = e;
|
|
1110
1110
|
const t = this.params.to;
|
|
1111
1111
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1112
|
-
const s = this.params.hasSourceArrow ?
|
|
1112
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1113
1113
|
{ x: this.params.arrowLength, y: p.y },
|
|
1114
1114
|
this.params.sourceDirection,
|
|
1115
1115
|
p
|
|
1116
|
-
) : p,
|
|
1116
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1117
1117
|
{
|
|
1118
1118
|
x: this.params.to.x - this.params.arrowLength,
|
|
1119
1119
|
y: this.params.to.y
|
|
1120
1120
|
},
|
|
1121
1121
|
this.params.targetDirection,
|
|
1122
1122
|
this.params.to
|
|
1123
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a =
|
|
1123
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1124
1124
|
{ x: n, y: p.y },
|
|
1125
1125
|
this.params.sourceDirection,
|
|
1126
1126
|
p
|
|
1127
|
-
), h =
|
|
1127
|
+
), h = m(
|
|
1128
1128
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1129
1129
|
this.params.targetDirection,
|
|
1130
1130
|
this.params.to
|
|
1131
1131
|
);
|
|
1132
|
-
this.path = L([s, a, h,
|
|
1132
|
+
this.path = L([s, a, h, o], this.params.roundness);
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
class
|
|
1135
|
+
class it {
|
|
1136
1136
|
constructor(e) {
|
|
1137
|
-
|
|
1138
|
-
|
|
1137
|
+
i(this, "path");
|
|
1138
|
+
i(this, "midpoint");
|
|
1139
1139
|
this.params = e;
|
|
1140
1140
|
const t = this.params.to;
|
|
1141
1141
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1142
|
-
const s = this.params.hasSourceArrow ?
|
|
1142
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1143
1143
|
{ x: this.params.arrowLength, y: p.y },
|
|
1144
1144
|
this.params.sourceDirection,
|
|
1145
1145
|
p
|
|
1146
|
-
) : p,
|
|
1146
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1147
1147
|
{
|
|
1148
1148
|
x: this.params.to.x - this.params.arrowLength,
|
|
1149
1149
|
y: this.params.to.y
|
|
1150
1150
|
},
|
|
1151
1151
|
this.params.targetDirection,
|
|
1152
1152
|
this.params.to
|
|
1153
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1153
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1154
1154
|
{ x: a, y: p.y },
|
|
1155
1155
|
this.params.sourceDirection,
|
|
1156
1156
|
p
|
|
1157
|
-
), d =
|
|
1157
|
+
), d = m(
|
|
1158
1158
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1159
1159
|
this.params.targetDirection,
|
|
1160
1160
|
this.params.to
|
|
@@ -1164,45 +1164,45 @@ class rt {
|
|
|
1164
1164
|
}, u = { x: g, y: l.y }, w = {
|
|
1165
1165
|
x: d.x,
|
|
1166
1166
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1167
|
-
},
|
|
1167
|
+
}, y = { x: g, y: w.y };
|
|
1168
1168
|
this.path = L(
|
|
1169
|
-
[s, h, l, u,
|
|
1169
|
+
[s, h, l, u, y, w, d, o],
|
|
1170
1170
|
this.params.roundness
|
|
1171
1171
|
);
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
1174
|
-
class
|
|
1174
|
+
class Z {
|
|
1175
1175
|
constructor(e) {
|
|
1176
|
-
|
|
1177
|
-
|
|
1176
|
+
i(this, "path");
|
|
1177
|
+
i(this, "midpoint");
|
|
1178
1178
|
this.params = e;
|
|
1179
|
-
const t = this.params.arrowOffset, s = this.params.side,
|
|
1179
|
+
const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
|
|
1180
1180
|
{ x: this.params.arrowLength, y: p.y },
|
|
1181
|
-
{ x:
|
|
1182
|
-
{ x:
|
|
1181
|
+
{ x: o, y: p.y },
|
|
1182
|
+
{ x: o, y: this.params.side },
|
|
1183
1183
|
{ x: n, y: this.params.side },
|
|
1184
1184
|
{ x: n, y: -this.params.side },
|
|
1185
|
-
{ x:
|
|
1186
|
-
{ x:
|
|
1185
|
+
{ x: o, y: -this.params.side },
|
|
1186
|
+
{ x: o, y: p.y },
|
|
1187
1187
|
{ x: this.params.arrowLength, y: p.y }
|
|
1188
1188
|
].map(
|
|
1189
|
-
(c) =>
|
|
1189
|
+
(c) => m(c, this.params.sourceDirection, p)
|
|
1190
1190
|
), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
|
|
1191
1191
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${L(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
class
|
|
1194
|
+
class nt {
|
|
1195
1195
|
constructor(e) {
|
|
1196
|
-
|
|
1197
|
-
|
|
1196
|
+
i(this, "path");
|
|
1197
|
+
i(this, "midpoint");
|
|
1198
1198
|
this.params = e;
|
|
1199
|
-
const t = this.params.smallRadius, s = this.params.radius,
|
|
1199
|
+
const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1200
1200
|
{ x: this.params.arrowLength, y: p.y },
|
|
1201
1201
|
{ x: c, y: n },
|
|
1202
1202
|
{ x: c, y: -n },
|
|
1203
1203
|
{ x: d, y: 0 }
|
|
1204
1204
|
].map(
|
|
1205
|
-
(
|
|
1205
|
+
(y) => m(y, this.params.sourceDirection, p)
|
|
1206
1206
|
), u = [
|
|
1207
1207
|
`M ${l[0].x} ${l[0].y}`,
|
|
1208
1208
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
@@ -1212,11 +1212,11 @@ class st {
|
|
|
1212
1212
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
class
|
|
1215
|
+
class at {
|
|
1216
1216
|
constructor(e) {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1217
|
+
i(this, "path");
|
|
1218
|
+
i(this, "midpoint");
|
|
1219
|
+
i(this, "diagonalDistance");
|
|
1220
1220
|
this.params = e;
|
|
1221
1221
|
const t = this.params.to;
|
|
1222
1222
|
if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
@@ -1227,7 +1227,7 @@ class ot {
|
|
|
1227
1227
|
this.path = "";
|
|
1228
1228
|
return;
|
|
1229
1229
|
}
|
|
1230
|
-
const
|
|
1230
|
+
const o = this.createDirectLinePoint({
|
|
1231
1231
|
offset: this.params.sourceOffset,
|
|
1232
1232
|
hasArrow: this.params.hasSourceArrow,
|
|
1233
1233
|
flip: 1,
|
|
@@ -1238,38 +1238,38 @@ class ot {
|
|
|
1238
1238
|
flip: -1,
|
|
1239
1239
|
shift: this.params.to
|
|
1240
1240
|
});
|
|
1241
|
-
this.path = `M ${
|
|
1241
|
+
this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
|
|
1242
1242
|
}
|
|
1243
1243
|
createDirectLinePoint(e) {
|
|
1244
|
-
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t,
|
|
1244
|
+
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
|
|
1245
1245
|
return {
|
|
1246
|
-
x: this.params.to.x *
|
|
1247
|
-
y: this.params.to.y *
|
|
1246
|
+
x: this.params.to.x * o + e.shift.x,
|
|
1247
|
+
y: this.params.to.y * o + e.shift.y
|
|
1248
1248
|
};
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
|
-
class
|
|
1251
|
+
class ht {
|
|
1252
1252
|
constructor(e) {
|
|
1253
|
-
|
|
1254
|
-
|
|
1253
|
+
i(this, "path");
|
|
1254
|
+
i(this, "midpoint");
|
|
1255
1255
|
this.params = e;
|
|
1256
|
-
const t = this.params.hasSourceArrow ?
|
|
1256
|
+
const t = this.params.hasSourceArrow ? m(
|
|
1257
1257
|
{ x: this.params.arrowLength, y: p.y },
|
|
1258
1258
|
this.params.sourceDirection,
|
|
1259
1259
|
p
|
|
1260
|
-
) : p, s = this.params.hasTargetArrow ?
|
|
1260
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1261
1261
|
{
|
|
1262
1262
|
x: this.params.to.x - this.params.arrowLength,
|
|
1263
1263
|
y: this.params.to.y
|
|
1264
1264
|
},
|
|
1265
1265
|
this.params.targetDirection,
|
|
1266
1266
|
this.params.to
|
|
1267
|
-
) : this.params.to,
|
|
1268
|
-
{ x:
|
|
1267
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1268
|
+
{ x: o, y: p.y },
|
|
1269
1269
|
this.params.sourceDirection,
|
|
1270
1270
|
p
|
|
1271
|
-
), a =
|
|
1272
|
-
{ x: this.params.to.x -
|
|
1271
|
+
), a = m(
|
|
1272
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1273
1273
|
this.params.targetDirection,
|
|
1274
1274
|
this.params.to
|
|
1275
1275
|
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipY * h, l = {
|
|
@@ -1289,28 +1289,28 @@ class it {
|
|
|
1289
1289
|
);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
class
|
|
1292
|
+
class dt {
|
|
1293
1293
|
constructor(e) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1294
|
+
i(this, "path");
|
|
1295
|
+
i(this, "midpoint");
|
|
1296
1296
|
this.params = e;
|
|
1297
|
-
const t = this.params.hasSourceArrow ?
|
|
1297
|
+
const t = this.params.hasSourceArrow ? m(
|
|
1298
1298
|
{ x: this.params.arrowLength, y: p.y },
|
|
1299
1299
|
this.params.sourceDirection,
|
|
1300
1300
|
p
|
|
1301
|
-
) : p, s = this.params.hasTargetArrow ?
|
|
1301
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1302
1302
|
{
|
|
1303
1303
|
x: this.params.to.x - this.params.arrowLength,
|
|
1304
1304
|
y: this.params.to.y
|
|
1305
1305
|
},
|
|
1306
1306
|
this.params.targetDirection,
|
|
1307
1307
|
this.params.to
|
|
1308
|
-
) : this.params.to,
|
|
1309
|
-
{ x:
|
|
1308
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1309
|
+
{ x: o, y: p.y },
|
|
1310
1310
|
this.params.sourceDirection,
|
|
1311
1311
|
p
|
|
1312
|
-
), a =
|
|
1313
|
-
{ x: this.params.to.x -
|
|
1312
|
+
), a = m(
|
|
1313
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1314
1314
|
this.params.targetDirection,
|
|
1315
1315
|
this.params.to
|
|
1316
1316
|
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipX * h, l = {
|
|
@@ -1355,22 +1355,22 @@ const f = Object.freeze({
|
|
|
1355
1355
|
}), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1356
1356
|
class k {
|
|
1357
1357
|
constructor(e) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1358
|
+
i(this, "svg");
|
|
1359
|
+
i(this, "group", Ce());
|
|
1360
|
+
i(this, "line");
|
|
1361
|
+
i(this, "sourceArrow", null);
|
|
1362
|
+
i(this, "targetArrow", null);
|
|
1363
|
+
i(this, "onAfterRender");
|
|
1364
|
+
i(this, "afterRenderEmitter");
|
|
1365
|
+
i(this, "arrowRenderer");
|
|
1366
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1367
1367
|
}
|
|
1368
1368
|
render(e) {
|
|
1369
|
-
const { x: t, y: s, width:
|
|
1369
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
|
|
1370
1370
|
e.from,
|
|
1371
1371
|
e.to
|
|
1372
1372
|
);
|
|
1373
|
-
|
|
1373
|
+
De(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1374
1374
|
const d = ge(
|
|
1375
1375
|
e.from.direction,
|
|
1376
1376
|
a,
|
|
@@ -1380,11 +1380,11 @@ class k {
|
|
|
1380
1380
|
a,
|
|
1381
1381
|
h
|
|
1382
1382
|
), g = {
|
|
1383
|
-
x:
|
|
1383
|
+
x: o,
|
|
1384
1384
|
y: n
|
|
1385
1385
|
};
|
|
1386
1386
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1387
|
-
e.category ===
|
|
1387
|
+
e.category === R.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === R.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1388
1388
|
const w = u(
|
|
1389
1389
|
d,
|
|
1390
1390
|
c,
|
|
@@ -1393,46 +1393,46 @@ class k {
|
|
|
1393
1393
|
h
|
|
1394
1394
|
);
|
|
1395
1395
|
this.line.setAttribute("d", w.path);
|
|
1396
|
-
let
|
|
1397
|
-
this.sourceArrow && (
|
|
1396
|
+
let y = null;
|
|
1397
|
+
this.sourceArrow && (y = this.arrowRenderer({
|
|
1398
1398
|
direction: d,
|
|
1399
1399
|
shift: p,
|
|
1400
1400
|
arrowLength: this.params.arrowLength
|
|
1401
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1402
|
-
let
|
|
1403
|
-
this.targetArrow && (
|
|
1401
|
+
}), this.sourceArrow.setAttribute("d", y));
|
|
1402
|
+
let x = null;
|
|
1403
|
+
this.targetArrow && (x = this.arrowRenderer({
|
|
1404
1404
|
direction: l,
|
|
1405
1405
|
shift: g,
|
|
1406
1406
|
arrowLength: this.params.arrowLength
|
|
1407
|
-
}), this.targetArrow.setAttribute("d",
|
|
1407
|
+
}), this.targetArrow.setAttribute("d", x)), this.afterRenderEmitter.emit({
|
|
1408
1408
|
edgePath: w,
|
|
1409
|
-
sourceArrowPath:
|
|
1410
|
-
targetArrowPath:
|
|
1409
|
+
sourceArrowPath: y,
|
|
1410
|
+
targetArrowPath: x
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
|
-
const
|
|
1414
|
+
const ct = (r) => (e) => {
|
|
1415
1415
|
const s = [
|
|
1416
1416
|
p,
|
|
1417
1417
|
{ x: e.arrowLength, y: r.radius },
|
|
1418
1418
|
{ x: e.arrowLength, y: -r.radius }
|
|
1419
1419
|
].map(
|
|
1420
|
-
(h) =>
|
|
1420
|
+
(h) => m(h, e.direction, p)
|
|
1421
1421
|
).map((h) => ({
|
|
1422
1422
|
x: h.x + e.shift.x,
|
|
1423
1423
|
y: h.y + e.shift.y
|
|
1424
|
-
})),
|
|
1425
|
-
return `${
|
|
1426
|
-
},
|
|
1427
|
-
const t = r.radius, s = e.arrowLength,
|
|
1428
|
-
(
|
|
1429
|
-
).map((
|
|
1430
|
-
x:
|
|
1431
|
-
y:
|
|
1432
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${
|
|
1424
|
+
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1425
|
+
return `${o} ${n} ${a} Z`;
|
|
1426
|
+
}, lt = (r) => (e) => {
|
|
1427
|
+
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1428
|
+
(y) => m(y, e.direction, p)
|
|
1429
|
+
).map((y) => ({
|
|
1430
|
+
x: y.x + e.shift.x,
|
|
1431
|
+
y: y.y + e.shift.y
|
|
1432
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1433
1433
|
return `${g} ${l} ${u} ${w}`;
|
|
1434
|
-
},
|
|
1435
|
-
const t = r.smallRadius, s = r.radius,
|
|
1434
|
+
}, gt = (r) => (e) => {
|
|
1435
|
+
const t = r.smallRadius, s = r.radius, o = m(
|
|
1436
1436
|
{
|
|
1437
1437
|
x: e.arrowLength,
|
|
1438
1438
|
y: 0
|
|
@@ -1445,8 +1445,8 @@ const at = (r) => (e) => {
|
|
|
1445
1445
|
x: e.arrowLength + r.smallRadius,
|
|
1446
1446
|
y: 0
|
|
1447
1447
|
}
|
|
1448
|
-
), a = [p, { x:
|
|
1449
|
-
(l) =>
|
|
1448
|
+
), a = [p, { x: o.x, y: -o.y }, o].map(
|
|
1449
|
+
(l) => m(l, e.direction, p)
|
|
1450
1450
|
).map((l) => ({
|
|
1451
1451
|
x: l.x + e.shift.x,
|
|
1452
1452
|
y: l.y + e.shift.y
|
|
@@ -1457,39 +1457,39 @@ const at = (r) => (e) => {
|
|
|
1457
1457
|
return r;
|
|
1458
1458
|
switch (r.type) {
|
|
1459
1459
|
case "triangle":
|
|
1460
|
-
return
|
|
1460
|
+
return ct({
|
|
1461
1461
|
radius: r.radius ?? f.polygonArrowRadius
|
|
1462
1462
|
});
|
|
1463
1463
|
case "arc":
|
|
1464
|
-
return
|
|
1464
|
+
return lt({
|
|
1465
1465
|
radius: r.radius ?? f.circleArrowRadius
|
|
1466
1466
|
});
|
|
1467
1467
|
default:
|
|
1468
|
-
return
|
|
1468
|
+
return gt({
|
|
1469
1469
|
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1470
1470
|
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1471
1471
|
radius: r.radius ?? f.wedgeArrowRadius
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
1474
1474
|
};
|
|
1475
|
-
class
|
|
1475
|
+
class ut {
|
|
1476
1476
|
constructor(e) {
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1477
|
+
i(this, "svg");
|
|
1478
|
+
i(this, "group");
|
|
1479
|
+
i(this, "line");
|
|
1480
|
+
i(this, "sourceArrow");
|
|
1481
|
+
i(this, "targetArrow");
|
|
1482
|
+
i(this, "onAfterRender");
|
|
1483
|
+
i(this, "arrowLength");
|
|
1484
|
+
i(this, "curvature");
|
|
1485
|
+
i(this, "portCycleRadius");
|
|
1486
|
+
i(this, "portCycleSmallRadius");
|
|
1487
|
+
i(this, "detourDirection");
|
|
1488
|
+
i(this, "detourDistance");
|
|
1489
|
+
i(this, "hasSourceArrow");
|
|
1490
|
+
i(this, "hasTargetArrow");
|
|
1491
|
+
i(this, "pathShape");
|
|
1492
|
+
i(this, "createCyclePath", (e) => new nt({
|
|
1493
1493
|
sourceDirection: e,
|
|
1494
1494
|
radius: this.portCycleRadius,
|
|
1495
1495
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1497,11 +1497,11 @@ class ct {
|
|
|
1497
1497
|
hasSourceArrow: this.hasSourceArrow,
|
|
1498
1498
|
hasTargetArrow: this.hasTargetArrow
|
|
1499
1499
|
}));
|
|
1500
|
-
|
|
1500
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new tt({
|
|
1501
1501
|
to: s,
|
|
1502
1502
|
sourceDirection: e,
|
|
1503
1503
|
targetDirection: t,
|
|
1504
|
-
flipX:
|
|
1504
|
+
flipX: o,
|
|
1505
1505
|
flipY: n,
|
|
1506
1506
|
arrowLength: this.arrowLength,
|
|
1507
1507
|
detourDirection: this.detourDirection,
|
|
@@ -1510,7 +1510,7 @@ class ct {
|
|
|
1510
1510
|
hasSourceArrow: this.hasSourceArrow,
|
|
1511
1511
|
hasTargetArrow: this.hasTargetArrow
|
|
1512
1512
|
}));
|
|
1513
|
-
|
|
1513
|
+
i(this, "createLinePath", (e, t, s) => new et({
|
|
1514
1514
|
to: s,
|
|
1515
1515
|
sourceDirection: e,
|
|
1516
1516
|
targetDirection: t,
|
|
@@ -1535,23 +1535,23 @@ class ct {
|
|
|
1535
1535
|
this.pathShape.render(e);
|
|
1536
1536
|
}
|
|
1537
1537
|
}
|
|
1538
|
-
class
|
|
1538
|
+
class pt {
|
|
1539
1539
|
constructor(e) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1540
|
+
i(this, "svg");
|
|
1541
|
+
i(this, "group");
|
|
1542
|
+
i(this, "line");
|
|
1543
|
+
i(this, "sourceArrow");
|
|
1544
|
+
i(this, "targetArrow");
|
|
1545
|
+
i(this, "onAfterRender");
|
|
1546
|
+
i(this, "arrowLength");
|
|
1547
|
+
i(this, "arrowOffset");
|
|
1548
|
+
i(this, "roundness");
|
|
1549
|
+
i(this, "cycleSquareSide");
|
|
1550
|
+
i(this, "detourDistance");
|
|
1551
|
+
i(this, "hasSourceArrow");
|
|
1552
|
+
i(this, "hasTargetArrow");
|
|
1553
|
+
i(this, "pathShape");
|
|
1554
|
+
i(this, "createCyclePath", (e) => new Z({
|
|
1555
1555
|
sourceDirection: e,
|
|
1556
1556
|
arrowLength: this.arrowLength,
|
|
1557
1557
|
side: this.cycleSquareSide,
|
|
@@ -1560,11 +1560,11 @@ class lt {
|
|
|
1560
1560
|
hasSourceArrow: this.hasSourceArrow,
|
|
1561
1561
|
hasTargetArrow: this.hasTargetArrow
|
|
1562
1562
|
}));
|
|
1563
|
-
|
|
1563
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ht({
|
|
1564
1564
|
to: s,
|
|
1565
1565
|
sourceDirection: e,
|
|
1566
1566
|
targetDirection: t,
|
|
1567
|
-
flipX:
|
|
1567
|
+
flipX: o,
|
|
1568
1568
|
flipY: n,
|
|
1569
1569
|
arrowLength: this.arrowLength,
|
|
1570
1570
|
arrowOffset: this.arrowOffset,
|
|
@@ -1573,11 +1573,11 @@ class lt {
|
|
|
1573
1573
|
hasSourceArrow: this.hasSourceArrow,
|
|
1574
1574
|
hasTargetArrow: this.hasTargetArrow
|
|
1575
1575
|
}));
|
|
1576
|
-
|
|
1576
|
+
i(this, "createLinePath", (e, t, s, o) => new rt({
|
|
1577
1577
|
to: s,
|
|
1578
1578
|
sourceDirection: e,
|
|
1579
1579
|
targetDirection: t,
|
|
1580
|
-
flipX:
|
|
1580
|
+
flipX: o,
|
|
1581
1581
|
arrowLength: this.arrowLength,
|
|
1582
1582
|
arrowOffset: this.arrowOffset,
|
|
1583
1583
|
roundness: this.roundness,
|
|
@@ -1606,24 +1606,24 @@ class lt {
|
|
|
1606
1606
|
this.pathShape.render(e);
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
|
-
class
|
|
1609
|
+
class wt {
|
|
1610
1610
|
constructor(e) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1611
|
+
i(this, "svg");
|
|
1612
|
+
i(this, "group");
|
|
1613
|
+
i(this, "line");
|
|
1614
|
+
i(this, "sourceArrow");
|
|
1615
|
+
i(this, "targetArrow");
|
|
1616
|
+
i(this, "onAfterRender");
|
|
1617
|
+
i(this, "arrowLength");
|
|
1618
|
+
i(this, "arrowOffset");
|
|
1619
|
+
i(this, "roundness");
|
|
1620
|
+
i(this, "cycleSquareSide");
|
|
1621
|
+
i(this, "detourDirection");
|
|
1622
|
+
i(this, "detourDistance");
|
|
1623
|
+
i(this, "hasSourceArrow");
|
|
1624
|
+
i(this, "hasTargetArrow");
|
|
1625
|
+
i(this, "pathShape");
|
|
1626
|
+
i(this, "createCyclePath", (e) => new Z({
|
|
1627
1627
|
sourceDirection: e,
|
|
1628
1628
|
arrowLength: this.arrowLength,
|
|
1629
1629
|
side: this.cycleSquareSide,
|
|
@@ -1632,11 +1632,11 @@ class gt {
|
|
|
1632
1632
|
hasSourceArrow: this.hasSourceArrow,
|
|
1633
1633
|
hasTargetArrow: this.hasTargetArrow
|
|
1634
1634
|
}));
|
|
1635
|
-
|
|
1635
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new st({
|
|
1636
1636
|
to: s,
|
|
1637
1637
|
sourceDirection: e,
|
|
1638
1638
|
targetDirection: t,
|
|
1639
|
-
flipX:
|
|
1639
|
+
flipX: o,
|
|
1640
1640
|
flipY: n,
|
|
1641
1641
|
arrowLength: this.arrowLength,
|
|
1642
1642
|
arrowOffset: this.arrowOffset,
|
|
@@ -1646,7 +1646,7 @@ class gt {
|
|
|
1646
1646
|
hasSourceArrow: this.hasSourceArrow,
|
|
1647
1647
|
hasTargetArrow: this.hasTargetArrow
|
|
1648
1648
|
}));
|
|
1649
|
-
|
|
1649
|
+
i(this, "createLinePath", (e, t, s) => new ot({
|
|
1650
1650
|
to: s,
|
|
1651
1651
|
sourceDirection: e,
|
|
1652
1652
|
targetDirection: t,
|
|
@@ -1678,23 +1678,23 @@ class gt {
|
|
|
1678
1678
|
this.pathShape.render(e);
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
|
-
class
|
|
1681
|
+
class ft {
|
|
1682
1682
|
constructor(e) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1683
|
+
i(this, "svg");
|
|
1684
|
+
i(this, "group");
|
|
1685
|
+
i(this, "line");
|
|
1686
|
+
i(this, "sourceArrow");
|
|
1687
|
+
i(this, "targetArrow");
|
|
1688
|
+
i(this, "onAfterRender");
|
|
1689
|
+
i(this, "arrowLength");
|
|
1690
|
+
i(this, "arrowOffset");
|
|
1691
|
+
i(this, "roundness");
|
|
1692
|
+
i(this, "cycleSquareSide");
|
|
1693
|
+
i(this, "detourDistance");
|
|
1694
|
+
i(this, "hasSourceArrow");
|
|
1695
|
+
i(this, "hasTargetArrow");
|
|
1696
|
+
i(this, "pathShape");
|
|
1697
|
+
i(this, "createCyclePath", (e) => new Z({
|
|
1698
1698
|
sourceDirection: e,
|
|
1699
1699
|
arrowLength: this.arrowLength,
|
|
1700
1700
|
side: this.cycleSquareSide,
|
|
@@ -1703,11 +1703,11 @@ class ut {
|
|
|
1703
1703
|
hasSourceArrow: this.hasSourceArrow,
|
|
1704
1704
|
hasTargetArrow: this.hasTargetArrow
|
|
1705
1705
|
}));
|
|
1706
|
-
|
|
1706
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new dt({
|
|
1707
1707
|
to: s,
|
|
1708
1708
|
sourceDirection: e,
|
|
1709
1709
|
targetDirection: t,
|
|
1710
|
-
flipX:
|
|
1710
|
+
flipX: o,
|
|
1711
1711
|
flipY: n,
|
|
1712
1712
|
arrowLength: this.arrowLength,
|
|
1713
1713
|
arrowOffset: this.arrowOffset,
|
|
@@ -1716,7 +1716,7 @@ class ut {
|
|
|
1716
1716
|
hasSourceArrow: this.hasSourceArrow,
|
|
1717
1717
|
hasTargetArrow: this.hasTargetArrow
|
|
1718
1718
|
}));
|
|
1719
|
-
|
|
1719
|
+
i(this, "createLinePath", (e, t, s, o, n) => new it({
|
|
1720
1720
|
to: s,
|
|
1721
1721
|
sourceDirection: e,
|
|
1722
1722
|
targetDirection: t,
|
|
@@ -1749,30 +1749,30 @@ class ut {
|
|
|
1749
1749
|
this.pathShape.render(e);
|
|
1750
1750
|
}
|
|
1751
1751
|
}
|
|
1752
|
-
class
|
|
1752
|
+
class Ne {
|
|
1753
1753
|
constructor(e) {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1754
|
+
i(this, "svg");
|
|
1755
|
+
i(this, "group", Ce());
|
|
1756
|
+
i(this, "line");
|
|
1757
|
+
i(this, "sourceArrow", null);
|
|
1758
|
+
i(this, "targetArrow", null);
|
|
1759
|
+
i(this, "color");
|
|
1760
|
+
i(this, "width");
|
|
1761
|
+
i(this, "arrowLength");
|
|
1762
|
+
i(this, "sourceOffset");
|
|
1763
|
+
i(this, "targetOffset");
|
|
1764
|
+
i(this, "onAfterRender");
|
|
1765
|
+
i(this, "afterRenderEmitter");
|
|
1766
|
+
i(this, "arrowRenderer");
|
|
1767
|
+
[this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Pe(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1768
1768
|
}
|
|
1769
1769
|
render(e) {
|
|
1770
|
-
const { x: t, y: s, width:
|
|
1770
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
|
|
1771
1771
|
e.from,
|
|
1772
1772
|
e.to
|
|
1773
1773
|
);
|
|
1774
|
-
|
|
1775
|
-
const d = { x:
|
|
1774
|
+
De(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1775
|
+
const d = { x: o, y: n }, c = new at({
|
|
1776
1776
|
to: d,
|
|
1777
1777
|
sourceOffset: this.sourceOffset,
|
|
1778
1778
|
targetOffset: this.targetOffset,
|
|
@@ -1791,26 +1791,26 @@ class Me {
|
|
|
1791
1791
|
y: d.y / u
|
|
1792
1792
|
};
|
|
1793
1793
|
if (this.sourceArrow) {
|
|
1794
|
-
const
|
|
1794
|
+
const y = {
|
|
1795
1795
|
x: w.x * this.sourceOffset,
|
|
1796
1796
|
y: w.y * this.sourceOffset
|
|
1797
1797
|
};
|
|
1798
1798
|
g = this.arrowRenderer({
|
|
1799
1799
|
direction: w,
|
|
1800
|
-
shift:
|
|
1800
|
+
shift: y,
|
|
1801
1801
|
arrowLength: this.arrowLength
|
|
1802
1802
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1803
1803
|
}
|
|
1804
1804
|
if (this.targetArrow) {
|
|
1805
|
-
const
|
|
1805
|
+
const y = {
|
|
1806
1806
|
x: w.x * this.targetOffset,
|
|
1807
1807
|
y: w.y * this.targetOffset
|
|
1808
1808
|
};
|
|
1809
1809
|
l = this.arrowRenderer({
|
|
1810
1810
|
direction: { x: -w.x, y: -w.y },
|
|
1811
1811
|
shift: {
|
|
1812
|
-
x: d.x -
|
|
1813
|
-
y: d.y -
|
|
1812
|
+
x: d.x - y.x,
|
|
1813
|
+
y: d.y - y.y
|
|
1814
1814
|
},
|
|
1815
1815
|
arrowLength: this.arrowLength
|
|
1816
1816
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -1823,57 +1823,57 @@ class Me {
|
|
|
1823
1823
|
});
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
|
-
const
|
|
1826
|
+
const yt = () => {
|
|
1827
1827
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1828
1828
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1829
|
-
},
|
|
1829
|
+
}, mt = (r) => {
|
|
1830
1830
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1831
1831
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1832
1832
|
}, ue = (r) => {
|
|
1833
1833
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1834
1834
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1835
1835
|
};
|
|
1836
|
-
class
|
|
1836
|
+
class vt extends Error {
|
|
1837
1837
|
constructor(e) {
|
|
1838
1838
|
super(e), this.name = "InteractiveEdgeError";
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
|
-
class
|
|
1841
|
+
class Me {
|
|
1842
1842
|
constructor(e, t) {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
if (this.baseEdge = e, e instanceof
|
|
1854
|
-
throw new
|
|
1843
|
+
i(this, "svg");
|
|
1844
|
+
i(this, "group");
|
|
1845
|
+
i(this, "line");
|
|
1846
|
+
i(this, "sourceArrow");
|
|
1847
|
+
i(this, "targetArrow");
|
|
1848
|
+
i(this, "handle", yt());
|
|
1849
|
+
i(this, "onAfterRender");
|
|
1850
|
+
i(this, "interactiveLine");
|
|
1851
|
+
i(this, "interactiveSourceArrow", null);
|
|
1852
|
+
i(this, "interactiveTargetArrow", null);
|
|
1853
|
+
if (this.baseEdge = e, e instanceof Me)
|
|
1854
|
+
throw new vt(
|
|
1855
1855
|
"interactive edge can be configured only once"
|
|
1856
1856
|
);
|
|
1857
1857
|
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;
|
|
1858
1858
|
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1859
|
-
this.interactiveLine =
|
|
1860
|
-
this.interactiveLine.setAttribute("d",
|
|
1859
|
+
this.interactiveLine = mt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1860
|
+
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1861
1861
|
});
|
|
1862
1862
|
}
|
|
1863
1863
|
render(e) {
|
|
1864
1864
|
this.baseEdge.render(e);
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
|
-
class
|
|
1867
|
+
class sr {
|
|
1868
1868
|
constructor(e, t) {
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1869
|
+
i(this, "group");
|
|
1870
|
+
i(this, "line");
|
|
1871
|
+
i(this, "sourceArrow");
|
|
1872
|
+
i(this, "targetArrow");
|
|
1873
|
+
i(this, "onAfterRender");
|
|
1874
|
+
i(this, "svg");
|
|
1875
1875
|
this.baseShape = e, this.midpointElement = 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.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
|
|
1876
|
-
const
|
|
1876
|
+
const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
|
|
1877
1877
|
this.midpointElement.style.setProperty("transform", n);
|
|
1878
1878
|
});
|
|
1879
1879
|
}
|
|
@@ -1881,21 +1881,21 @@ class Qt {
|
|
|
1881
1881
|
this.baseShape.render(e);
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
|
-
class
|
|
1884
|
+
class Le {
|
|
1885
1885
|
constructor(e) {
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1886
|
+
i(this, "onAfterNodeAdded");
|
|
1887
|
+
i(this, "onAfterNodeUpdated");
|
|
1888
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
1889
|
+
i(this, "onBeforeNodeRemoved");
|
|
1890
|
+
i(this, "onAfterPortMarked");
|
|
1891
|
+
i(this, "onAfterPortUpdated");
|
|
1892
|
+
i(this, "onBeforePortUnmarked");
|
|
1893
|
+
i(this, "onAfterEdgeAdded");
|
|
1894
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
1895
|
+
i(this, "onAfterEdgeUpdated");
|
|
1896
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
1897
|
+
i(this, "onBeforeEdgeRemoved");
|
|
1898
|
+
i(this, "onBeforeClear");
|
|
1899
1899
|
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;
|
|
1900
1900
|
}
|
|
1901
1901
|
getNode(e) {
|
|
@@ -1974,9 +1974,9 @@ class Re {
|
|
|
1974
1974
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
|
-
class
|
|
1977
|
+
class Re {
|
|
1978
1978
|
constructor(e) {
|
|
1979
|
-
|
|
1979
|
+
i(this, "onAfterUpdated");
|
|
1980
1980
|
this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
1981
1981
|
}
|
|
1982
1982
|
getViewportMatrix() {
|
|
@@ -1986,14 +1986,14 @@ class Ce {
|
|
|
1986
1986
|
return { ...this.viewportStore.getContentMatrix() };
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
|
-
const
|
|
1990
|
-
const t = new
|
|
1989
|
+
const Fe = (r, e) => {
|
|
1990
|
+
const t = new xe(), s = new Le(t), o = new Re(e), n = new me(t, e, r), a = {
|
|
1991
1991
|
nodes: {
|
|
1992
1992
|
centerFn: Se,
|
|
1993
1993
|
priorityFn: () => 0
|
|
1994
1994
|
},
|
|
1995
1995
|
edges: {
|
|
1996
|
-
shapeFactory: () => new
|
|
1996
|
+
shapeFactory: () => new Ne(),
|
|
1997
1997
|
priorityFn: () => 0
|
|
1998
1998
|
},
|
|
1999
1999
|
ports: {
|
|
@@ -2002,7 +2002,7 @@ const Ve = (r, e) => {
|
|
|
2002
2002
|
};
|
|
2003
2003
|
return new ve(
|
|
2004
2004
|
s,
|
|
2005
|
-
|
|
2005
|
+
o,
|
|
2006
2006
|
t,
|
|
2007
2007
|
e,
|
|
2008
2008
|
n,
|
|
@@ -2010,16 +2010,16 @@ const Ve = (r, e) => {
|
|
|
2010
2010
|
);
|
|
2011
2011
|
};
|
|
2012
2012
|
class z {
|
|
2013
|
-
constructor(e, t, s,
|
|
2014
|
-
|
|
2013
|
+
constructor(e, t, s, o) {
|
|
2014
|
+
i(this, "onAfterPortMarked", (e) => {
|
|
2015
2015
|
const t = this.canvas.graph.getPort(e);
|
|
2016
2016
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
2017
2017
|
});
|
|
2018
|
-
|
|
2018
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
2019
2019
|
const t = this.canvas.graph.getPort(e);
|
|
2020
2020
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
2021
2021
|
});
|
|
2022
|
-
|
|
2022
|
+
i(this, "onPortMouseDown", (e) => {
|
|
2023
2023
|
if (!this.params.mouseDownEventVerifier(e))
|
|
2024
2024
|
return;
|
|
2025
2025
|
const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
|
|
@@ -2032,8 +2032,8 @@ class z {
|
|
|
2032
2032
|
passive: !0
|
|
2033
2033
|
}));
|
|
2034
2034
|
});
|
|
2035
|
-
|
|
2036
|
-
if (!
|
|
2035
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2036
|
+
if (!F(
|
|
2037
2037
|
this.window,
|
|
2038
2038
|
this.element,
|
|
2039
2039
|
e.clientX,
|
|
@@ -2044,14 +2044,14 @@ class z {
|
|
|
2044
2044
|
}
|
|
2045
2045
|
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2046
2046
|
});
|
|
2047
|
-
|
|
2047
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2048
2048
|
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2049
2049
|
});
|
|
2050
|
-
|
|
2050
|
+
i(this, "onPortTouchStart", (e) => {
|
|
2051
2051
|
if (e.touches.length !== 1)
|
|
2052
2052
|
return;
|
|
2053
|
-
const t = e.touches[0], s = e.currentTarget,
|
|
2054
|
-
this.params.onPortPointerDown(
|
|
2053
|
+
const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.getElementPortIds(s)[0];
|
|
2054
|
+
this.params.onPortPointerDown(o, {
|
|
2055
2055
|
x: t.clientX,
|
|
2056
2056
|
y: t.clientY
|
|
2057
2057
|
}) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
@@ -2062,9 +2062,9 @@ class z {
|
|
|
2062
2062
|
passive: !0
|
|
2063
2063
|
}));
|
|
2064
2064
|
});
|
|
2065
|
-
|
|
2065
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2066
2066
|
const t = e.touches[0];
|
|
2067
|
-
if (!
|
|
2067
|
+
if (!F(
|
|
2068
2068
|
this.window,
|
|
2069
2069
|
this.element,
|
|
2070
2070
|
t.clientX,
|
|
@@ -2075,23 +2075,23 @@ class z {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2077
2077
|
});
|
|
2078
|
-
|
|
2078
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2079
2079
|
const t = e.changedTouches[0];
|
|
2080
2080
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2081
2081
|
});
|
|
2082
|
-
|
|
2082
|
+
i(this, "onBeforeClear", () => {
|
|
2083
2083
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2084
2084
|
const t = this.canvas.graph.getPort(e);
|
|
2085
2085
|
this.unhookPortEvents(t.element);
|
|
2086
2086
|
});
|
|
2087
2087
|
});
|
|
2088
|
-
|
|
2088
|
+
i(this, "onBeforeDestroy", () => {
|
|
2089
2089
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2090
2090
|
});
|
|
2091
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2091
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
|
|
2092
2092
|
}
|
|
2093
|
-
static configure(e, t, s,
|
|
2094
|
-
new z(e, t, s,
|
|
2093
|
+
static configure(e, t, s, o) {
|
|
2094
|
+
new z(e, t, s, o);
|
|
2095
2095
|
}
|
|
2096
2096
|
hookPortEvents(e) {
|
|
2097
2097
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2116,12 +2116,12 @@ class z {
|
|
|
2116
2116
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
2119
|
-
class
|
|
2120
|
-
constructor(e, t, s,
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2119
|
+
class J {
|
|
2120
|
+
constructor(e, t, s, o) {
|
|
2121
|
+
i(this, "grabbedNode", null);
|
|
2122
|
+
i(this, "maxNodePriority", 0);
|
|
2123
|
+
i(this, "graph");
|
|
2124
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
2125
2125
|
this.updateMaxNodePriority(e);
|
|
2126
2126
|
const t = this.graph.getNode(e);
|
|
2127
2127
|
t.element.addEventListener("mousedown", this.onMouseDown, {
|
|
@@ -2130,50 +2130,50 @@ class Q {
|
|
|
2130
2130
|
passive: !0
|
|
2131
2131
|
});
|
|
2132
2132
|
});
|
|
2133
|
-
|
|
2133
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
2134
2134
|
this.updateMaxNodePriority(e);
|
|
2135
2135
|
});
|
|
2136
|
-
|
|
2136
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
2137
2137
|
const t = this.graph.getNode(e);
|
|
2138
2138
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2139
2139
|
});
|
|
2140
|
-
|
|
2140
|
+
i(this, "onBeforeDestroy", () => {
|
|
2141
2141
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2142
2142
|
});
|
|
2143
|
-
|
|
2143
|
+
i(this, "onBeforeClear", () => {
|
|
2144
2144
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2145
2145
|
const t = this.canvas.graph.getNode(e);
|
|
2146
2146
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2147
2147
|
}), this.maxNodePriority = 0;
|
|
2148
2148
|
});
|
|
2149
|
-
|
|
2149
|
+
i(this, "onMouseDown", (e) => {
|
|
2150
2150
|
if (!this.params.mouseDownEventVerifier(e))
|
|
2151
2151
|
return;
|
|
2152
|
-
const t = e.currentTarget, s = this.graph.getElementNodeId(t),
|
|
2152
|
+
const t = e.currentTarget, s = this.graph.getElementNodeId(t), o = this.graph.getNode(s);
|
|
2153
2153
|
if (!this.params.nodeDragVerifier(s))
|
|
2154
2154
|
return;
|
|
2155
|
-
e.stopPropagation();
|
|
2155
|
+
this.params.onNodeDragStarted(s), e.stopPropagation();
|
|
2156
2156
|
const a = this.calculateContentPoint({
|
|
2157
2157
|
x: e.clientX,
|
|
2158
2158
|
y: e.clientY
|
|
2159
2159
|
});
|
|
2160
2160
|
this.grabbedNode = {
|
|
2161
2161
|
nodeId: s,
|
|
2162
|
-
dx: a.x -
|
|
2163
|
-
dy: a.y -
|
|
2164
|
-
},
|
|
2162
|
+
dx: a.x - o.x,
|
|
2163
|
+
dy: a.y - o.y
|
|
2164
|
+
}, U(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2165
2165
|
passive: !0
|
|
2166
2166
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2167
2167
|
passive: !0
|
|
2168
2168
|
});
|
|
2169
2169
|
});
|
|
2170
|
-
|
|
2170
|
+
i(this, "onTouchStart", (e) => {
|
|
2171
2171
|
if (e.touches.length !== 1)
|
|
2172
2172
|
return;
|
|
2173
2173
|
e.stopPropagation();
|
|
2174
|
-
const t = e.touches[0], s = e.currentTarget,
|
|
2174
|
+
const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(o);
|
|
2175
2175
|
if (!this.params.nodeDragVerifier({
|
|
2176
|
-
nodeId:
|
|
2176
|
+
nodeId: o,
|
|
2177
2177
|
element: n.element,
|
|
2178
2178
|
x: n.x,
|
|
2179
2179
|
y: n.y
|
|
@@ -2184,10 +2184,10 @@ class Q {
|
|
|
2184
2184
|
y: t.clientY
|
|
2185
2185
|
});
|
|
2186
2186
|
this.grabbedNode = {
|
|
2187
|
-
nodeId:
|
|
2187
|
+
nodeId: o,
|
|
2188
2188
|
dx: h.x - n.x,
|
|
2189
2189
|
dy: h.y - n.y
|
|
2190
|
-
}, this.moveNodeOnTop(
|
|
2190
|
+
}, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2191
2191
|
passive: !0
|
|
2192
2192
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2193
2193
|
passive: !0
|
|
@@ -2195,8 +2195,8 @@ class Q {
|
|
|
2195
2195
|
passive: !0
|
|
2196
2196
|
});
|
|
2197
2197
|
});
|
|
2198
|
-
|
|
2199
|
-
if (!
|
|
2198
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2199
|
+
if (!F(
|
|
2200
2200
|
this.window,
|
|
2201
2201
|
this.element,
|
|
2202
2202
|
e.clientX,
|
|
@@ -2210,14 +2210,14 @@ class Q {
|
|
|
2210
2210
|
y: e.clientY
|
|
2211
2211
|
});
|
|
2212
2212
|
});
|
|
2213
|
-
|
|
2213
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2214
2214
|
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
2215
2215
|
});
|
|
2216
|
-
|
|
2216
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2217
2217
|
if (e.touches.length !== 1)
|
|
2218
2218
|
return;
|
|
2219
2219
|
const t = e.touches[0];
|
|
2220
|
-
if (!
|
|
2220
|
+
if (!F(
|
|
2221
2221
|
this.window,
|
|
2222
2222
|
this.element,
|
|
2223
2223
|
t.clientX,
|
|
@@ -2231,20 +2231,20 @@ class Q {
|
|
|
2231
2231
|
y: t.clientY
|
|
2232
2232
|
});
|
|
2233
2233
|
});
|
|
2234
|
-
|
|
2234
|
+
i(this, "onWindowTouchFinish", () => {
|
|
2235
2235
|
this.cancelTouchDrag();
|
|
2236
2236
|
});
|
|
2237
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2237
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
|
|
2238
2238
|
}
|
|
2239
|
-
static configure(e, t, s,
|
|
2240
|
-
new
|
|
2239
|
+
static configure(e, t, s, o) {
|
|
2240
|
+
new J(e, t, s, o);
|
|
2241
2241
|
}
|
|
2242
2242
|
moveNode(e, t) {
|
|
2243
2243
|
if (this.graph.getNode(e.nodeId) === null)
|
|
2244
2244
|
return;
|
|
2245
|
-
const
|
|
2246
|
-
x:
|
|
2247
|
-
y:
|
|
2245
|
+
const o = this.calculateContentPoint(t), n = {
|
|
2246
|
+
x: o.x - e.dx,
|
|
2247
|
+
y: o.y - e.dy
|
|
2248
2248
|
}, a = this.adjustNodeCoords(n);
|
|
2249
2249
|
this.canvas.updateNode(e.nodeId, {
|
|
2250
2250
|
x: a.x,
|
|
@@ -2255,15 +2255,15 @@ class Q {
|
|
|
2255
2255
|
if (this.params.moveOnTop) {
|
|
2256
2256
|
if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
|
|
2257
2257
|
const t = this.maxNodePriority;
|
|
2258
|
-
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((
|
|
2259
|
-
this.canvas.updateEdge(
|
|
2258
|
+
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
|
|
2259
|
+
this.canvas.updateEdge(o, { priority: t });
|
|
2260
2260
|
});
|
|
2261
2261
|
}
|
|
2262
2262
|
this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
2263
2263
|
}
|
|
2264
2264
|
}
|
|
2265
2265
|
cancelMouseDrag() {
|
|
2266
|
-
this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2266
|
+
this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
|
|
2267
2267
|
}
|
|
2268
2268
|
removeMouseDragListeners() {
|
|
2269
2269
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2291,8 +2291,8 @@ class Q {
|
|
|
2291
2291
|
const t = this.element.getBoundingClientRect(), s = {
|
|
2292
2292
|
x: e.x - t.x,
|
|
2293
2293
|
y: e.y - t.y
|
|
2294
|
-
},
|
|
2295
|
-
return D(
|
|
2294
|
+
}, o = this.canvas.viewport.getViewportMatrix();
|
|
2295
|
+
return D(o, s);
|
|
2296
2296
|
}
|
|
2297
2297
|
adjustNodeCoords(e) {
|
|
2298
2298
|
const t = this.params.gridSize;
|
|
@@ -2306,51 +2306,51 @@ class Q {
|
|
|
2306
2306
|
return e;
|
|
2307
2307
|
}
|
|
2308
2308
|
}
|
|
2309
|
-
const
|
|
2309
|
+
const xt = (r, e, t) => ({
|
|
2310
2310
|
scale: r.scale,
|
|
2311
2311
|
x: r.x + r.scale * e,
|
|
2312
2312
|
y: r.y + r.scale * t
|
|
2313
|
-
}),
|
|
2313
|
+
}), At = (r, e, t, s) => ({
|
|
2314
2314
|
scale: r.scale * e,
|
|
2315
2315
|
x: r.scale * (1 - e) * t + r.x,
|
|
2316
2316
|
y: r.scale * (1 - e) * s + r.y
|
|
2317
|
-
}),
|
|
2317
|
+
}), $ = (r) => {
|
|
2318
2318
|
const e = [], t = r.touches.length;
|
|
2319
2319
|
for (let h = 0; h < t; h++)
|
|
2320
2320
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2321
2321
|
const s = e.reduce(
|
|
2322
2322
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2323
2323
|
[0, 0]
|
|
2324
|
-
),
|
|
2324
|
+
), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
|
|
2325
2325
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2326
2326
|
0
|
|
2327
2327
|
);
|
|
2328
2328
|
return {
|
|
2329
|
-
x:
|
|
2330
|
-
y:
|
|
2329
|
+
x: o[0],
|
|
2330
|
+
y: o[1],
|
|
2331
2331
|
scale: a / t,
|
|
2332
2332
|
touchesCnt: t,
|
|
2333
2333
|
touches: e
|
|
2334
2334
|
};
|
|
2335
2335
|
};
|
|
2336
|
-
class
|
|
2337
|
-
constructor(e, t, s,
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2336
|
+
class H {
|
|
2337
|
+
constructor(e, t, s, o) {
|
|
2338
|
+
i(this, "viewport");
|
|
2339
|
+
i(this, "prevTouches", null);
|
|
2340
|
+
i(this, "wheelFinishTimer", null);
|
|
2341
|
+
i(this, "transformInProgress", !1);
|
|
2342
|
+
i(this, "onBeforeDestroy", () => {
|
|
2343
2343
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2344
2344
|
});
|
|
2345
|
-
|
|
2346
|
-
this.element === null || !this.params.mouseDownEventVerifier(e) || (
|
|
2345
|
+
i(this, "onMouseDown", (e) => {
|
|
2346
|
+
this.element === null || !this.params.mouseDownEventVerifier(e) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2347
2347
|
passive: !0
|
|
2348
2348
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2349
2349
|
passive: !0
|
|
2350
2350
|
}), this.startRegisteredTransform());
|
|
2351
2351
|
});
|
|
2352
|
-
|
|
2353
|
-
const t =
|
|
2352
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2353
|
+
const t = F(
|
|
2354
2354
|
this.window,
|
|
2355
2355
|
this.element,
|
|
2356
2356
|
e.clientX,
|
|
@@ -2360,26 +2360,26 @@ class X {
|
|
|
2360
2360
|
this.stopMouseDrag();
|
|
2361
2361
|
return;
|
|
2362
2362
|
}
|
|
2363
|
-
const s = -e.movementX,
|
|
2364
|
-
this.moveViewport(s,
|
|
2363
|
+
const s = -e.movementX, o = -e.movementY;
|
|
2364
|
+
this.moveViewport(s, o);
|
|
2365
2365
|
});
|
|
2366
|
-
|
|
2366
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2367
2367
|
this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
|
|
2368
2368
|
});
|
|
2369
|
-
|
|
2369
|
+
i(this, "onWheelScroll", (e) => {
|
|
2370
2370
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2371
2371
|
return;
|
|
2372
|
-
const { left: t, top: s } = this.element.getBoundingClientRect(),
|
|
2373
|
-
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h,
|
|
2372
|
+
const { left: t, top: s } = this.element.getBoundingClientRect(), o = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
|
|
2373
|
+
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2374
2374
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2375
2375
|
}, this.params.scaleWheelFinishTimeout);
|
|
2376
2376
|
});
|
|
2377
|
-
|
|
2377
|
+
i(this, "onTouchStart", (e) => {
|
|
2378
2378
|
if (this.prevTouches !== null) {
|
|
2379
|
-
this.prevTouches =
|
|
2379
|
+
this.prevTouches = $(e);
|
|
2380
2380
|
return;
|
|
2381
2381
|
}
|
|
2382
|
-
this.prevTouches =
|
|
2382
|
+
this.prevTouches = $(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2383
2383
|
passive: !0
|
|
2384
2384
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2385
2385
|
passive: !0
|
|
@@ -2387,10 +2387,10 @@ class X {
|
|
|
2387
2387
|
passive: !0
|
|
2388
2388
|
}), this.startRegisteredTransform();
|
|
2389
2389
|
});
|
|
2390
|
-
|
|
2391
|
-
const t =
|
|
2390
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2391
|
+
const t = $(e);
|
|
2392
2392
|
if (!t.touches.every(
|
|
2393
|
-
(
|
|
2393
|
+
(o) => F(this.window, this.element, o[0], o[1])
|
|
2394
2394
|
)) {
|
|
2395
2395
|
this.stopTouchDrag();
|
|
2396
2396
|
return;
|
|
@@ -2399,27 +2399,27 @@ class X {
|
|
|
2399
2399
|
-(t.x - this.prevTouches.x),
|
|
2400
2400
|
-(t.y - this.prevTouches.y)
|
|
2401
2401
|
), t.touchesCnt === 2) {
|
|
2402
|
-
const { left:
|
|
2402
|
+
const { left: o, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - o, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
|
|
2403
2403
|
this.scaleViewport(c, a, h);
|
|
2404
2404
|
}
|
|
2405
2405
|
this.prevTouches = t;
|
|
2406
2406
|
});
|
|
2407
|
-
|
|
2408
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2407
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2408
|
+
e.touches.length > 0 ? this.prevTouches = $(e) : this.stopTouchDrag();
|
|
2409
2409
|
});
|
|
2410
|
-
|
|
2411
|
-
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(),
|
|
2410
|
+
i(this, "observer", new ResizeObserver(() => {
|
|
2411
|
+
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), o = this.params.transformPreprocessor({
|
|
2412
2412
|
prevTransform: e,
|
|
2413
2413
|
nextTransform: e,
|
|
2414
2414
|
canvasWidth: t,
|
|
2415
2415
|
canvasHeight: s
|
|
2416
2416
|
});
|
|
2417
|
-
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(
|
|
2417
|
+
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
|
|
2418
2418
|
}));
|
|
2419
|
-
|
|
2419
|
+
i(this, "preventWheelScaleListener", (e) => {
|
|
2420
2420
|
e.preventDefault();
|
|
2421
2421
|
});
|
|
2422
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2422
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2423
2423
|
passive: !1
|
|
2424
2424
|
}), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
2425
2425
|
passive: !0
|
|
@@ -2429,21 +2429,21 @@ class X {
|
|
|
2429
2429
|
passive: !0
|
|
2430
2430
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2431
2431
|
}
|
|
2432
|
-
static configure(e, t, s,
|
|
2433
|
-
new
|
|
2432
|
+
static configure(e, t, s, o) {
|
|
2433
|
+
new H(e, t, s, o);
|
|
2434
2434
|
}
|
|
2435
2435
|
moveViewport(e, t) {
|
|
2436
|
-
const s = this.viewport.getViewportMatrix(),
|
|
2436
|
+
const s = this.viewport.getViewportMatrix(), o = xt(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
|
|
2437
2437
|
prevTransform: s,
|
|
2438
|
-
nextTransform:
|
|
2438
|
+
nextTransform: o,
|
|
2439
2439
|
canvasWidth: n,
|
|
2440
2440
|
canvasHeight: a
|
|
2441
2441
|
});
|
|
2442
2442
|
this.performTransform(h);
|
|
2443
2443
|
}
|
|
2444
2444
|
scaleViewport(e, t, s) {
|
|
2445
|
-
const
|
|
2446
|
-
prevTransform:
|
|
2445
|
+
const o = this.canvas.viewport.getViewportMatrix(), n = At(o, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2446
|
+
prevTransform: o,
|
|
2447
2447
|
nextTransform: n,
|
|
2448
2448
|
canvasWidth: a,
|
|
2449
2449
|
canvasHeight: h
|
|
@@ -2451,7 +2451,7 @@ class X {
|
|
|
2451
2451
|
this.performTransform(d);
|
|
2452
2452
|
}
|
|
2453
2453
|
stopMouseDrag() {
|
|
2454
|
-
|
|
2454
|
+
U(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2455
2455
|
}
|
|
2456
2456
|
removeMouseDragListeners() {
|
|
2457
2457
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2473,21 +2473,21 @@ class X {
|
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
2475
2475
|
class q {
|
|
2476
|
-
constructor(e, t, s,
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2476
|
+
constructor(e, t, s, o, n, a) {
|
|
2477
|
+
i(this, "canvasResizeObserver");
|
|
2478
|
+
i(this, "nodeHorizontal");
|
|
2479
|
+
i(this, "nodeVertical");
|
|
2480
|
+
i(this, "viewport");
|
|
2481
|
+
i(this, "viewportWidth", 0);
|
|
2482
|
+
i(this, "viewportHeight", 0);
|
|
2483
|
+
i(this, "viewportMatrix");
|
|
2484
|
+
i(this, "loadedArea", {
|
|
2485
2485
|
xFrom: 1 / 0,
|
|
2486
2486
|
xTo: 1 / 0,
|
|
2487
2487
|
yFrom: 1 / 0,
|
|
2488
2488
|
yTo: 1 / 0
|
|
2489
2489
|
});
|
|
2490
|
-
|
|
2490
|
+
i(this, "updateLoadedArea", (e) => {
|
|
2491
2491
|
this.loadedArea = {
|
|
2492
2492
|
xFrom: e.x,
|
|
2493
2493
|
xTo: e.x + e.width,
|
|
@@ -2495,47 +2495,47 @@ class q {
|
|
|
2495
2495
|
yTo: e.y + e.height
|
|
2496
2496
|
};
|
|
2497
2497
|
});
|
|
2498
|
-
|
|
2498
|
+
i(this, "onAfterViewportUpdated", () => {
|
|
2499
2499
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
2500
2500
|
});
|
|
2501
|
-
|
|
2501
|
+
i(this, "userTransformInProgress", !1);
|
|
2502
2502
|
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
|
|
2503
2503
|
const c = d[0];
|
|
2504
2504
|
this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
2505
2505
|
}), this.viewport = e.viewport;
|
|
2506
2506
|
const h = {
|
|
2507
|
-
...
|
|
2507
|
+
...o,
|
|
2508
2508
|
onResizeTransformStarted: () => {
|
|
2509
|
-
this.userTransformInProgress = !0,
|
|
2509
|
+
this.userTransformInProgress = !0, o.onResizeTransformStarted();
|
|
2510
2510
|
},
|
|
2511
2511
|
onResizeTransformFinished: () => {
|
|
2512
|
-
this.userTransformInProgress = !1,
|
|
2512
|
+
this.userTransformInProgress = !1, o.onResizeTransformFinished();
|
|
2513
2513
|
},
|
|
2514
2514
|
onBeforeTransformChange: () => {
|
|
2515
|
-
this.userTransformInProgress = !0,
|
|
2515
|
+
this.userTransformInProgress = !0, o.onBeforeTransformChange();
|
|
2516
2516
|
},
|
|
2517
2517
|
onTransformChange: () => {
|
|
2518
2518
|
this.userTransformInProgress = !1;
|
|
2519
2519
|
const d = this.viewportMatrix;
|
|
2520
|
-
this.viewportMatrix = this.viewport.getViewportMatrix(), d.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(),
|
|
2520
|
+
this.viewportMatrix = this.viewport.getViewportMatrix(), d.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
|
|
2521
2521
|
},
|
|
2522
2522
|
onTransformFinished: () => {
|
|
2523
|
-
this.scheduleLoadAreaAroundViewport(),
|
|
2523
|
+
this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
|
|
2524
2524
|
}
|
|
2525
2525
|
};
|
|
2526
|
-
|
|
2526
|
+
H.configure(
|
|
2527
2527
|
e,
|
|
2528
2528
|
this.element,
|
|
2529
2529
|
this.window,
|
|
2530
2530
|
h
|
|
2531
2531
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2532
2532
|
}
|
|
2533
|
-
static configure(e, t, s,
|
|
2533
|
+
static configure(e, t, s, o, n, a) {
|
|
2534
2534
|
new q(
|
|
2535
2535
|
e,
|
|
2536
2536
|
t,
|
|
2537
2537
|
s,
|
|
2538
|
-
|
|
2538
|
+
o,
|
|
2539
2539
|
n,
|
|
2540
2540
|
a
|
|
2541
2541
|
);
|
|
@@ -2546,21 +2546,21 @@ class q {
|
|
|
2546
2546
|
});
|
|
2547
2547
|
}
|
|
2548
2548
|
scheduleEnsureViewportAreaLoaded() {
|
|
2549
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal,
|
|
2550
|
-
this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom <
|
|
2549
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, o = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, a = this.viewportMatrix.y + t + this.nodeVertical;
|
|
2550
|
+
this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < o && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
|
|
2551
2551
|
}
|
|
2552
2552
|
loadAreaAroundViewport() {
|
|
2553
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal,
|
|
2554
|
-
this.trigger.emit({ x: s, y:
|
|
2553
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, o = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, a = 3 * t + 2 * this.nodeVertical;
|
|
2554
|
+
this.trigger.emit({ x: s, y: o, width: n, height: a });
|
|
2555
2555
|
}
|
|
2556
2556
|
}
|
|
2557
|
-
const
|
|
2557
|
+
const Et = () => {
|
|
2558
2558
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2559
2559
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2560
|
-
},
|
|
2560
|
+
}, St = () => {
|
|
2561
2561
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2562
2562
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2563
|
-
},
|
|
2563
|
+
}, bt = () => {
|
|
2564
2564
|
const r = document.createElementNS(
|
|
2565
2565
|
"http://www.w3.org/2000/svg",
|
|
2566
2566
|
"pattern"
|
|
@@ -2569,29 +2569,29 @@ const vt = () => {
|
|
|
2569
2569
|
};
|
|
2570
2570
|
class _ {
|
|
2571
2571
|
constructor(e, t, s) {
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
const t = e[0], { width: s, height:
|
|
2584
|
-
this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${
|
|
2585
|
-
const n = this.tileWidth / s, a = this.tileHeight /
|
|
2572
|
+
i(this, "svg", Et());
|
|
2573
|
+
i(this, "patternRenderingRectangle", St());
|
|
2574
|
+
i(this, "pattern", bt());
|
|
2575
|
+
i(this, "patternContent");
|
|
2576
|
+
i(this, "tileWidth");
|
|
2577
|
+
i(this, "tileHeight");
|
|
2578
|
+
i(this, "halfTileWidth");
|
|
2579
|
+
i(this, "halfTileHeight");
|
|
2580
|
+
i(this, "maxViewportScale");
|
|
2581
|
+
i(this, "visible", !1);
|
|
2582
|
+
i(this, "resizeObserver", new ResizeObserver((e) => {
|
|
2583
|
+
const t = e[0], { width: s, height: o } = t.contentRect;
|
|
2584
|
+
this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${o}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${o}`);
|
|
2585
|
+
const n = this.tileWidth / s, a = this.tileHeight / o;
|
|
2586
2586
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
|
|
2587
2587
|
}));
|
|
2588
|
-
|
|
2589
|
-
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale,
|
|
2590
|
-
this.pattern.setAttribute("patternTransform",
|
|
2588
|
+
i(this, "onAfterTransformUpdated", () => {
|
|
2589
|
+
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, o = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
|
|
2590
|
+
this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
|
|
2591
2591
|
});
|
|
2592
2592
|
this.canvas = e, this.backgroundHost = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
|
|
2593
|
-
const
|
|
2594
|
-
this.patternContent.setAttribute("transform",
|
|
2593
|
+
const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2594
|
+
this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
|
|
2595
2595
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2596
2596
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2597
2597
|
}
|
|
@@ -2604,14 +2604,14 @@ class _ {
|
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
2606
2606
|
class ee {
|
|
2607
|
-
constructor(e, t, s,
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2607
|
+
constructor(e, t, s, o, n) {
|
|
2608
|
+
i(this, "overlayCanvas");
|
|
2609
|
+
i(this, "staticPortId", null);
|
|
2610
|
+
i(this, "isTargetDragging", !0);
|
|
2611
|
+
i(this, "onEdgeCreated", (e) => {
|
|
2612
2612
|
this.params.onAfterEdgeCreated(e);
|
|
2613
2613
|
});
|
|
2614
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2614
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Fe(
|
|
2615
2615
|
this.overlayLayer,
|
|
2616
2616
|
this.viewportStore
|
|
2617
2617
|
), z.configure(
|
|
@@ -2637,46 +2637,46 @@ class ee {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
);
|
|
2639
2639
|
}
|
|
2640
|
-
static configure(e, t, s,
|
|
2640
|
+
static configure(e, t, s, o, n) {
|
|
2641
2641
|
new ee(
|
|
2642
2642
|
e,
|
|
2643
2643
|
t,
|
|
2644
2644
|
s,
|
|
2645
|
-
|
|
2645
|
+
o,
|
|
2646
2646
|
n
|
|
2647
2647
|
);
|
|
2648
2648
|
}
|
|
2649
2649
|
grabPort(e, t, s) {
|
|
2650
|
-
const
|
|
2650
|
+
const o = this.canvas.graph.getPort(e);
|
|
2651
2651
|
this.staticPortId = e;
|
|
2652
|
-
const n =
|
|
2652
|
+
const n = o.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), g = D(c, {
|
|
2653
2653
|
x: a - d.x,
|
|
2654
2654
|
y: h - d.y
|
|
2655
2655
|
}), l = D(c, {
|
|
2656
2656
|
x: t.x - d.x,
|
|
2657
2657
|
y: t.y - d.y
|
|
2658
2658
|
}), u = {
|
|
2659
|
-
overlayId:
|
|
2659
|
+
overlayId: T.Static,
|
|
2660
2660
|
portCoords: g,
|
|
2661
|
-
portDirection:
|
|
2661
|
+
portDirection: o.direction
|
|
2662
2662
|
}, w = {
|
|
2663
|
-
overlayId:
|
|
2663
|
+
overlayId: T.Dragging,
|
|
2664
2664
|
portCoords: l,
|
|
2665
2665
|
portDirection: this.params.dragPortDirection
|
|
2666
2666
|
};
|
|
2667
2667
|
this.isTargetDragging = s === "direct";
|
|
2668
|
-
const [
|
|
2669
|
-
this.overlayCanvas.addNode(
|
|
2670
|
-
from:
|
|
2671
|
-
to:
|
|
2672
|
-
shape: this.params.edgeShapeFactory(
|
|
2668
|
+
const [y, x] = this.isTargetDragging ? [u, w] : [w, u];
|
|
2669
|
+
this.overlayCanvas.addNode(B(y)), this.overlayCanvas.addNode(B(x)), this.overlayCanvas.addEdge({
|
|
2670
|
+
from: y.overlayId,
|
|
2671
|
+
to: x.overlayId,
|
|
2672
|
+
shape: this.params.edgeShapeFactory(T.Edge)
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
2675
|
resetDragState() {
|
|
2676
2676
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2677
2677
|
}
|
|
2678
2678
|
tryCreateConnection(e) {
|
|
2679
|
-
const t =
|
|
2679
|
+
const t = Ee(this.canvas.graph, e), s = this.staticPortId;
|
|
2680
2680
|
if (t === null) {
|
|
2681
2681
|
this.params.onEdgeCreationInterrupted({
|
|
2682
2682
|
staticPortId: s,
|
|
@@ -2684,30 +2684,30 @@ class ee {
|
|
|
2684
2684
|
});
|
|
2685
2685
|
return;
|
|
2686
2686
|
}
|
|
2687
|
-
const
|
|
2687
|
+
const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
|
|
2688
2688
|
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
|
|
2689
2689
|
}
|
|
2690
2690
|
moveDraggingPort(e) {
|
|
2691
2691
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2692
2692
|
x: e.x - t.x,
|
|
2693
2693
|
y: e.y - t.y
|
|
2694
|
-
},
|
|
2695
|
-
this.overlayCanvas.updateNode(
|
|
2694
|
+
}, o = this.canvas.viewport.getViewportMatrix(), n = D(o, s);
|
|
2695
|
+
this.overlayCanvas.updateNode(T.Dragging, {
|
|
2696
2696
|
x: n.x,
|
|
2697
2697
|
y: n.y
|
|
2698
2698
|
});
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
2701
|
class te {
|
|
2702
|
-
constructor(e, t, s,
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2702
|
+
constructor(e, t, s, o, n) {
|
|
2703
|
+
i(this, "overlayCanvas");
|
|
2704
|
+
i(this, "staticPortId", null);
|
|
2705
|
+
i(this, "isTargetDragging", !0);
|
|
2706
|
+
i(this, "draggingEdgePayload", null);
|
|
2707
|
+
i(this, "onEdgeReattached", (e) => {
|
|
2708
2708
|
this.params.onAfterEdgeReattached(e);
|
|
2709
2709
|
});
|
|
2710
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2710
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Fe(
|
|
2711
2711
|
this.overlayLayer,
|
|
2712
2712
|
this.viewportStore
|
|
2713
2713
|
), z.configure(
|
|
@@ -2730,12 +2730,12 @@ class te {
|
|
|
2730
2730
|
}
|
|
2731
2731
|
);
|
|
2732
2732
|
}
|
|
2733
|
-
static configure(e, t, s,
|
|
2733
|
+
static configure(e, t, s, o, n) {
|
|
2734
2734
|
new te(
|
|
2735
2735
|
e,
|
|
2736
2736
|
t,
|
|
2737
2737
|
s,
|
|
2738
|
-
|
|
2738
|
+
o,
|
|
2739
2739
|
n
|
|
2740
2740
|
);
|
|
2741
2741
|
}
|
|
@@ -2743,43 +2743,43 @@ class te {
|
|
|
2743
2743
|
const s = this.params.draggingEdgeResolver(e);
|
|
2744
2744
|
if (s === null)
|
|
2745
2745
|
return !1;
|
|
2746
|
-
const
|
|
2747
|
-
if (
|
|
2746
|
+
const o = this.canvas.graph.getEdge(s);
|
|
2747
|
+
if (o === null)
|
|
2748
2748
|
return !1;
|
|
2749
|
-
const n = e ===
|
|
2749
|
+
const n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
|
|
2750
2750
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2751
2751
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2752
2752
|
x: g.x + g.width / 2,
|
|
2753
2753
|
y: g.y + g.height / 2
|
|
2754
|
-
}, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(),
|
|
2754
|
+
}, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), y = D(u, {
|
|
2755
2755
|
x: l.x - w.x,
|
|
2756
2756
|
y: l.y - w.y
|
|
2757
|
-
}),
|
|
2757
|
+
}), x = D(u, {
|
|
2758
2758
|
x: t.x - w.x,
|
|
2759
2759
|
y: t.y - w.y
|
|
2760
2760
|
});
|
|
2761
2761
|
this.draggingEdgePayload = {
|
|
2762
2762
|
id: s,
|
|
2763
|
-
from:
|
|
2764
|
-
to:
|
|
2765
|
-
shape:
|
|
2766
|
-
priority:
|
|
2763
|
+
from: o.from,
|
|
2764
|
+
to: o.to,
|
|
2765
|
+
shape: o.shape,
|
|
2766
|
+
priority: o.priority
|
|
2767
2767
|
}, this.canvas.removeEdge(s);
|
|
2768
|
-
const
|
|
2769
|
-
overlayId:
|
|
2770
|
-
portCoords:
|
|
2768
|
+
const A = {
|
|
2769
|
+
overlayId: T.Static,
|
|
2770
|
+
portCoords: y,
|
|
2771
2771
|
portDirection: c.direction
|
|
2772
|
-
},
|
|
2773
|
-
overlayId:
|
|
2774
|
-
portCoords:
|
|
2772
|
+
}, S = {
|
|
2773
|
+
overlayId: T.Dragging,
|
|
2774
|
+
portCoords: x,
|
|
2775
2775
|
portDirection: d.direction
|
|
2776
|
-
}, [
|
|
2777
|
-
this.overlayCanvas.addNode(
|
|
2778
|
-
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(
|
|
2776
|
+
}, [C, P] = this.isTargetDragging ? [A, S] : [S, A];
|
|
2777
|
+
this.overlayCanvas.addNode(B(C)), this.overlayCanvas.addNode(B(P));
|
|
2778
|
+
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.Edge) : o.shape;
|
|
2779
2779
|
return this.overlayCanvas.addEdge({
|
|
2780
|
-
id:
|
|
2781
|
-
from:
|
|
2782
|
-
to:
|
|
2780
|
+
id: T.Edge,
|
|
2781
|
+
from: C.overlayId,
|
|
2782
|
+
to: P.overlayId,
|
|
2783
2783
|
shape: N
|
|
2784
2784
|
}), !0;
|
|
2785
2785
|
}
|
|
@@ -2790,15 +2790,15 @@ class te {
|
|
|
2790
2790
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2791
2791
|
x: e.x - t.x,
|
|
2792
2792
|
y: e.y - t.y
|
|
2793
|
-
},
|
|
2794
|
-
this.overlayCanvas.updateNode(
|
|
2793
|
+
}, o = this.canvas.viewport.getViewportMatrix(), n = D(o, s);
|
|
2794
|
+
this.overlayCanvas.updateNode(T.Dragging, {
|
|
2795
2795
|
x: n.x,
|
|
2796
2796
|
y: n.y
|
|
2797
2797
|
});
|
|
2798
2798
|
}
|
|
2799
2799
|
tryCreateConnection(e) {
|
|
2800
|
-
const t =
|
|
2801
|
-
if (this.overlayCanvas.removeEdge(
|
|
2800
|
+
const t = Ee(this.canvas.graph, e);
|
|
2801
|
+
if (this.overlayCanvas.removeEdge(T.Edge), t === null) {
|
|
2802
2802
|
const d = this.draggingEdgePayload;
|
|
2803
2803
|
this.params.onEdgeReattachInterrupted({
|
|
2804
2804
|
id: d.id,
|
|
@@ -2809,10 +2809,10 @@ class te {
|
|
|
2809
2809
|
});
|
|
2810
2810
|
return;
|
|
2811
2811
|
}
|
|
2812
|
-
const [s,
|
|
2812
|
+
const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2813
2813
|
id: n.id,
|
|
2814
2814
|
from: s,
|
|
2815
|
-
to:
|
|
2815
|
+
to: o,
|
|
2816
2816
|
shape: n.shape,
|
|
2817
2817
|
priority: n.priority
|
|
2818
2818
|
}, h = this.params.connectionPreprocessor(a);
|
|
@@ -2851,7 +2851,7 @@ class re {
|
|
|
2851
2851
|
}
|
|
2852
2852
|
class se {
|
|
2853
2853
|
constructor(e, t) {
|
|
2854
|
-
|
|
2854
|
+
i(this, "applyScheduled", !1);
|
|
2855
2855
|
this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
|
|
2856
2856
|
this.scheduleApply();
|
|
2857
2857
|
}), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
|
|
@@ -2879,7 +2879,7 @@ class se {
|
|
|
2879
2879
|
});
|
|
2880
2880
|
}
|
|
2881
2881
|
}
|
|
2882
|
-
class
|
|
2882
|
+
class Pt {
|
|
2883
2883
|
static configure(e, t) {
|
|
2884
2884
|
const s = t.applyOn;
|
|
2885
2885
|
switch (s.type) {
|
|
@@ -2901,10 +2901,10 @@ class xt {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
}
|
|
2903
2903
|
}
|
|
2904
|
-
class
|
|
2904
|
+
class Tt {
|
|
2905
2905
|
constructor(e, t) {
|
|
2906
|
-
|
|
2907
|
-
|
|
2906
|
+
i(this, "previousTimeStamp");
|
|
2907
|
+
i(this, "step", (e) => {
|
|
2908
2908
|
if (this.previousTimeStamp === void 0)
|
|
2909
2909
|
this.previousTimeStamp = e;
|
|
2910
2910
|
else {
|
|
@@ -2917,51 +2917,51 @@ class St {
|
|
|
2917
2917
|
}
|
|
2918
2918
|
}
|
|
2919
2919
|
class oe {
|
|
2920
|
-
constructor(e, t, s,
|
|
2921
|
-
|
|
2920
|
+
constructor(e, t, s, o) {
|
|
2921
|
+
i(this, "step", (e) => {
|
|
2922
2922
|
this.algorithm.calculateNextCoordinates(
|
|
2923
2923
|
this.canvas.graph,
|
|
2924
2924
|
e
|
|
2925
|
-
).forEach((s,
|
|
2926
|
-
this.staticNodes.has(
|
|
2925
|
+
).forEach((s, o) => {
|
|
2926
|
+
this.staticNodes.has(o) || this.canvas.updateNode(o, { x: s.x, y: s.y });
|
|
2927
2927
|
});
|
|
2928
2928
|
});
|
|
2929
|
-
this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win =
|
|
2929
|
+
this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = o, new Tt(this.win, this.step);
|
|
2930
2930
|
}
|
|
2931
|
-
static configure(e, t, s,
|
|
2932
|
-
new oe(e, t, s,
|
|
2931
|
+
static configure(e, t, s, o) {
|
|
2932
|
+
new oe(e, t, s, o);
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
|
-
const
|
|
2935
|
+
const Ct = () => {
|
|
2936
2936
|
const r = document.createElement("div");
|
|
2937
2937
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2938
|
-
},
|
|
2938
|
+
}, Y = () => {
|
|
2939
2939
|
const r = document.createElement("div");
|
|
2940
2940
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2941
2941
|
}, pe = () => {
|
|
2942
|
-
const r =
|
|
2942
|
+
const r = Y();
|
|
2943
2943
|
return r.style.pointerEvents = "none", r;
|
|
2944
2944
|
};
|
|
2945
|
-
class
|
|
2945
|
+
class Dt {
|
|
2946
2946
|
constructor(e) {
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2947
|
+
i(this, "background", Y());
|
|
2948
|
+
i(this, "main", Y());
|
|
2949
|
+
i(this, "overlayConnectablePorts", pe());
|
|
2950
|
+
i(this, "overlayDraggableEdges", pe());
|
|
2951
|
+
i(this, "host", Ct());
|
|
2952
2952
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
2953
2953
|
}
|
|
2954
2954
|
destroy() {
|
|
2955
2955
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
2956
2956
|
}
|
|
2957
2957
|
}
|
|
2958
|
-
const
|
|
2958
|
+
const G = (r) => () => r, we = G(0), Nt = () => {
|
|
2959
2959
|
let r = 0;
|
|
2960
2960
|
return () => r++;
|
|
2961
|
-
},
|
|
2961
|
+
}, Mt = (r, e) => {
|
|
2962
2962
|
let t = we, s = we;
|
|
2963
|
-
const
|
|
2964
|
-
return r === "incremental" && (t =
|
|
2963
|
+
const o = Nt();
|
|
2964
|
+
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = G(r)), typeof e == "number" && (s = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
2965
2965
|
nodesPriorityFn: t,
|
|
2966
2966
|
edgesPriorityFn: s
|
|
2967
2967
|
};
|
|
@@ -2970,7 +2970,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
2970
2970
|
return r;
|
|
2971
2971
|
switch (r.type) {
|
|
2972
2972
|
case "straight":
|
|
2973
|
-
return () => new
|
|
2973
|
+
return () => new wt({
|
|
2974
2974
|
color: r.color,
|
|
2975
2975
|
width: r.width,
|
|
2976
2976
|
arrowLength: r.arrowLength,
|
|
@@ -2984,7 +2984,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
2984
2984
|
detourDirection: r.detourDirection
|
|
2985
2985
|
});
|
|
2986
2986
|
case "horizontal":
|
|
2987
|
-
return () => new
|
|
2987
|
+
return () => new pt({
|
|
2988
2988
|
color: r.color,
|
|
2989
2989
|
width: r.width,
|
|
2990
2990
|
arrowLength: r.arrowLength,
|
|
@@ -2997,7 +2997,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
2997
2997
|
detourDistance: r.detourDistance
|
|
2998
2998
|
});
|
|
2999
2999
|
case "vertical":
|
|
3000
|
-
return () => new
|
|
3000
|
+
return () => new ft({
|
|
3001
3001
|
color: r.color,
|
|
3002
3002
|
width: r.width,
|
|
3003
3003
|
arrowLength: r.arrowLength,
|
|
@@ -3010,7 +3010,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3010
3010
|
detourDistance: r.detourDistance
|
|
3011
3011
|
});
|
|
3012
3012
|
case "direct":
|
|
3013
|
-
return () => new
|
|
3013
|
+
return () => new Ne({
|
|
3014
3014
|
color: r.color,
|
|
3015
3015
|
width: r.width,
|
|
3016
3016
|
arrowLength: r.arrowLength,
|
|
@@ -3021,7 +3021,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3021
3021
|
targetOffset: r.targetOffset
|
|
3022
3022
|
});
|
|
3023
3023
|
default:
|
|
3024
|
-
return () => new
|
|
3024
|
+
return () => new ut({
|
|
3025
3025
|
color: r.color,
|
|
3026
3026
|
width: r.width,
|
|
3027
3027
|
arrowLength: r.arrowLength,
|
|
@@ -3035,15 +3035,15 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3035
3035
|
detourDirection: r.detourDirection
|
|
3036
3036
|
});
|
|
3037
3037
|
}
|
|
3038
|
-
},
|
|
3039
|
-
var t, s,
|
|
3040
|
-
const e =
|
|
3038
|
+
}, Lt = (r) => {
|
|
3039
|
+
var t, s, o, n, a;
|
|
3040
|
+
const e = Mt(
|
|
3041
3041
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
3042
3042
|
(s = r.edges) == null ? void 0 : s.priority
|
|
3043
3043
|
);
|
|
3044
3044
|
return {
|
|
3045
3045
|
nodes: {
|
|
3046
|
-
centerFn: ((
|
|
3046
|
+
centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Se,
|
|
3047
3047
|
priorityFn: e.nodesPriorityFn
|
|
3048
3048
|
},
|
|
3049
3049
|
ports: {
|
|
@@ -3054,39 +3054,41 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3054
3054
|
priorityFn: e.edgesPriorityFn
|
|
3055
3055
|
}
|
|
3056
3056
|
};
|
|
3057
|
-
},
|
|
3058
|
-
var
|
|
3059
|
-
const e = ((
|
|
3060
|
-
}), t =
|
|
3061
|
-
}),
|
|
3057
|
+
}, Rt = (r) => {
|
|
3058
|
+
var w, y, x, A, S, C;
|
|
3059
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3060
|
+
}), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
|
|
3061
|
+
}), s = r.nodeDragVerifier ?? (() => !0), o = ((x = r.events) == null ? void 0 : x.onNodeDragFinished) ?? (() => {
|
|
3062
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (A = r.mouse) == null ? void 0 : A.dragCursor, d = h !== void 0 ? h : "grab", c = (S = r.mouse) == null ? void 0 : S.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (C = r.mouse) == null ? void 0 : C.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
|
|
3062
3063
|
return {
|
|
3063
|
-
moveOnTop:
|
|
3064
|
-
moveEdgesOnTop:
|
|
3065
|
-
dragCursor:
|
|
3064
|
+
moveOnTop: n,
|
|
3065
|
+
moveEdgesOnTop: a,
|
|
3066
|
+
dragCursor: d,
|
|
3066
3067
|
gridSize: r.gridSize ?? null,
|
|
3067
|
-
mouseDownEventVerifier:
|
|
3068
|
-
mouseUpEventVerifier:
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3068
|
+
mouseDownEventVerifier: g,
|
|
3069
|
+
mouseUpEventVerifier: u,
|
|
3070
|
+
onNodeDragStarted: e,
|
|
3071
|
+
onNodeDrag: t,
|
|
3072
|
+
nodeDragVerifier: s,
|
|
3073
|
+
onNodeDragFinished: o
|
|
3072
3074
|
};
|
|
3073
|
-
},
|
|
3074
|
-
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,
|
|
3075
|
+
}, Ft = (r) => {
|
|
3076
|
+
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, o = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3075
3077
|
return (n) => {
|
|
3076
3078
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3077
3079
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3078
3080
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3079
3081
|
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
|
|
3080
|
-
const g = n.canvasHeight * n.prevTransform.scale, l =
|
|
3082
|
+
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3081
3083
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3082
3084
|
};
|
|
3083
|
-
},
|
|
3084
|
-
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0,
|
|
3085
|
+
}, Vt = (r) => {
|
|
3086
|
+
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3085
3087
|
return (n) => {
|
|
3086
3088
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3087
3089
|
let d = h.scale, c = h.x, g = h.y;
|
|
3088
|
-
if (h.scale >
|
|
3089
|
-
d = Math.max(a.scale,
|
|
3090
|
+
if (h.scale > o && h.scale > a.scale) {
|
|
3091
|
+
d = Math.max(a.scale, o), c = a.x, g = a.y;
|
|
3090
3092
|
const l = (d - a.scale) / (h.scale - a.scale);
|
|
3091
3093
|
c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
|
|
3092
3094
|
}
|
|
@@ -3101,7 +3103,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3101
3103
|
y: g
|
|
3102
3104
|
};
|
|
3103
3105
|
};
|
|
3104
|
-
},
|
|
3106
|
+
}, It = (r) => (e) => r.reduce(
|
|
3105
3107
|
(t, s) => s({
|
|
3106
3108
|
prevTransform: e.prevTransform,
|
|
3107
3109
|
nextTransform: t,
|
|
@@ -3114,39 +3116,39 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3114
3116
|
return r;
|
|
3115
3117
|
switch (r.type) {
|
|
3116
3118
|
case "scale-limit":
|
|
3117
|
-
return
|
|
3119
|
+
return Vt({
|
|
3118
3120
|
minContentScale: r.minContentScale ?? 0,
|
|
3119
3121
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3120
3122
|
});
|
|
3121
3123
|
case "shift-limit":
|
|
3122
|
-
return
|
|
3124
|
+
return Ft({
|
|
3123
3125
|
minX: r.minX ?? -1 / 0,
|
|
3124
3126
|
maxX: r.maxX ?? 1 / 0,
|
|
3125
3127
|
minY: r.minY ?? -1 / 0,
|
|
3126
3128
|
maxY: r.maxY ?? 1 / 0
|
|
3127
3129
|
});
|
|
3128
3130
|
}
|
|
3129
|
-
},
|
|
3130
|
-
var
|
|
3131
|
-
const e = (
|
|
3132
|
-
let
|
|
3133
|
-
s !== void 0 ? Array.isArray(s) ?
|
|
3131
|
+
}, ye = (r) => {
|
|
3132
|
+
var y, x, A, S, C, P, N, V, ne, ae, he, de;
|
|
3133
|
+
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3134
|
+
let o;
|
|
3135
|
+
s !== void 0 ? Array.isArray(s) ? o = It(
|
|
3134
3136
|
s.map(
|
|
3135
3137
|
(M) => fe(M)
|
|
3136
3138
|
)
|
|
3137
|
-
) :
|
|
3138
|
-
const n = ((
|
|
3139
|
-
}), h = ((
|
|
3140
|
-
}), d = (
|
|
3139
|
+
) : o = fe(s) : o = (M) => M.nextTransform;
|
|
3140
|
+
const n = ((x = r == null ? void 0 : r.shift) == null ? void 0 : x.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onBeforeTransformChange) ?? (() => {
|
|
3141
|
+
}), h = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
|
|
3142
|
+
}), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (M) => M.button === 0, u = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3141
3143
|
return {
|
|
3142
3144
|
wheelSensitivity: t,
|
|
3143
|
-
onTransformStarted: ((
|
|
3145
|
+
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
3144
3146
|
}),
|
|
3145
3147
|
onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
|
|
3146
3148
|
}),
|
|
3147
3149
|
onBeforeTransformChange: a,
|
|
3148
3150
|
onTransformChange: h,
|
|
3149
|
-
transformPreprocessor:
|
|
3151
|
+
transformPreprocessor: o,
|
|
3150
3152
|
shiftCursor: n,
|
|
3151
3153
|
mouseDownEventVerifier: c,
|
|
3152
3154
|
mouseUpEventVerifier: l,
|
|
@@ -3157,32 +3159,32 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3157
3159
|
onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
|
|
3158
3160
|
})
|
|
3159
3161
|
};
|
|
3160
|
-
},
|
|
3162
|
+
}, $t = (r, e) => {
|
|
3161
3163
|
const t = document.createElementNS(
|
|
3162
3164
|
"http://www.w3.org/2000/svg",
|
|
3163
3165
|
"circle"
|
|
3164
3166
|
);
|
|
3165
3167
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3166
|
-
},
|
|
3168
|
+
}, Ut = (r) => r instanceof SVGElement ? r : $t(
|
|
3167
3169
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3168
3170
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3169
|
-
),
|
|
3170
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25,
|
|
3171
|
+
), Bt = (r) => {
|
|
3172
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Ut(r.renderer ?? {});
|
|
3171
3173
|
return {
|
|
3172
3174
|
tileWidth: t,
|
|
3173
3175
|
tileHeight: s,
|
|
3174
|
-
renderer:
|
|
3176
|
+
renderer: o,
|
|
3175
3177
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3176
3178
|
};
|
|
3177
|
-
},
|
|
3179
|
+
}, Ot = (r, e, t) => {
|
|
3178
3180
|
var c, g, l;
|
|
3179
|
-
const s = () => "direct",
|
|
3181
|
+
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3180
3182
|
}, h = () => {
|
|
3181
3183
|
}, d = () => {
|
|
3182
3184
|
};
|
|
3183
3185
|
return {
|
|
3184
3186
|
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
3185
|
-
connectionPreprocessor: r.connectionPreprocessor ??
|
|
3187
|
+
connectionPreprocessor: r.connectionPreprocessor ?? o,
|
|
3186
3188
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3187
3189
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3188
3190
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
@@ -3191,9 +3193,9 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3191
3193
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3192
3194
|
edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
|
|
3193
3195
|
};
|
|
3194
|
-
},
|
|
3196
|
+
}, Wt = (r, e) => {
|
|
3195
3197
|
var c, g, l;
|
|
3196
|
-
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey,
|
|
3198
|
+
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3197
3199
|
const w = e.getPortAdjacentEdgeIds(u);
|
|
3198
3200
|
return w.length > 0 ? w[w.length - 1] : null;
|
|
3199
3201
|
}, a = () => {
|
|
@@ -3203,17 +3205,17 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3203
3205
|
return {
|
|
3204
3206
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3205
3207
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3206
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
3208
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
|
|
3207
3209
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3208
3210
|
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
|
|
3209
3211
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3210
3212
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3211
3213
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3212
3214
|
};
|
|
3213
|
-
},
|
|
3215
|
+
}, kt = (r) => ({
|
|
3214
3216
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3215
3217
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3216
|
-
}),
|
|
3218
|
+
}), zt = (r) => {
|
|
3217
3219
|
var e, t;
|
|
3218
3220
|
return {
|
|
3219
3221
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3222,71 +3224,48 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3222
3224
|
})
|
|
3223
3225
|
};
|
|
3224
3226
|
};
|
|
3225
|
-
class
|
|
3227
|
+
class Ht extends Error {
|
|
3226
3228
|
constructor() {
|
|
3227
3229
|
super(...arguments);
|
|
3228
|
-
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
class kt {
|
|
3232
|
-
constructor(e, t) {
|
|
3233
|
-
this.coordinates = e, this.rand = t;
|
|
3234
|
-
}
|
|
3235
|
-
getVector(e, t) {
|
|
3236
|
-
const s = this.coordinates.get(e), i = this.coordinates.get(t), n = i.x - s.x, a = i.y - s.y, h = n * n + a * a;
|
|
3237
|
-
if (h === 0) {
|
|
3238
|
-
const l = this.rand() * 2 * Math.PI;
|
|
3239
|
-
return { ex: Math.cos(l), ey: Math.sin(l), d2: 1, d: 1 };
|
|
3240
|
-
}
|
|
3241
|
-
const d = Math.sqrt(h), c = n / d, g = a / d;
|
|
3242
|
-
return { ex: c, ey: g, d2: h, d };
|
|
3230
|
+
i(this, "name", "CanvasBuilderError");
|
|
3243
3231
|
}
|
|
3244
3232
|
}
|
|
3245
|
-
class
|
|
3233
|
+
class Ve {
|
|
3246
3234
|
constructor(e, t, s) {
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
this.graph = e, this.currentCoords = t, this.
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3235
|
+
i(this, "dt");
|
|
3236
|
+
i(this, "nodeMass");
|
|
3237
|
+
i(this, "edgeEquilibriumLength");
|
|
3238
|
+
i(this, "edgeStiffness");
|
|
3239
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3240
|
+
i(this, "distanceVectorGenerator");
|
|
3241
|
+
this.graph = e, this.currentCoords = t, this.dt = s.dtSec, this.nodeMass = s.nodeMass, this.edgeEquilibriumLength = s.edgeEquilibriumLength, this.edgeStiffness = s.edgeStiffness, this.distanceVectorGenerator = s.distanceVectorGenerator, this.nodeForcesApplicationStrategy = s.nodeForcesApplicationStrategy;
|
|
3242
|
+
}
|
|
3243
|
+
apply() {
|
|
3256
3244
|
let e = 0;
|
|
3257
|
-
const t = /* @__PURE__ */ new Map()
|
|
3258
|
-
|
|
3259
|
-
t.set(
|
|
3260
|
-
})
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
const h = s[a];
|
|
3267
|
-
for (let d = a + 1; d < n; d++) {
|
|
3268
|
-
const c = s[d], g = i.getVector(h, c);
|
|
3269
|
-
if (g.d > this.effectiveDistance)
|
|
3270
|
-
continue;
|
|
3271
|
-
const l = this.k / g.d2, u = l * g.ex, w = l * g.ey, m = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
|
|
3272
|
-
E.x -= m, E.y -= v, A.x += m, A.y += v;
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
return this.graph.getAllEdgeIds().forEach((a) => {
|
|
3276
|
-
const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), u = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * u, m = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
|
|
3277
|
-
v.x += w, v.y += m, E.x -= w, E.y -= m;
|
|
3278
|
-
}), this.currentCoords.forEach((a, h) => {
|
|
3279
|
-
const d = t.get(h), c = {
|
|
3280
|
-
x: d.x / this.nodeMass * this.dtSec,
|
|
3281
|
-
y: d.y / this.nodeMass * this.dtSec
|
|
3282
|
-
}, g = c.x * this.dtSec, l = c.y * this.dtSec;
|
|
3283
|
-
a.x += g, a.y += l, e = Math.max(e, Math.sqrt(g * g + l * l));
|
|
3245
|
+
const t = /* @__PURE__ */ new Map();
|
|
3246
|
+
return this.graph.getAllNodeIds().forEach((o) => {
|
|
3247
|
+
t.set(o, { x: 0, y: 0 });
|
|
3248
|
+
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
|
|
3249
|
+
const a = t.get(n), h = {
|
|
3250
|
+
x: a.x / this.nodeMass * this.dt,
|
|
3251
|
+
y: a.y / this.nodeMass * this.dt
|
|
3252
|
+
}, d = h.x * this.dt, c = h.y * this.dt;
|
|
3253
|
+
o.x += d, o.y += c, e = Math.max(e, Math.sqrt(d * d + c * c));
|
|
3284
3254
|
}), e;
|
|
3285
3255
|
}
|
|
3256
|
+
applyEdgeForces(e) {
|
|
3257
|
+
this.graph.getAllEdgeIds().forEach((t) => {
|
|
3258
|
+
const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3259
|
+
a,
|
|
3260
|
+
h
|
|
3261
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), y = e.get(n.nodeId);
|
|
3262
|
+
w.x += l, w.y += u, y.x -= l, y.y -= u;
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3286
3265
|
}
|
|
3287
3266
|
const Ie = (r, e, t) => {
|
|
3288
|
-
const s = /* @__PURE__ */ new Map(),
|
|
3289
|
-
return
|
|
3267
|
+
const s = /* @__PURE__ */ new Map(), o = r.getAllNodeIds(), n = Math.sqrt(o.length) * t;
|
|
3268
|
+
return o.forEach((a) => {
|
|
3290
3269
|
const h = r.getNode(a);
|
|
3291
3270
|
s.set(a, {
|
|
3292
3271
|
x: h.x ?? n * e(),
|
|
@@ -3294,9 +3273,430 @@ const Ie = (r, e, t) => {
|
|
|
3294
3273
|
});
|
|
3295
3274
|
}), s;
|
|
3296
3275
|
};
|
|
3297
|
-
class
|
|
3276
|
+
class $e {
|
|
3298
3277
|
constructor(e) {
|
|
3299
|
-
this
|
|
3278
|
+
i(this, "PI2", 2 * Math.PI);
|
|
3279
|
+
this.rand = e;
|
|
3280
|
+
}
|
|
3281
|
+
create(e, t) {
|
|
3282
|
+
const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
|
|
3283
|
+
if (n === 0) {
|
|
3284
|
+
const c = this.PI2 * this.rand();
|
|
3285
|
+
return {
|
|
3286
|
+
ex: Math.cos(c),
|
|
3287
|
+
ey: Math.sin(c),
|
|
3288
|
+
d: 0
|
|
3289
|
+
};
|
|
3290
|
+
}
|
|
3291
|
+
const a = Math.sqrt(n), h = s / a, d = o / a;
|
|
3292
|
+
return { ex: h, ey: d, d: a };
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
const Ue = (r) => {
|
|
3296
|
+
if (r.distance === 0)
|
|
3297
|
+
return r.maxForce;
|
|
3298
|
+
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3299
|
+
return Math.min(e, r.maxForce);
|
|
3300
|
+
};
|
|
3301
|
+
class Xt {
|
|
3302
|
+
constructor(e) {
|
|
3303
|
+
i(this, "effectiveDistance");
|
|
3304
|
+
i(this, "nodeCharge");
|
|
3305
|
+
i(this, "distanceVectorGenerator");
|
|
3306
|
+
i(this, "maxForce");
|
|
3307
|
+
this.effectiveDistance = e.effectiveDistance, this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
|
|
3308
|
+
}
|
|
3309
|
+
apply(e, t) {
|
|
3310
|
+
const s = Array.from(t.keys()), o = s.length;
|
|
3311
|
+
for (let n = 0; n < o; n++) {
|
|
3312
|
+
const a = s[n];
|
|
3313
|
+
for (let h = n + 1; h < o; h++) {
|
|
3314
|
+
const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
|
|
3315
|
+
c,
|
|
3316
|
+
g
|
|
3317
|
+
);
|
|
3318
|
+
if (l.d > this.effectiveDistance)
|
|
3319
|
+
continue;
|
|
3320
|
+
const u = Ue({
|
|
3321
|
+
coefficient: 1,
|
|
3322
|
+
sourceCharge: this.nodeCharge,
|
|
3323
|
+
targetCharge: this.nodeCharge,
|
|
3324
|
+
distance: l.d,
|
|
3325
|
+
maxForce: this.maxForce
|
|
3326
|
+
}), w = u * l.ex, y = u * l.ey, x = t.get(a), A = t.get(d);
|
|
3327
|
+
x.x -= w, x.y -= y, A.x += w, A.y += y;
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
const Yt = (r) => {
|
|
3333
|
+
if (r.size === 0)
|
|
3334
|
+
return {
|
|
3335
|
+
centerX: 0,
|
|
3336
|
+
centerY: 0,
|
|
3337
|
+
radius: 0
|
|
3338
|
+
};
|
|
3339
|
+
let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
|
|
3340
|
+
r.forEach((d) => {
|
|
3341
|
+
e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
|
|
3342
|
+
});
|
|
3343
|
+
const n = t - e, a = o - s, h = Math.max(n, a);
|
|
3344
|
+
return {
|
|
3345
|
+
centerX: (e + t) / 2,
|
|
3346
|
+
centerY: (s + o) / 2,
|
|
3347
|
+
radius: h / 2
|
|
3348
|
+
};
|
|
3349
|
+
};
|
|
3350
|
+
class Gt {
|
|
3351
|
+
constructor(e) {
|
|
3352
|
+
i(this, "root");
|
|
3353
|
+
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
3354
|
+
i(this, "coords");
|
|
3355
|
+
i(this, "areaRadiusThreshold");
|
|
3356
|
+
i(this, "nodeMass");
|
|
3357
|
+
i(this, "nodeCharge");
|
|
3358
|
+
i(this, "sortedParentNodes", []);
|
|
3359
|
+
this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
|
|
3360
|
+
nodeIds: new Set(e.coords.keys()),
|
|
3361
|
+
box: e.box,
|
|
3362
|
+
totalMass: 0,
|
|
3363
|
+
totalCharge: 0,
|
|
3364
|
+
chargeCenter: {
|
|
3365
|
+
x: 0,
|
|
3366
|
+
y: 0
|
|
3367
|
+
},
|
|
3368
|
+
parent: null,
|
|
3369
|
+
lb: null,
|
|
3370
|
+
lt: null,
|
|
3371
|
+
rb: null,
|
|
3372
|
+
rt: null
|
|
3373
|
+
};
|
|
3374
|
+
let t = [this.root];
|
|
3375
|
+
for (; t.length > 0; ) {
|
|
3376
|
+
const s = [];
|
|
3377
|
+
for (; t.length > 0; ) {
|
|
3378
|
+
const o = t.pop();
|
|
3379
|
+
this.processNode(o).forEach((a) => {
|
|
3380
|
+
s.push(a);
|
|
3381
|
+
});
|
|
3382
|
+
}
|
|
3383
|
+
t = s;
|
|
3384
|
+
}
|
|
3385
|
+
this.sortedParentNodes.reverse().forEach((s) => {
|
|
3386
|
+
let o = 0, n = 0, a = 0, h = 0;
|
|
3387
|
+
s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, o += s.lb.chargeCenter.x * s.lb.totalCharge, n += s.lb.chargeCenter.y * s.lb.totalCharge), s.lt !== null && (a += s.lt.totalMass, h += s.lt.totalCharge, o += s.lt.chargeCenter.x * s.lt.totalCharge, n += s.lt.chargeCenter.y * s.lt.totalCharge), s.rb !== null && (a += s.rb.totalMass, h += s.rb.totalCharge, o += s.rb.chargeCenter.x * s.rb.totalCharge, n += s.rb.chargeCenter.y * s.rb.totalCharge), s.rt !== null && (a += s.rt.totalMass, h += s.rt.totalCharge, o += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = o / h, s.chargeCenter.y = n / h;
|
|
3388
|
+
});
|
|
3389
|
+
}
|
|
3390
|
+
getRoot() {
|
|
3391
|
+
return this.root;
|
|
3392
|
+
}
|
|
3393
|
+
getLeaf(e) {
|
|
3394
|
+
return this.leaves.get(e);
|
|
3395
|
+
}
|
|
3396
|
+
processNode(e) {
|
|
3397
|
+
if (e.nodeIds.size < 2)
|
|
3398
|
+
return this.setLeaf(e), [];
|
|
3399
|
+
const { centerX: t, centerY: s, radius: o } = e.box;
|
|
3400
|
+
if (o < this.areaRadiusThreshold)
|
|
3401
|
+
return this.setLeaf(e), [];
|
|
3402
|
+
this.sortedParentNodes.push(e);
|
|
3403
|
+
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3404
|
+
e.nodeIds.forEach((u) => {
|
|
3405
|
+
const { x: w, y } = this.coords.get(u);
|
|
3406
|
+
w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3407
|
+
});
|
|
3408
|
+
const g = {
|
|
3409
|
+
parent: e,
|
|
3410
|
+
lb: null,
|
|
3411
|
+
lt: null,
|
|
3412
|
+
rb: null,
|
|
3413
|
+
rt: null
|
|
3414
|
+
}, l = [];
|
|
3415
|
+
if (n.size > 0) {
|
|
3416
|
+
const u = {
|
|
3417
|
+
nodeIds: n,
|
|
3418
|
+
totalMass: 0,
|
|
3419
|
+
totalCharge: 0,
|
|
3420
|
+
chargeCenter: {
|
|
3421
|
+
x: 0,
|
|
3422
|
+
y: 0
|
|
3423
|
+
},
|
|
3424
|
+
box: {
|
|
3425
|
+
centerX: t + c,
|
|
3426
|
+
centerY: s + c,
|
|
3427
|
+
radius: c
|
|
3428
|
+
},
|
|
3429
|
+
...g
|
|
3430
|
+
};
|
|
3431
|
+
e.rt = u, l.push(u);
|
|
3432
|
+
}
|
|
3433
|
+
if (a.size > 0) {
|
|
3434
|
+
const u = {
|
|
3435
|
+
nodeIds: a,
|
|
3436
|
+
totalMass: 0,
|
|
3437
|
+
totalCharge: 0,
|
|
3438
|
+
chargeCenter: {
|
|
3439
|
+
x: 0,
|
|
3440
|
+
y: 0
|
|
3441
|
+
},
|
|
3442
|
+
box: {
|
|
3443
|
+
centerX: t + c,
|
|
3444
|
+
centerY: s - c,
|
|
3445
|
+
radius: c
|
|
3446
|
+
},
|
|
3447
|
+
...g
|
|
3448
|
+
};
|
|
3449
|
+
e.rb = u, l.push(u);
|
|
3450
|
+
}
|
|
3451
|
+
if (h.size > 0) {
|
|
3452
|
+
const u = {
|
|
3453
|
+
nodeIds: h,
|
|
3454
|
+
totalMass: 0,
|
|
3455
|
+
totalCharge: 0,
|
|
3456
|
+
chargeCenter: {
|
|
3457
|
+
x: 0,
|
|
3458
|
+
y: 0
|
|
3459
|
+
},
|
|
3460
|
+
box: {
|
|
3461
|
+
centerX: t - c,
|
|
3462
|
+
centerY: s + c,
|
|
3463
|
+
radius: c
|
|
3464
|
+
},
|
|
3465
|
+
...g
|
|
3466
|
+
};
|
|
3467
|
+
e.lt = u, l.push(u);
|
|
3468
|
+
}
|
|
3469
|
+
if (d.size > 0) {
|
|
3470
|
+
const u = {
|
|
3471
|
+
nodeIds: d,
|
|
3472
|
+
totalMass: 0,
|
|
3473
|
+
totalCharge: 0,
|
|
3474
|
+
chargeCenter: {
|
|
3475
|
+
x: 0,
|
|
3476
|
+
y: 0
|
|
3477
|
+
},
|
|
3478
|
+
box: {
|
|
3479
|
+
centerX: t - c,
|
|
3480
|
+
centerY: s - c,
|
|
3481
|
+
radius: c
|
|
3482
|
+
},
|
|
3483
|
+
...g
|
|
3484
|
+
};
|
|
3485
|
+
e.lb = u, l.push(u);
|
|
3486
|
+
}
|
|
3487
|
+
return l;
|
|
3488
|
+
}
|
|
3489
|
+
setLeaf(e) {
|
|
3490
|
+
e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
|
|
3491
|
+
this.leaves.set(t, e);
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
calculateLeafChargeCenter(e) {
|
|
3495
|
+
if (e.size === 0)
|
|
3496
|
+
return {
|
|
3497
|
+
x: 0,
|
|
3498
|
+
y: 0
|
|
3499
|
+
};
|
|
3500
|
+
let t = 0, s = 0;
|
|
3501
|
+
return e.forEach((o) => {
|
|
3502
|
+
const n = this.coords.get(o);
|
|
3503
|
+
t += n.x, s += n.y;
|
|
3504
|
+
}), { x: t / e.size, y: s / e.size };
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
class jt {
|
|
3508
|
+
constructor(e) {
|
|
3509
|
+
i(this, "areaRadiusThreshold");
|
|
3510
|
+
i(this, "nodeMass");
|
|
3511
|
+
i(this, "nodeCharge");
|
|
3512
|
+
i(this, "theta");
|
|
3513
|
+
i(this, "distanceVectorGenerator");
|
|
3514
|
+
i(this, "nodeForceCoefficient");
|
|
3515
|
+
i(this, "maxForce");
|
|
3516
|
+
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
3517
|
+
}
|
|
3518
|
+
apply(e, t) {
|
|
3519
|
+
const s = Yt(e), o = new Gt({
|
|
3520
|
+
box: s,
|
|
3521
|
+
coords: e,
|
|
3522
|
+
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
3523
|
+
nodeMass: this.nodeMass,
|
|
3524
|
+
nodeCharge: this.nodeCharge
|
|
3525
|
+
});
|
|
3526
|
+
e.forEach((n, a) => {
|
|
3527
|
+
const h = this.calculateForceForNode(
|
|
3528
|
+
o.getLeaf(a),
|
|
3529
|
+
a,
|
|
3530
|
+
e
|
|
3531
|
+
), d = t.get(a);
|
|
3532
|
+
this.applyForce(d, h);
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
calculateForceForNode(e, t, s) {
|
|
3536
|
+
const o = s.get(t), n = { x: 0, y: 0 };
|
|
3537
|
+
e.nodeIds.forEach((h) => {
|
|
3538
|
+
if (h !== t) {
|
|
3539
|
+
const d = s.get(h), c = this.calculateNodeRepulsiveForce({
|
|
3540
|
+
sourceCharge: this.nodeCharge,
|
|
3541
|
+
targetCharge: this.nodeCharge,
|
|
3542
|
+
sourceCoords: d,
|
|
3543
|
+
targetCoords: o
|
|
3544
|
+
});
|
|
3545
|
+
this.applyForce(n, c);
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
let a = e;
|
|
3549
|
+
for (; a !== null; ) {
|
|
3550
|
+
const h = a.parent;
|
|
3551
|
+
if (h !== null) {
|
|
3552
|
+
const d = this.distanceVectorGenerator.create(
|
|
3553
|
+
h.chargeCenter,
|
|
3554
|
+
o
|
|
3555
|
+
);
|
|
3556
|
+
h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
|
|
3557
|
+
totalForce: n,
|
|
3558
|
+
targetCoords: o,
|
|
3559
|
+
target: h.lb,
|
|
3560
|
+
current: a
|
|
3561
|
+
}), this.tryApplyFarForce({
|
|
3562
|
+
totalForce: n,
|
|
3563
|
+
targetCoords: o,
|
|
3564
|
+
target: h.rb,
|
|
3565
|
+
current: a
|
|
3566
|
+
}), this.tryApplyFarForce({
|
|
3567
|
+
totalForce: n,
|
|
3568
|
+
targetCoords: o,
|
|
3569
|
+
target: h.rt,
|
|
3570
|
+
current: a
|
|
3571
|
+
}), this.tryApplyFarForce({
|
|
3572
|
+
totalForce: n,
|
|
3573
|
+
targetCoords: o,
|
|
3574
|
+
target: h.lt,
|
|
3575
|
+
current: a
|
|
3576
|
+
})) : (this.tryApplyNearForce({
|
|
3577
|
+
totalForce: n,
|
|
3578
|
+
targetCoords: o,
|
|
3579
|
+
target: h.lb,
|
|
3580
|
+
current: a,
|
|
3581
|
+
nodesCoords: s
|
|
3582
|
+
}), this.tryApplyNearForce({
|
|
3583
|
+
totalForce: n,
|
|
3584
|
+
targetCoords: o,
|
|
3585
|
+
target: h.rb,
|
|
3586
|
+
current: a,
|
|
3587
|
+
nodesCoords: s
|
|
3588
|
+
}), this.tryApplyNearForce({
|
|
3589
|
+
totalForce: n,
|
|
3590
|
+
targetCoords: o,
|
|
3591
|
+
target: h.rt,
|
|
3592
|
+
current: a,
|
|
3593
|
+
nodesCoords: s
|
|
3594
|
+
}), this.tryApplyNearForce({
|
|
3595
|
+
totalForce: n,
|
|
3596
|
+
targetCoords: o,
|
|
3597
|
+
target: h.lt,
|
|
3598
|
+
current: a,
|
|
3599
|
+
nodesCoords: s
|
|
3600
|
+
}));
|
|
3601
|
+
}
|
|
3602
|
+
a = a.parent;
|
|
3603
|
+
}
|
|
3604
|
+
return n;
|
|
3605
|
+
}
|
|
3606
|
+
calculateExactForce(e, t, s) {
|
|
3607
|
+
const o = { x: 0, y: 0 }, n = [e];
|
|
3608
|
+
for (; n.length > 0; ) {
|
|
3609
|
+
const a = n.pop();
|
|
3610
|
+
a.nodeIds.forEach((h) => {
|
|
3611
|
+
const d = s.get(h), c = this.calculateNodeRepulsiveForce({
|
|
3612
|
+
sourceCharge: this.nodeCharge,
|
|
3613
|
+
targetCharge: this.nodeCharge,
|
|
3614
|
+
sourceCoords: d,
|
|
3615
|
+
targetCoords: t
|
|
3616
|
+
});
|
|
3617
|
+
this.applyForce(o, c);
|
|
3618
|
+
}), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
|
|
3619
|
+
}
|
|
3620
|
+
return o;
|
|
3621
|
+
}
|
|
3622
|
+
calculateApproximateForce(e, t) {
|
|
3623
|
+
return this.calculateNodeRepulsiveForce({
|
|
3624
|
+
sourceCharge: this.nodeCharge,
|
|
3625
|
+
targetCharge: e.totalCharge,
|
|
3626
|
+
sourceCoords: e.chargeCenter,
|
|
3627
|
+
targetCoords: t
|
|
3628
|
+
});
|
|
3629
|
+
}
|
|
3630
|
+
calculateNodeRepulsiveForce(e) {
|
|
3631
|
+
const t = this.distanceVectorGenerator.create(
|
|
3632
|
+
e.sourceCoords,
|
|
3633
|
+
e.targetCoords
|
|
3634
|
+
), s = Ue({
|
|
3635
|
+
coefficient: this.nodeForceCoefficient,
|
|
3636
|
+
sourceCharge: e.sourceCharge,
|
|
3637
|
+
targetCharge: e.targetCharge,
|
|
3638
|
+
distance: t.d,
|
|
3639
|
+
maxForce: this.maxForce
|
|
3640
|
+
});
|
|
3641
|
+
return {
|
|
3642
|
+
x: s * t.ex,
|
|
3643
|
+
y: s * t.ey
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3646
|
+
applyForce(e, t) {
|
|
3647
|
+
e.x += t.x, e.y += t.y;
|
|
3648
|
+
}
|
|
3649
|
+
tryApplyFarForce(e) {
|
|
3650
|
+
if (e.target !== null && e.target !== e.current) {
|
|
3651
|
+
const t = this.calculateApproximateForce(
|
|
3652
|
+
e.target,
|
|
3653
|
+
e.targetCoords
|
|
3654
|
+
);
|
|
3655
|
+
this.applyForce(e.totalForce, t);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
tryApplyNearForce(e) {
|
|
3659
|
+
if (e.target !== null && e.target !== e.current) {
|
|
3660
|
+
const t = this.calculateExactForce(
|
|
3661
|
+
e.target,
|
|
3662
|
+
e.targetCoords,
|
|
3663
|
+
e.nodesCoords
|
|
3664
|
+
);
|
|
3665
|
+
this.applyForce(e.totalForce, t);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
const Be = (r) => r.theta !== 0 ? new jt({
|
|
3670
|
+
nodeCharge: r.nodeCharge,
|
|
3671
|
+
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3672
|
+
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3673
|
+
maxForce: r.maxForce,
|
|
3674
|
+
theta: r.theta,
|
|
3675
|
+
nodeMass: r.nodeMass,
|
|
3676
|
+
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3677
|
+
}) : new Xt({
|
|
3678
|
+
nodeCharge: r.nodeCharge,
|
|
3679
|
+
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3680
|
+
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3681
|
+
effectiveDistance: r.effectiveDistance,
|
|
3682
|
+
maxForce: r.maxForce
|
|
3683
|
+
});
|
|
3684
|
+
class Kt {
|
|
3685
|
+
constructor(e) {
|
|
3686
|
+
i(this, "distanceVectorGenerator");
|
|
3687
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3688
|
+
this.params = e, this.distanceVectorGenerator = new $e(
|
|
3689
|
+
this.params.rand
|
|
3690
|
+
), this.nodeForcesApplicationStrategy = Be({
|
|
3691
|
+
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3692
|
+
nodeCharge: this.params.nodeCharge,
|
|
3693
|
+
effectiveDistance: this.params.effectiveDistance,
|
|
3694
|
+
maxForce: this.params.maxForce,
|
|
3695
|
+
nodeForceCoefficient: this.params.nodeForceCoefficient,
|
|
3696
|
+
theta: this.params.barnesHutTheta,
|
|
3697
|
+
areaRadiusThreshold: this.params.barnesHutAreaRadiusThreshold,
|
|
3698
|
+
nodeMass: this.params.nodeMass
|
|
3699
|
+
});
|
|
3300
3700
|
}
|
|
3301
3701
|
calculateCoordinates(e) {
|
|
3302
3702
|
const t = Ie(
|
|
@@ -3304,22 +3704,36 @@ class zt {
|
|
|
3304
3704
|
this.params.rand,
|
|
3305
3705
|
this.params.edgeEquilibriumLength
|
|
3306
3706
|
);
|
|
3307
|
-
for (let s = 0; s < this.params.maxIterations && !(new
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3707
|
+
for (let s = 0; s < this.params.maxIterations && !(new Ve(
|
|
3708
|
+
e,
|
|
3709
|
+
t,
|
|
3710
|
+
{
|
|
3711
|
+
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3712
|
+
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
3713
|
+
dtSec: this.params.dtSec,
|
|
3714
|
+
nodeMass: this.params.nodeMass,
|
|
3715
|
+
edgeEquilibriumLength: this.params.edgeEquilibriumLength,
|
|
3716
|
+
edgeStiffness: this.params.edgeStiffness
|
|
3717
|
+
}
|
|
3718
|
+
).apply() < this.params.convergenceDelta); s++)
|
|
3316
3719
|
;
|
|
3317
3720
|
return t;
|
|
3318
3721
|
}
|
|
3319
3722
|
}
|
|
3320
|
-
class
|
|
3723
|
+
class Qt {
|
|
3321
3724
|
constructor(e) {
|
|
3322
|
-
this
|
|
3725
|
+
i(this, "distanceVectorGenerator");
|
|
3726
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3727
|
+
this.params = e, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Be({
|
|
3728
|
+
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3729
|
+
nodeCharge: this.params.nodeCharge,
|
|
3730
|
+
effectiveDistance: this.params.effectiveDistance,
|
|
3731
|
+
maxForce: this.params.maxForce,
|
|
3732
|
+
nodeForceCoefficient: this.params.nodeForceCoefficient,
|
|
3733
|
+
theta: this.params.barnesHutTheta,
|
|
3734
|
+
areaRadiusThreshold: this.params.barnesHutAreaRadiusThreshold,
|
|
3735
|
+
nodeMass: this.params.nodeMass
|
|
3736
|
+
});
|
|
3323
3737
|
}
|
|
3324
3738
|
calculateNextCoordinates(e, t) {
|
|
3325
3739
|
const s = Ie(
|
|
@@ -3327,126 +3741,144 @@ class Xt {
|
|
|
3327
3741
|
this.params.rand,
|
|
3328
3742
|
this.params.edgeEquilibriumLength
|
|
3329
3743
|
);
|
|
3330
|
-
return new
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3744
|
+
return new Ve(
|
|
3745
|
+
e,
|
|
3746
|
+
s,
|
|
3747
|
+
{
|
|
3748
|
+
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3749
|
+
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
3750
|
+
dtSec: Math.min(t, this.params.maxTimeDeltaSec),
|
|
3751
|
+
nodeMass: this.params.nodeMass,
|
|
3752
|
+
edgeEquilibriumLength: this.params.edgeEquilibriumLength,
|
|
3753
|
+
edgeStiffness: this.params.edgeStiffness
|
|
3754
|
+
}
|
|
3755
|
+
).apply() < this.params.convergenceDelta && !e.getAllNodeIds().some((h) => {
|
|
3339
3756
|
const d = e.getNode(h);
|
|
3340
3757
|
return d.x === null || d.y === null;
|
|
3341
3758
|
}) ? /* @__PURE__ */ new Map() : s;
|
|
3342
3759
|
}
|
|
3343
3760
|
}
|
|
3344
|
-
const
|
|
3345
|
-
let e = 1779033703, t = 3144134277, s = 1013904242,
|
|
3761
|
+
const Oe = (r) => {
|
|
3762
|
+
let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
|
|
3346
3763
|
for (let n = 0, a; n < r.length; n++)
|
|
3347
|
-
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s =
|
|
3348
|
-
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(
|
|
3349
|
-
},
|
|
3764
|
+
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = o ^ Math.imul(s ^ a, 951274213), o = e ^ Math.imul(o ^ a, 2716044179);
|
|
3765
|
+
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(o ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), o = Math.imul(t ^ o >>> 19, 2716044179), e ^= t ^ s ^ o, t ^= e, s ^= e, o ^= e, [e >>> 0, t >>> 0, s >>> 0, o >>> 0];
|
|
3766
|
+
}, We = (r, e, t, s) => function() {
|
|
3350
3767
|
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
3351
|
-
const
|
|
3352
|
-
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t +
|
|
3353
|
-
},
|
|
3768
|
+
const o = (r + e | 0) + s | 0;
|
|
3769
|
+
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + o | 0, (o >>> 0) / 4294967296;
|
|
3770
|
+
}, v = Object.freeze({
|
|
3354
3771
|
seed: "HTMLGraph is awesome",
|
|
3355
|
-
maxTimeDeltaSec: 0.
|
|
3772
|
+
maxTimeDeltaSec: 0.01,
|
|
3356
3773
|
nodeCharge: 1e5,
|
|
3357
3774
|
nodeMass: 1,
|
|
3358
3775
|
edgeEquilibriumLength: 300,
|
|
3359
3776
|
edgeStiffness: 1e3,
|
|
3360
3777
|
effectiveDistance: 1e3,
|
|
3361
|
-
dtSec: 0.
|
|
3362
|
-
maxIterations:
|
|
3363
|
-
convergenceDelta:
|
|
3364
|
-
|
|
3365
|
-
|
|
3778
|
+
dtSec: 0.01,
|
|
3779
|
+
maxIterations: 1e3,
|
|
3780
|
+
convergenceDelta: 1,
|
|
3781
|
+
maxForce: 1e7,
|
|
3782
|
+
nodeForceCoefficient: 1,
|
|
3783
|
+
barnesHutAreaRadiusThreshold: 0.01,
|
|
3784
|
+
barnesHutTheta: 1
|
|
3785
|
+
}), Zt = (r) => {
|
|
3786
|
+
var e, t, s;
|
|
3366
3787
|
switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
|
|
3367
3788
|
case "custom":
|
|
3368
3789
|
return r.algorithm.instance;
|
|
3369
3790
|
default: {
|
|
3370
|
-
const
|
|
3371
|
-
return new
|
|
3372
|
-
rand:
|
|
3373
|
-
maxTimeDeltaSec: (
|
|
3374
|
-
nodeCharge: (
|
|
3375
|
-
nodeMass: (
|
|
3376
|
-
edgeEquilibriumLength: (
|
|
3377
|
-
effectiveDistance:
|
|
3378
|
-
edgeStiffness: (
|
|
3379
|
-
convergenceDelta: (
|
|
3791
|
+
const o = r == null ? void 0 : r.algorithm, n = Oe((o == null ? void 0 : o.seed) ?? v.seed), a = We(n[0], n[1], n[2], n[3]);
|
|
3792
|
+
return new Qt({
|
|
3793
|
+
rand: a,
|
|
3794
|
+
maxTimeDeltaSec: (o == null ? void 0 : o.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
|
|
3795
|
+
nodeCharge: (o == null ? void 0 : o.nodeCharge) ?? v.nodeCharge,
|
|
3796
|
+
nodeMass: (o == null ? void 0 : o.nodeMass) ?? v.nodeMass,
|
|
3797
|
+
edgeEquilibriumLength: (o == null ? void 0 : o.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
|
|
3798
|
+
effectiveDistance: v.effectiveDistance,
|
|
3799
|
+
edgeStiffness: (o == null ? void 0 : o.edgeStiffness) ?? v.edgeStiffness,
|
|
3800
|
+
convergenceDelta: (o == null ? void 0 : o.convergenceDelta) ?? v.convergenceDelta,
|
|
3801
|
+
maxForce: (o == null ? void 0 : o.maxForce) ?? v.maxForce,
|
|
3802
|
+
nodeForceCoefficient: (o == null ? void 0 : o.nodeForceCoefficient) ?? v.nodeForceCoefficient,
|
|
3803
|
+
barnesHutTheta: ((t = o == null ? void 0 : o.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
|
|
3804
|
+
barnesHutAreaRadiusThreshold: ((s = o == null ? void 0 : o.barnesHut) == null ? void 0 : s.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
|
|
3380
3805
|
});
|
|
3381
3806
|
}
|
|
3382
3807
|
}
|
|
3383
|
-
},
|
|
3808
|
+
}, Jt = (r) => r instanceof j ? {
|
|
3384
3809
|
type: "manual",
|
|
3385
3810
|
trigger: r
|
|
3386
3811
|
} : {
|
|
3387
3812
|
type: "topologyChangeTimeout"
|
|
3388
|
-
},
|
|
3813
|
+
}, qt = (r) => {
|
|
3814
|
+
var e, t;
|
|
3389
3815
|
switch (r == null ? void 0 : r.type) {
|
|
3390
3816
|
case "custom":
|
|
3391
3817
|
return r.instance;
|
|
3392
3818
|
default: {
|
|
3393
|
-
const
|
|
3394
|
-
return new
|
|
3395
|
-
dtSec: (r == null ? void 0 : r.dtSec) ??
|
|
3396
|
-
maxIterations: (r == null ? void 0 : r.maxIterations) ??
|
|
3397
|
-
rand:
|
|
3398
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
3399
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
3400
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
3401
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
3402
|
-
effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ??
|
|
3403
|
-
convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ??
|
|
3819
|
+
const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), o = We(s[0], s[1], s[2], s[3]);
|
|
3820
|
+
return new Kt({
|
|
3821
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
|
|
3822
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
|
|
3823
|
+
rand: o,
|
|
3824
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
|
|
3825
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
|
|
3826
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
|
|
3827
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
|
|
3828
|
+
effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? v.effectiveDistance,
|
|
3829
|
+
convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? v.convergenceDelta,
|
|
3830
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
|
|
3831
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
|
|
3832
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
|
|
3833
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
|
|
3404
3834
|
});
|
|
3405
3835
|
}
|
|
3406
3836
|
}
|
|
3407
|
-
},
|
|
3408
|
-
algorithm:
|
|
3409
|
-
applyOn:
|
|
3410
|
-
}),
|
|
3837
|
+
}, _t = (r) => ({
|
|
3838
|
+
algorithm: qt(r == null ? void 0 : r.algorithm),
|
|
3839
|
+
applyOn: Jt(r == null ? void 0 : r.applyOn)
|
|
3840
|
+
}), er = (r, e) => ({
|
|
3411
3841
|
...r,
|
|
3412
|
-
|
|
3842
|
+
onNodeDragStarted: (t) => {
|
|
3843
|
+
e.add(t), r.onNodeDragStarted(t);
|
|
3844
|
+
},
|
|
3413
3845
|
onNodeDragFinished: (t) => {
|
|
3414
3846
|
e.delete(t), r.onNodeDragFinished(t);
|
|
3415
3847
|
}
|
|
3416
|
-
}),
|
|
3848
|
+
}), tr = (r, e) => {
|
|
3417
3849
|
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
3418
3850
|
e.delete(t);
|
|
3419
3851
|
}), r.onBeforeClear.subscribe(() => {
|
|
3420
3852
|
e.clear();
|
|
3421
3853
|
});
|
|
3422
3854
|
};
|
|
3423
|
-
class
|
|
3855
|
+
class or {
|
|
3424
3856
|
constructor(e) {
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3857
|
+
i(this, "used", !1);
|
|
3858
|
+
i(this, "canvasDefaults", {});
|
|
3859
|
+
i(this, "dragConfig", {});
|
|
3860
|
+
i(this, "transformConfig", {});
|
|
3861
|
+
i(this, "backgroundConfig", {});
|
|
3862
|
+
i(this, "connectablePortsConfig", {});
|
|
3863
|
+
i(this, "draggableEdgesConfig", {});
|
|
3864
|
+
i(this, "virtualScrollConfig");
|
|
3865
|
+
i(this, "layoutConfig", {});
|
|
3866
|
+
i(this, "animatedLayoutConfig", {});
|
|
3867
|
+
i(this, "hasDraggableNodes", !1);
|
|
3868
|
+
i(this, "hasTransformableViewport", !1);
|
|
3869
|
+
i(this, "hasNodeResizeReactiveEdges", !1);
|
|
3870
|
+
i(this, "hasBackground", !1);
|
|
3871
|
+
i(this, "hasUserConnectablePorts", !1);
|
|
3872
|
+
i(this, "hasUserDraggableEdges", !1);
|
|
3873
|
+
i(this, "hasAnimatedLayout", !1);
|
|
3874
|
+
i(this, "hasLayout", !1);
|
|
3875
|
+
i(this, "boxRenderingTrigger", new j());
|
|
3876
|
+
i(this, "graphStore", new xe());
|
|
3877
|
+
i(this, "viewportStore", new Ze());
|
|
3878
|
+
i(this, "graph", new Le(this.graphStore));
|
|
3879
|
+
i(this, "viewport", new Re(this.viewportStore));
|
|
3880
|
+
i(this, "window", window);
|
|
3881
|
+
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
3450
3882
|
this.element = e;
|
|
3451
3883
|
}
|
|
3452
3884
|
/**
|
|
@@ -3515,21 +3947,21 @@ class qt {
|
|
|
3515
3947
|
*/
|
|
3516
3948
|
build() {
|
|
3517
3949
|
if (this.used)
|
|
3518
|
-
throw new
|
|
3950
|
+
throw new Ht("CanvasBuilder is a single use object");
|
|
3519
3951
|
this.used = !0;
|
|
3520
|
-
const e = new
|
|
3521
|
-
let t = new
|
|
3952
|
+
const e = new Dt(this.element);
|
|
3953
|
+
let t = new me(
|
|
3522
3954
|
this.graphStore,
|
|
3523
3955
|
this.viewportStore,
|
|
3524
3956
|
e.main
|
|
3525
3957
|
);
|
|
3526
|
-
this.virtualScrollConfig !== void 0 && (t = new
|
|
3958
|
+
this.virtualScrollConfig !== void 0 && (t = new je(
|
|
3527
3959
|
t,
|
|
3528
3960
|
this.graphStore,
|
|
3529
3961
|
this.boxRenderingTrigger,
|
|
3530
|
-
|
|
3531
|
-
)), t = new
|
|
3532
|
-
const s =
|
|
3962
|
+
zt(this.virtualScrollConfig)
|
|
3963
|
+
)), t = new Ke(t, this.graphStore);
|
|
3964
|
+
const s = Lt(this.canvasDefaults), o = new ve(
|
|
3533
3965
|
this.graph,
|
|
3534
3966
|
this.viewport,
|
|
3535
3967
|
this.graphStore,
|
|
@@ -3538,29 +3970,29 @@ class qt {
|
|
|
3538
3970
|
s
|
|
3539
3971
|
);
|
|
3540
3972
|
if (this.hasBackground && _.configure(
|
|
3541
|
-
|
|
3542
|
-
|
|
3973
|
+
o,
|
|
3974
|
+
Bt(this.backgroundConfig),
|
|
3543
3975
|
e.background
|
|
3544
|
-
), this.hasNodeResizeReactiveEdges && K.configure(
|
|
3545
|
-
let a =
|
|
3546
|
-
this.hasAnimatedLayout && (a =
|
|
3976
|
+
), this.hasNodeResizeReactiveEdges && K.configure(o), this.hasDraggableNodes) {
|
|
3977
|
+
let a = Rt(this.dragConfig);
|
|
3978
|
+
this.hasAnimatedLayout && (a = er(
|
|
3547
3979
|
a,
|
|
3548
3980
|
this.animationStaticNodes
|
|
3549
|
-
)),
|
|
3550
|
-
|
|
3981
|
+
)), J.configure(
|
|
3982
|
+
o,
|
|
3551
3983
|
e.main,
|
|
3552
3984
|
this.window,
|
|
3553
3985
|
a
|
|
3554
3986
|
);
|
|
3555
3987
|
}
|
|
3556
3988
|
if (this.hasUserConnectablePorts) {
|
|
3557
|
-
const a =
|
|
3989
|
+
const a = Ot(
|
|
3558
3990
|
this.connectablePortsConfig,
|
|
3559
3991
|
s.edges.shapeFactory,
|
|
3560
3992
|
s.ports.direction
|
|
3561
3993
|
);
|
|
3562
3994
|
ee.configure(
|
|
3563
|
-
|
|
3995
|
+
o,
|
|
3564
3996
|
e.overlayConnectablePorts,
|
|
3565
3997
|
this.viewportStore,
|
|
3566
3998
|
this.window,
|
|
@@ -3568,12 +4000,12 @@ class qt {
|
|
|
3568
4000
|
);
|
|
3569
4001
|
}
|
|
3570
4002
|
if (this.hasUserDraggableEdges) {
|
|
3571
|
-
const a =
|
|
4003
|
+
const a = Wt(
|
|
3572
4004
|
this.draggableEdgesConfig,
|
|
3573
|
-
|
|
4005
|
+
o.graph
|
|
3574
4006
|
);
|
|
3575
4007
|
te.configure(
|
|
3576
|
-
|
|
4008
|
+
o,
|
|
3577
4009
|
e.overlayDraggableEdges,
|
|
3578
4010
|
this.viewportStore,
|
|
3579
4011
|
this.window,
|
|
@@ -3581,46 +4013,47 @@ class qt {
|
|
|
3581
4013
|
);
|
|
3582
4014
|
}
|
|
3583
4015
|
this.virtualScrollConfig !== void 0 ? q.configure(
|
|
3584
|
-
|
|
4016
|
+
o,
|
|
3585
4017
|
e.main,
|
|
3586
4018
|
this.window,
|
|
3587
|
-
|
|
4019
|
+
ye(this.transformConfig),
|
|
3588
4020
|
this.boxRenderingTrigger,
|
|
3589
|
-
|
|
3590
|
-
) : this.hasTransformableViewport &&
|
|
3591
|
-
|
|
4021
|
+
kt(this.virtualScrollConfig)
|
|
4022
|
+
) : this.hasTransformableViewport && H.configure(
|
|
4023
|
+
o,
|
|
3592
4024
|
e.main,
|
|
3593
4025
|
this.window,
|
|
3594
|
-
|
|
3595
|
-
), this.hasLayout &&
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
), this.hasAnimatedLayout && (
|
|
3599
|
-
|
|
4026
|
+
ye(this.transformConfig)
|
|
4027
|
+
), this.hasLayout && Pt.configure(
|
|
4028
|
+
o,
|
|
4029
|
+
_t(this.layoutConfig)
|
|
4030
|
+
), this.hasAnimatedLayout && (tr(
|
|
4031
|
+
o.graph,
|
|
3600
4032
|
this.animationStaticNodes
|
|
3601
4033
|
), oe.configure(
|
|
3602
|
-
|
|
3603
|
-
|
|
4034
|
+
o,
|
|
4035
|
+
Zt(this.animatedLayoutConfig),
|
|
3604
4036
|
this.animationStaticNodes,
|
|
3605
4037
|
this.window
|
|
3606
4038
|
));
|
|
3607
4039
|
const n = () => {
|
|
3608
|
-
e.destroy(),
|
|
4040
|
+
e.destroy(), o.onBeforeDestroy.unsubscribe(n);
|
|
3609
4041
|
};
|
|
3610
|
-
return
|
|
4042
|
+
return o.onBeforeDestroy.subscribe(n), o;
|
|
3611
4043
|
}
|
|
3612
4044
|
}
|
|
3613
4045
|
export {
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
4046
|
+
ut as BezierEdgeShape,
|
|
4047
|
+
or as CanvasBuilder,
|
|
4048
|
+
Ht as CanvasBuilderError,
|
|
4049
|
+
b as CanvasError,
|
|
4050
|
+
R as ConnectionCategory,
|
|
4051
|
+
Ne as DirectEdgeShape,
|
|
4052
|
+
j as EventSubject,
|
|
4053
|
+
pt as HorizontalEdgeShape,
|
|
4054
|
+
vt as InteractiveEdgeError,
|
|
4055
|
+
Me as InteractiveEdgeShape,
|
|
4056
|
+
sr as MidpointEdgeShape,
|
|
4057
|
+
wt as StraightEdgeShape,
|
|
4058
|
+
ft as VerticalEdgeShape
|
|
3626
4059
|
};
|