@html-graph/html-graph 8.11.0 → 8.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/dist/html-graph.d.ts +25 -7
- package/dist/html-graph.js +1355 -1086
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var Ze = Object.defineProperty;
|
|
2
|
+
var _e = (r, e, t) => e in r ? Ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => _e(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var V = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(V || {});
|
|
5
|
+
const qe = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
8
|
-
},
|
|
8
|
+
}, et = () => {
|
|
9
9
|
const r = document.createElement("div");
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
|
-
},
|
|
11
|
+
}, tt = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
-
},
|
|
13
|
+
}, rt = (r) => {
|
|
14
14
|
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class be {
|
|
17
17
|
constructor(e, t, o) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", qe());
|
|
19
|
+
i(this, "container", et());
|
|
20
20
|
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
22
22
|
i(this, "applyTransform", () => {
|
|
@@ -27,11 +27,11 @@ class Ee {
|
|
|
27
27
|
}
|
|
28
28
|
attachNode(e) {
|
|
29
29
|
const t = this.graphStore.getNode(e);
|
|
30
|
-
|
|
30
|
+
tt(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
31
31
|
}
|
|
32
32
|
detachNode(e) {
|
|
33
33
|
const t = this.graphStore.getNode(e);
|
|
34
|
-
|
|
34
|
+
rt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
35
35
|
}
|
|
36
36
|
attachEdge(e) {
|
|
37
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -52,7 +52,7 @@ class Ee {
|
|
|
52
52
|
this.clear(), this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
53
53
|
}
|
|
54
54
|
updateNodePosition(e) {
|
|
55
|
-
const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(),
|
|
55
|
+
const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, s), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
56
56
|
t.element.style.transform = `translate(${d}px, ${c}px)`;
|
|
57
57
|
}
|
|
58
58
|
updateNodePriority(e) {
|
|
@@ -66,34 +66,34 @@ class Ee {
|
|
|
66
66
|
this.edgeIdToElementMap.set(e, s), this.container.appendChild(s);
|
|
67
67
|
}
|
|
68
68
|
renderEdge(e) {
|
|
69
|
-
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to),
|
|
69
|
+
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), n = o.element.getBoundingClientRect(), a = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
|
|
70
70
|
o,
|
|
71
|
-
|
|
71
|
+
n,
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
|
-
),
|
|
75
|
-
let
|
|
76
|
-
o.element === s.element ?
|
|
74
|
+
), u = this.createEdgeRenderPort(s, a, h, d);
|
|
75
|
+
let g = V.Line;
|
|
76
|
+
o.element === s.element ? g = V.PortCycle : o.nodeId === s.nodeId && (g = V.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
80
80
|
t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
|
|
81
81
|
}
|
|
82
82
|
createEdgeRenderPort(e, t, o, s) {
|
|
83
|
-
const
|
|
83
|
+
const n = this.viewportStore.createContentCoords({
|
|
84
84
|
x: t.left - o.left,
|
|
85
85
|
y: t.top - o.top
|
|
86
86
|
});
|
|
87
87
|
return {
|
|
88
|
-
x:
|
|
89
|
-
y:
|
|
88
|
+
x: n.x,
|
|
89
|
+
y: n.y,
|
|
90
90
|
width: t.width * s,
|
|
91
91
|
height: t.height * s,
|
|
92
92
|
direction: e.payload.direction
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class ot {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -109,35 +109,35 @@ class et {
|
|
|
109
109
|
return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
|
|
110
110
|
}
|
|
111
111
|
hasEdge(e) {
|
|
112
|
-
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId,
|
|
113
|
-
return h <= this.xTo && d >= this.xFrom && c <= this.yTo &&
|
|
112
|
+
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), u = Math.max(n.y, a.y);
|
|
113
|
+
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class st {
|
|
117
117
|
constructor(e, t, o, s) {
|
|
118
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
119
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
120
120
|
i(this, "renderingBox");
|
|
121
121
|
i(this, "updateViewport", (e) => {
|
|
122
122
|
this.renderingBox.setRenderingBox(e);
|
|
123
|
-
const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(),
|
|
124
|
-
this.graphStore.getAllNodeIds().forEach((
|
|
125
|
-
const h = this.renderingBox.hasNode(
|
|
126
|
-
h && !d ? t.add(
|
|
127
|
-
}), this.graphStore.getAllEdgeIds().forEach((
|
|
128
|
-
const h = this.renderingBox.hasEdge(
|
|
129
|
-
h && (this.renderingBox.hasNode(
|
|
130
|
-
}),
|
|
131
|
-
this.handleDetachEdge(
|
|
132
|
-
}), o.forEach((
|
|
133
|
-
this.handleDetachNode(
|
|
134
|
-
}), t.forEach((
|
|
135
|
-
this.attachedNodes.has(
|
|
136
|
-
}), s.forEach((
|
|
137
|
-
this.handleAttachEdge(
|
|
123
|
+
const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
124
|
+
this.graphStore.getAllNodeIds().forEach((a) => {
|
|
125
|
+
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
126
|
+
h && !d ? t.add(a) : !h && d && o.add(a);
|
|
127
|
+
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
128
|
+
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), u = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
|
|
129
|
+
h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? s.add(a) : !h && d && n.add(a);
|
|
130
|
+
}), n.forEach((a) => {
|
|
131
|
+
this.handleDetachEdge(a);
|
|
132
|
+
}), o.forEach((a) => {
|
|
133
|
+
this.handleDetachNode(a);
|
|
134
|
+
}), t.forEach((a) => {
|
|
135
|
+
this.attachedNodes.has(a) || this.handleAttachNode(a);
|
|
136
|
+
}), s.forEach((a) => {
|
|
137
|
+
this.handleAttachEdge(a);
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
|
-
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new ot(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
141
141
|
}
|
|
142
142
|
attachNode(e) {
|
|
143
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -191,7 +191,7 @@ class tt {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class it {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -245,7 +245,7 @@ class rt {
|
|
|
245
245
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
class
|
|
248
|
+
class q {
|
|
249
249
|
constructor() {
|
|
250
250
|
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
251
251
|
}
|
|
@@ -262,10 +262,10 @@ class _ {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
const P = () => {
|
|
265
|
-
const r = new
|
|
265
|
+
const r = new q();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class Pe {
|
|
269
269
|
constructor(e, t, o, s) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
@@ -318,7 +318,7 @@ class Se {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class nt {
|
|
322
322
|
constructor() {
|
|
323
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
324
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -364,7 +364,7 @@ class S extends Error {
|
|
|
364
364
|
i(this, "name", "CanvasError");
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const N = Object.freeze({
|
|
368
368
|
accessNonexistingNode: (r) => `Failed to access node with ID ${JSON.stringify(r)} because it does not exist`,
|
|
369
369
|
addNodeWithExistingId: (r) => `Failed to add node with ID ${JSON.stringify(r)} because a node with this ID already exists`,
|
|
370
370
|
addNodeWithElementInUse: (r, e) => `Failed to add node with ID ${JSON.stringify(r)} because its HTML element is already attached to node with ID ${JSON.stringify(e)}`,
|
|
@@ -386,7 +386,7 @@ const b = Object.freeze({
|
|
|
386
386
|
removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
387
387
|
accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
|
|
388
388
|
});
|
|
389
|
-
class
|
|
389
|
+
class Te {
|
|
390
390
|
constructor() {
|
|
391
391
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
392
392
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -395,7 +395,7 @@ class be {
|
|
|
395
395
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
396
396
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
397
397
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
398
|
-
i(this, "elementPorts", new
|
|
398
|
+
i(this, "elementPorts", new nt());
|
|
399
399
|
i(this, "afterNodeAddedEmitter");
|
|
400
400
|
i(this, "onAfterNodeAdded");
|
|
401
401
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -430,16 +430,16 @@ class be {
|
|
|
430
430
|
getNode(e) {
|
|
431
431
|
const t = this.nodes.get(e);
|
|
432
432
|
if (t === void 0)
|
|
433
|
-
throw new S(
|
|
433
|
+
throw new S(N.accessNonexistingNode(e));
|
|
434
434
|
return t;
|
|
435
435
|
}
|
|
436
436
|
addNode(e) {
|
|
437
437
|
if (this.hasNode(e.id))
|
|
438
|
-
throw new S(
|
|
438
|
+
throw new S(N.addNodeWithExistingId(e.id));
|
|
439
439
|
const t = this.findNodeIdByElement(e.element);
|
|
440
440
|
if (t !== void 0)
|
|
441
441
|
throw new S(
|
|
442
|
-
|
|
442
|
+
N.addNodeWithElementInUse(e.id, t)
|
|
443
443
|
);
|
|
444
444
|
const o = /* @__PURE__ */ new Map(), s = {
|
|
445
445
|
element: e.element,
|
|
@@ -461,13 +461,13 @@ class be {
|
|
|
461
461
|
}
|
|
462
462
|
updateNode(e, t) {
|
|
463
463
|
if (!this.hasNode(e))
|
|
464
|
-
throw new S(
|
|
464
|
+
throw new S(N.updateNonexistentNode(e));
|
|
465
465
|
const { payload: o } = this.nodes.get(e);
|
|
466
466
|
o.x = t.x ?? o.x, o.y = t.y ?? o.y, o.centerFn = t.centerFn ?? o.centerFn, t.priority !== void 0 && (o.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
|
|
467
467
|
}
|
|
468
468
|
removeNode(e) {
|
|
469
469
|
if (!this.hasNode(e))
|
|
470
|
-
throw new S(
|
|
470
|
+
throw new S(N.removeNonexistentNode(e));
|
|
471
471
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
472
472
|
const t = this.getNode(e);
|
|
473
473
|
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
@@ -478,15 +478,15 @@ class be {
|
|
|
478
478
|
getPort(e) {
|
|
479
479
|
const t = this.ports.get(e);
|
|
480
480
|
if (t === void 0)
|
|
481
|
-
throw new S(
|
|
481
|
+
throw new S(N.accessNonexistentPort(e));
|
|
482
482
|
return t;
|
|
483
483
|
}
|
|
484
484
|
addPort(e) {
|
|
485
485
|
if (this.hasPort(e.id))
|
|
486
|
-
throw new S(
|
|
486
|
+
throw new S(N.addPortWithExistingId(e.id));
|
|
487
487
|
if (!this.hasNode(e.nodeId))
|
|
488
488
|
throw new S(
|
|
489
|
-
|
|
489
|
+
N.addPortToNonexistentNode(e.id, e.nodeId)
|
|
490
490
|
);
|
|
491
491
|
this.ports.set(e.id, {
|
|
492
492
|
element: e.element,
|
|
@@ -498,7 +498,7 @@ class be {
|
|
|
498
498
|
}
|
|
499
499
|
updatePort(e, t) {
|
|
500
500
|
if (!this.hasPort(e))
|
|
501
|
-
throw new S(
|
|
501
|
+
throw new S(N.updateNonexistentPort(e));
|
|
502
502
|
const o = this.getPort(e).payload;
|
|
503
503
|
o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
504
504
|
}
|
|
@@ -512,13 +512,13 @@ class be {
|
|
|
512
512
|
const t = this.nodes.get(e);
|
|
513
513
|
if (t === void 0)
|
|
514
514
|
throw new S(
|
|
515
|
-
|
|
515
|
+
N.accessPortsOfNonexistentNode(e)
|
|
516
516
|
);
|
|
517
517
|
return Array.from(t.ports.keys());
|
|
518
518
|
}
|
|
519
519
|
removePort(e) {
|
|
520
520
|
if (!this.hasPort(e))
|
|
521
|
-
throw new S(
|
|
521
|
+
throw new S(N.removeNonexistentPort(e));
|
|
522
522
|
const t = this.getPort(e).nodeId;
|
|
523
523
|
this.beforePortRemovedEmitter.emit(e), this.getNode(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
524
524
|
}
|
|
@@ -528,41 +528,41 @@ class be {
|
|
|
528
528
|
getEdge(e) {
|
|
529
529
|
const t = this.edges.get(e);
|
|
530
530
|
if (t === void 0)
|
|
531
|
-
throw new S(
|
|
531
|
+
throw new S(N.accessNonexistentEdge(e));
|
|
532
532
|
return t;
|
|
533
533
|
}
|
|
534
534
|
addEdge(e) {
|
|
535
535
|
if (this.hasEdge(e.id))
|
|
536
|
-
throw new S(
|
|
536
|
+
throw new S(N.addEdgeWithExistingId(e.id));
|
|
537
537
|
if (!this.hasPort(e.from))
|
|
538
538
|
throw new S(
|
|
539
|
-
|
|
539
|
+
N.addEdgeFromNonexistentPort(e.id, e.from)
|
|
540
540
|
);
|
|
541
541
|
if (!this.hasPort(e.to))
|
|
542
542
|
throw new S(
|
|
543
|
-
|
|
543
|
+
N.addEdgeToNonexistentPort(e.id, e.to)
|
|
544
544
|
);
|
|
545
545
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
546
546
|
}
|
|
547
547
|
updateEdge(e, t) {
|
|
548
548
|
if (!this.hasEdge(e))
|
|
549
|
-
throw new S(
|
|
549
|
+
throw new S(N.updateNonexistentEdge(e));
|
|
550
550
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
551
551
|
if (t.from !== void 0 && !this.hasPort(t.from))
|
|
552
552
|
throw new S(
|
|
553
|
-
|
|
553
|
+
N.updateNonexistentEdgeSource(e, t.from)
|
|
554
554
|
);
|
|
555
555
|
if (t.to !== void 0 && !this.hasPort(t.to))
|
|
556
556
|
throw new S(
|
|
557
|
-
|
|
557
|
+
N.updateNonexistentEdgeTarget(e, t.to)
|
|
558
558
|
);
|
|
559
|
-
const s = this.getEdge(e),
|
|
559
|
+
const s = this.getEdge(e), n = s.payload;
|
|
560
560
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
561
561
|
id: e,
|
|
562
562
|
from: t.from ?? s.from,
|
|
563
563
|
to: t.to ?? s.to,
|
|
564
|
-
shape:
|
|
565
|
-
priority:
|
|
564
|
+
shape: n.shape,
|
|
565
|
+
priority: n.priority
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
const o = this.edges.get(e);
|
|
@@ -573,7 +573,7 @@ class be {
|
|
|
573
573
|
}
|
|
574
574
|
removeEdge(e) {
|
|
575
575
|
if (!this.hasEdge(e))
|
|
576
|
-
throw new S(
|
|
576
|
+
throw new S(N.removeNonexistentEdge(e));
|
|
577
577
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
578
578
|
}
|
|
579
579
|
clear() {
|
|
@@ -583,7 +583,7 @@ class be {
|
|
|
583
583
|
const t = this.portIncomingEdges.get(e);
|
|
584
584
|
if (t === void 0)
|
|
585
585
|
throw new S(
|
|
586
|
-
|
|
586
|
+
N.accessEdgesForNonexistentPort(e)
|
|
587
587
|
);
|
|
588
588
|
return Array.from(t);
|
|
589
589
|
}
|
|
@@ -591,7 +591,7 @@ class be {
|
|
|
591
591
|
const t = this.portOutgoingEdges.get(e);
|
|
592
592
|
if (t === void 0)
|
|
593
593
|
throw new S(
|
|
594
|
-
|
|
594
|
+
N.accessEdgesForNonexistentPort(e)
|
|
595
595
|
);
|
|
596
596
|
return Array.from(t);
|
|
597
597
|
}
|
|
@@ -599,7 +599,7 @@ class be {
|
|
|
599
599
|
const t = this.portCycleEdges.get(e);
|
|
600
600
|
if (t === void 0)
|
|
601
601
|
throw new S(
|
|
602
|
-
|
|
602
|
+
N.accessEdgesForNonexistentPort(e)
|
|
603
603
|
);
|
|
604
604
|
return Array.from(t);
|
|
605
605
|
}
|
|
@@ -613,47 +613,47 @@ class be {
|
|
|
613
613
|
getNodeIncomingEdgeIds(e) {
|
|
614
614
|
const t = Array.from(this.getNode(e).ports.keys()), o = [];
|
|
615
615
|
return t.forEach((s) => {
|
|
616
|
-
this.getPortIncomingEdgeIds(s).filter((
|
|
617
|
-
const
|
|
618
|
-
return this.getPort(
|
|
619
|
-
}).forEach((
|
|
620
|
-
o.push(
|
|
616
|
+
this.getPortIncomingEdgeIds(s).filter((n) => {
|
|
617
|
+
const a = this.getEdge(n);
|
|
618
|
+
return this.getPort(a.from).nodeId !== e;
|
|
619
|
+
}).forEach((n) => {
|
|
620
|
+
o.push(n);
|
|
621
621
|
});
|
|
622
622
|
}), o;
|
|
623
623
|
}
|
|
624
624
|
getNodeOutgoingEdgeIds(e) {
|
|
625
625
|
const t = Array.from(this.getNode(e).ports.keys()), o = [];
|
|
626
626
|
return t.forEach((s) => {
|
|
627
|
-
this.getPortOutgoingEdgeIds(s).filter((
|
|
628
|
-
const
|
|
629
|
-
return this.getPort(
|
|
630
|
-
}).forEach((
|
|
631
|
-
o.push(
|
|
627
|
+
this.getPortOutgoingEdgeIds(s).filter((n) => {
|
|
628
|
+
const a = this.getEdge(n);
|
|
629
|
+
return this.getPort(a.to).nodeId !== e;
|
|
630
|
+
}).forEach((n) => {
|
|
631
|
+
o.push(n);
|
|
632
632
|
});
|
|
633
633
|
}), o;
|
|
634
634
|
}
|
|
635
635
|
getNodeCycleEdgeIds(e) {
|
|
636
636
|
const t = Array.from(this.getNode(e).ports.keys()), o = [];
|
|
637
637
|
return t.forEach((s) => {
|
|
638
|
-
this.getPortCycleEdgeIds(s).forEach((
|
|
639
|
-
o.push(
|
|
640
|
-
}), this.getPortIncomingEdgeIds(s).filter((
|
|
641
|
-
const
|
|
642
|
-
return this.getPort(
|
|
643
|
-
}).forEach((
|
|
644
|
-
o.push(
|
|
638
|
+
this.getPortCycleEdgeIds(s).forEach((n) => {
|
|
639
|
+
o.push(n);
|
|
640
|
+
}), this.getPortIncomingEdgeIds(s).filter((n) => {
|
|
641
|
+
const a = this.getEdge(n);
|
|
642
|
+
return this.getPort(a.to).nodeId === e;
|
|
643
|
+
}).forEach((n) => {
|
|
644
|
+
o.push(n);
|
|
645
645
|
});
|
|
646
646
|
}), o;
|
|
647
647
|
}
|
|
648
648
|
getNodeAdjacentEdgeIds(e) {
|
|
649
649
|
const t = Array.from(this.getNode(e).ports.keys()), o = [];
|
|
650
650
|
return t.forEach((s) => {
|
|
651
|
-
this.getPortIncomingEdgeIds(s).forEach((
|
|
652
|
-
o.push(
|
|
653
|
-
}), this.getPortOutgoingEdgeIds(s).forEach((
|
|
654
|
-
o.push(
|
|
655
|
-
}), this.getPortCycleEdgeIds(s).forEach((
|
|
656
|
-
o.push(
|
|
651
|
+
this.getPortIncomingEdgeIds(s).forEach((n) => {
|
|
652
|
+
o.push(n);
|
|
653
|
+
}), this.getPortOutgoingEdgeIds(s).forEach((n) => {
|
|
654
|
+
o.push(n);
|
|
655
|
+
}), this.getPortCycleEdgeIds(s).forEach((n) => {
|
|
656
|
+
o.push(n);
|
|
657
657
|
});
|
|
658
658
|
}), o;
|
|
659
659
|
}
|
|
@@ -672,22 +672,22 @@ class be {
|
|
|
672
672
|
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const ye = (r) => ({
|
|
676
676
|
scale: 1 / r.scale,
|
|
677
677
|
x: -r.x / r.scale,
|
|
678
678
|
y: -r.y / r.scale
|
|
679
|
-
}),
|
|
679
|
+
}), fe = {
|
|
680
680
|
scale: 1,
|
|
681
681
|
x: 0,
|
|
682
682
|
y: 0
|
|
683
|
-
},
|
|
683
|
+
}, ve = (r, e) => ({
|
|
684
684
|
x: r.scale * e.x + r.x,
|
|
685
685
|
y: r.scale * e.y + r.y
|
|
686
686
|
});
|
|
687
|
-
class
|
|
687
|
+
class at {
|
|
688
688
|
constructor(e) {
|
|
689
|
-
i(this, "viewportMatrix",
|
|
690
|
-
i(this, "contentMatrix",
|
|
689
|
+
i(this, "viewportMatrix", fe);
|
|
690
|
+
i(this, "contentMatrix", fe);
|
|
691
691
|
i(this, "beforeUpdateEmitter");
|
|
692
692
|
i(this, "onBeforeUpdated");
|
|
693
693
|
i(this, "afterUpdateEmitter");
|
|
@@ -710,30 +710,30 @@ class st {
|
|
|
710
710
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
711
711
|
x: e.x ?? this.viewportMatrix.x,
|
|
712
712
|
y: e.y ?? this.viewportMatrix.y
|
|
713
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
713
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = ye(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
714
714
|
}
|
|
715
715
|
patchContentMatrix(e) {
|
|
716
716
|
this.contentMatrix = {
|
|
717
717
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
718
718
|
x: e.x ?? this.contentMatrix.x,
|
|
719
719
|
y: e.y ?? this.contentMatrix.y
|
|
720
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
720
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ye(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
721
721
|
}
|
|
722
722
|
getDimensions() {
|
|
723
723
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
724
724
|
return { width: e, height: t };
|
|
725
725
|
}
|
|
726
726
|
createContentCoords(e) {
|
|
727
|
-
return
|
|
727
|
+
return ve(this.viewportMatrix, e);
|
|
728
728
|
}
|
|
729
729
|
createViewportCoords(e) {
|
|
730
|
-
return
|
|
730
|
+
return ve(this.contentMatrix, e);
|
|
731
731
|
}
|
|
732
732
|
destroy() {
|
|
733
733
|
this.observer.disconnect();
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
class
|
|
736
|
+
class ee {
|
|
737
737
|
constructor(e) {
|
|
738
738
|
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
739
739
|
i(this, "nodesResizeObserver");
|
|
@@ -759,19 +759,19 @@ class q {
|
|
|
759
759
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
760
760
|
}
|
|
761
761
|
static configure(e) {
|
|
762
|
-
new
|
|
762
|
+
new ee(e);
|
|
763
763
|
}
|
|
764
764
|
handleNodeResize(e) {
|
|
765
765
|
const t = this.elementToNodeId.get(e);
|
|
766
766
|
this.canvas.updateNode(t);
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
const
|
|
770
|
-
const { x: o, y: s, width:
|
|
771
|
-
return e >= o && e <= o +
|
|
772
|
-
},
|
|
769
|
+
const ht = (r, e, t) => {
|
|
770
|
+
const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
|
|
771
|
+
return e >= o && e <= o + n && t >= s && t <= s + a;
|
|
772
|
+
}, dt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, D = (r, e, t, o) => ht(e, t, o) && dt(r, t, o), Y = (r, e) => {
|
|
773
773
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
774
|
-
},
|
|
774
|
+
}, X = (r) => {
|
|
775
775
|
const e = document.createElement("div");
|
|
776
776
|
return {
|
|
777
777
|
id: r.overlayNodeId,
|
|
@@ -786,7 +786,7 @@ const it = (r, e, t) => {
|
|
|
786
786
|
}
|
|
787
787
|
]
|
|
788
788
|
};
|
|
789
|
-
},
|
|
789
|
+
}, ct = (r, e) => {
|
|
790
790
|
let t = e;
|
|
791
791
|
for (; t !== null; ) {
|
|
792
792
|
const o = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -805,21 +805,21 @@ const it = (r, e, t) => {
|
|
|
805
805
|
status: "notFound"
|
|
806
806
|
};
|
|
807
807
|
};
|
|
808
|
-
function*
|
|
808
|
+
function* Ce(r, e) {
|
|
809
809
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
810
810
|
for (const o of t) {
|
|
811
811
|
if (o.shadowRoot !== null) {
|
|
812
|
-
const s =
|
|
813
|
-
for (const
|
|
814
|
-
yield
|
|
812
|
+
const s = Ce(o.shadowRoot, e);
|
|
813
|
+
for (const n of s)
|
|
814
|
+
yield n;
|
|
815
815
|
}
|
|
816
816
|
yield o;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
const
|
|
820
|
-
const t =
|
|
819
|
+
const Me = (r, e) => {
|
|
820
|
+
const t = Ce(document, e);
|
|
821
821
|
for (const o of t) {
|
|
822
|
-
const s =
|
|
822
|
+
const s = ct(r, o);
|
|
823
823
|
if (s.status === "portFound")
|
|
824
824
|
return s.portId;
|
|
825
825
|
if (s.status === "nodeEncountered")
|
|
@@ -828,30 +828,30 @@ const Pe = (r, e) => {
|
|
|
828
828
|
return null;
|
|
829
829
|
};
|
|
830
830
|
var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
|
|
831
|
-
const
|
|
831
|
+
const De = (r, e) => ({
|
|
832
832
|
x: r / 2,
|
|
833
833
|
y: e / 2
|
|
834
|
-
}),
|
|
834
|
+
}), m = (r, e, t) => ({
|
|
835
835
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
836
836
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
837
|
-
}),
|
|
837
|
+
}), Le = (r, e, t) => {
|
|
838
838
|
const o = {
|
|
839
839
|
x: r.x + r.width / 2,
|
|
840
840
|
y: r.y + r.height / 2
|
|
841
841
|
}, s = {
|
|
842
842
|
x: e.x + e.width / 2,
|
|
843
843
|
y: e.y + e.height / 2
|
|
844
|
-
},
|
|
844
|
+
}, n = Math.min(o.x, s.x) - t, a = Math.min(o.y, s.y) - t, h = 2 * t, d = Math.abs(s.x - o.x) + h, c = Math.abs(s.y - o.y) + h;
|
|
845
845
|
return {
|
|
846
|
-
x:
|
|
847
|
-
y:
|
|
846
|
+
x: n,
|
|
847
|
+
y: a,
|
|
848
848
|
width: d,
|
|
849
849
|
height: c,
|
|
850
|
-
from: { x: o.x -
|
|
851
|
-
to: { x: s.x -
|
|
850
|
+
from: { x: o.x - n, y: o.y - a },
|
|
851
|
+
to: { x: s.x - n, y: s.y - a }
|
|
852
852
|
};
|
|
853
853
|
};
|
|
854
|
-
class
|
|
854
|
+
class lt {
|
|
855
855
|
constructor(e) {
|
|
856
856
|
i(this, "path");
|
|
857
857
|
i(this, "midpoint");
|
|
@@ -859,32 +859,32 @@ class ht {
|
|
|
859
859
|
from: t,
|
|
860
860
|
to: o,
|
|
861
861
|
arrowLength: s,
|
|
862
|
-
fromDir:
|
|
863
|
-
toDir:
|
|
862
|
+
fromDir: n,
|
|
863
|
+
toDir: a,
|
|
864
864
|
curvature: h,
|
|
865
865
|
hasSourceArrow: d,
|
|
866
866
|
hasTargetArrow: c
|
|
867
|
-
} = e,
|
|
868
|
-
this.midpoint = { x:
|
|
869
|
-
const l =
|
|
867
|
+
} = e, u = (t.x + o.x) / 2, g = (t.y + o.y) / 2;
|
|
868
|
+
this.midpoint = { x: u, y: g };
|
|
869
|
+
const l = m(
|
|
870
870
|
{ x: t.x + s, y: t.y },
|
|
871
|
-
|
|
871
|
+
n,
|
|
872
872
|
t
|
|
873
|
-
),
|
|
873
|
+
), w = m(
|
|
874
874
|
{ x: o.x - s, y: o.y },
|
|
875
|
-
|
|
875
|
+
a,
|
|
876
876
|
o
|
|
877
|
-
),
|
|
878
|
-
x: l.x +
|
|
879
|
-
y: l.y +
|
|
880
|
-
},
|
|
881
|
-
x:
|
|
882
|
-
y:
|
|
883
|
-
}, f = `M ${l.x} ${l.y} C ${
|
|
884
|
-
this.path = `${
|
|
877
|
+
), p = {
|
|
878
|
+
x: l.x + n.x * h,
|
|
879
|
+
y: l.y + n.y * h
|
|
880
|
+
}, y = {
|
|
881
|
+
x: w.x - a.x * h,
|
|
882
|
+
y: w.y - a.y * h
|
|
883
|
+
}, f = `M ${l.x} ${l.y} C ${p.x} ${p.y}, ${y.x} ${y.y}, ${w.x} ${w.y}`, x = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, E = c ? "" : ` M ${w.x} ${w.y} L ${o.x} ${o.y}`;
|
|
884
|
+
this.path = `${x}${f}${E}`;
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
|
-
class
|
|
887
|
+
class ut {
|
|
888
888
|
constructor(e) {
|
|
889
889
|
i(this, "path");
|
|
890
890
|
i(this, "midpoint");
|
|
@@ -892,99 +892,99 @@ class dt {
|
|
|
892
892
|
hasSourceArrow: t,
|
|
893
893
|
hasTargetArrow: o,
|
|
894
894
|
curvature: s,
|
|
895
|
-
fromDir:
|
|
896
|
-
toDir:
|
|
895
|
+
fromDir: n,
|
|
896
|
+
toDir: a,
|
|
897
897
|
detourDir: h,
|
|
898
898
|
from: d,
|
|
899
899
|
to: c,
|
|
900
|
-
arrowLength:
|
|
901
|
-
detourDistance:
|
|
902
|
-
} = e, l = t ?
|
|
903
|
-
{ x: d.x +
|
|
904
|
-
|
|
900
|
+
arrowLength: u,
|
|
901
|
+
detourDistance: g
|
|
902
|
+
} = e, l = t ? m(
|
|
903
|
+
{ x: d.x + u, y: d.y },
|
|
904
|
+
n,
|
|
905
905
|
d
|
|
906
|
-
) : d,
|
|
906
|
+
) : d, w = o ? m(
|
|
907
907
|
{
|
|
908
|
-
x: c.x -
|
|
908
|
+
x: c.x - u,
|
|
909
909
|
y: c.y
|
|
910
910
|
},
|
|
911
|
-
n,
|
|
912
|
-
c
|
|
913
|
-
) : c, y = Math.cos(h) * u, w = Math.sin(h) * u, f = x(
|
|
914
|
-
{ x: d.x + g, y: d.y },
|
|
915
911
|
a,
|
|
916
|
-
|
|
917
|
-
),
|
|
918
|
-
x:
|
|
919
|
-
y: f.y + w
|
|
920
|
-
}, A = x(
|
|
921
|
-
{ x: c.x - g, y: c.y },
|
|
912
|
+
c
|
|
913
|
+
) : c, p = Math.cos(h) * g, y = Math.sin(h) * g, f = m(
|
|
914
|
+
{ x: d.x + u, y: d.y },
|
|
922
915
|
n,
|
|
916
|
+
d
|
|
917
|
+
), x = {
|
|
918
|
+
x: f.x + p,
|
|
919
|
+
y: f.y + y
|
|
920
|
+
}, E = m(
|
|
921
|
+
{ x: c.x - u, y: c.y },
|
|
922
|
+
a,
|
|
923
923
|
c
|
|
924
|
-
),
|
|
925
|
-
x:
|
|
926
|
-
y:
|
|
927
|
-
}, C = {
|
|
928
|
-
x: (m.x + N.x) / 2,
|
|
929
|
-
y: (m.y + N.y) / 2
|
|
924
|
+
), b = {
|
|
925
|
+
x: E.x + p,
|
|
926
|
+
y: E.y + y
|
|
930
927
|
}, T = {
|
|
931
|
-
x:
|
|
932
|
-
y:
|
|
928
|
+
x: (x.x + b.x) / 2,
|
|
929
|
+
y: (x.y + b.y) / 2
|
|
930
|
+
}, C = {
|
|
931
|
+
x: f.x + s * n.x,
|
|
932
|
+
y: f.y + s * n.y
|
|
933
933
|
}, I = {
|
|
934
|
-
x:
|
|
935
|
-
y:
|
|
936
|
-
},
|
|
937
|
-
x: f.x +
|
|
938
|
-
y: f.y +
|
|
934
|
+
x: E.x - s * a.x,
|
|
935
|
+
y: E.y - s * a.y
|
|
936
|
+
}, U = {
|
|
937
|
+
x: f.x + p,
|
|
938
|
+
y: f.y + y
|
|
939
939
|
}, $ = {
|
|
940
|
-
x:
|
|
941
|
-
y:
|
|
940
|
+
x: E.x + p,
|
|
941
|
+
y: E.y + y
|
|
942
942
|
};
|
|
943
943
|
this.path = [
|
|
944
944
|
`M ${l.x} ${l.y}`,
|
|
945
945
|
`L ${f.x} ${f.y}`,
|
|
946
|
-
`C ${
|
|
947
|
-
`C ${$.x} ${$.y} ${I.x} ${I.y} ${
|
|
948
|
-
`L ${
|
|
949
|
-
].join(" "), this.midpoint =
|
|
946
|
+
`C ${C.x} ${C.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
|
|
947
|
+
`C ${$.x} ${$.y} ${I.x} ${I.y} ${E.x} ${E.y}`,
|
|
948
|
+
`L ${w.x} ${w.y}`
|
|
949
|
+
].join(" "), this.midpoint = T;
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
const
|
|
952
|
+
const te = Object.freeze({
|
|
953
953
|
edgeColor: "--edge-color"
|
|
954
|
-
}),
|
|
954
|
+
}), Re = (r) => {
|
|
955
955
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
956
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
957
|
-
},
|
|
956
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(te.edgeColor, r), e;
|
|
957
|
+
}, Ve = (r) => {
|
|
958
958
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
959
|
-
return e.setAttribute("stroke", `var(${
|
|
960
|
-
},
|
|
959
|
+
return e.setAttribute("stroke", `var(${te.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
960
|
+
}, H = () => {
|
|
961
961
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
962
|
-
return r.setAttribute("fill", `var(${
|
|
963
|
-
},
|
|
962
|
+
return r.setAttribute("fill", `var(${te.edgeColor})`), r;
|
|
963
|
+
}, Fe = (r, e) => {
|
|
964
964
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
|
|
965
965
|
}, R = (r, e) => {
|
|
966
966
|
const t = [];
|
|
967
967
|
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) {
|
|
968
968
|
const o = r.length - 1;
|
|
969
|
-
let s = 0,
|
|
969
|
+
let s = 0, n = 0, a = 0;
|
|
970
970
|
r.forEach((h, d) => {
|
|
971
|
-
let c = 0,
|
|
972
|
-
const l = d > 0,
|
|
973
|
-
if (l && (c = -s,
|
|
974
|
-
const
|
|
975
|
-
s =
|
|
971
|
+
let c = 0, u = 0, g = 0;
|
|
972
|
+
const l = d > 0, w = d < o, p = l && w;
|
|
973
|
+
if (l && (c = -s, u = -n, g = a), w) {
|
|
974
|
+
const C = r[d + 1];
|
|
975
|
+
s = C.x - h.x, n = C.y - h.y, a = Math.sqrt(s * s + n * n);
|
|
976
976
|
}
|
|
977
|
-
const f =
|
|
978
|
-
d > 0 && t.push(`L ${
|
|
979
|
-
`C ${h.x} ${h.y} ${h.x} ${h.y} ${
|
|
977
|
+
const f = a !== 0 ? Math.min((p ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = p ? { x: h.x + s * f, y: h.y + n * f } : h, b = g !== 0 ? Math.min((p ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, T = p ? { x: h.x + c * b, y: h.y + u * b } : h;
|
|
978
|
+
d > 0 && t.push(`L ${T.x} ${T.y}`), p && t.push(
|
|
979
|
+
`C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
|
|
980
980
|
);
|
|
981
981
|
});
|
|
982
982
|
}
|
|
983
983
|
return t.join(" ");
|
|
984
|
-
},
|
|
984
|
+
}, gt = (r, e) => {
|
|
985
985
|
const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
|
|
986
986
|
if (o === s) {
|
|
987
|
-
const c = o === t,
|
|
987
|
+
const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
|
|
988
988
|
return c ? {
|
|
989
989
|
points: [
|
|
990
990
|
{ x: r.x, y: r.y },
|
|
@@ -1003,8 +1003,8 @@ const ee = Object.freeze({
|
|
|
1003
1003
|
midpoint: l
|
|
1004
1004
|
};
|
|
1005
1005
|
}
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1006
|
+
const a = o === t, h = (r.y + e.y) / 2;
|
|
1007
|
+
if (a) {
|
|
1008
1008
|
const c = { x: e.x, y: r.y };
|
|
1009
1009
|
return {
|
|
1010
1010
|
points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
|
|
@@ -1017,7 +1017,7 @@ const ee = Object.freeze({
|
|
|
1017
1017
|
midpoint: { x: d.x, y: h }
|
|
1018
1018
|
};
|
|
1019
1019
|
};
|
|
1020
|
-
class
|
|
1020
|
+
class pt {
|
|
1021
1021
|
constructor(e) {
|
|
1022
1022
|
i(this, "path");
|
|
1023
1023
|
i(this, "midpoint");
|
|
@@ -1025,46 +1025,46 @@ class lt {
|
|
|
1025
1025
|
from: t,
|
|
1026
1026
|
to: o,
|
|
1027
1027
|
fromDir: s,
|
|
1028
|
-
toDir:
|
|
1029
|
-
arrowLength:
|
|
1028
|
+
toDir: n,
|
|
1029
|
+
arrowLength: a,
|
|
1030
1030
|
arrowOffset: h,
|
|
1031
1031
|
roundness: d,
|
|
1032
1032
|
hasSourceArrow: c,
|
|
1033
|
-
hasTargetArrow:
|
|
1034
|
-
} = e,
|
|
1035
|
-
{ x: t.x +
|
|
1033
|
+
hasTargetArrow: u
|
|
1034
|
+
} = e, g = c ? m(
|
|
1035
|
+
{ x: t.x + a, y: t.y },
|
|
1036
1036
|
s,
|
|
1037
1037
|
t
|
|
1038
|
-
) : t, l =
|
|
1038
|
+
) : t, l = u ? m(
|
|
1039
1039
|
{
|
|
1040
|
-
x: o.x -
|
|
1040
|
+
x: o.x - a,
|
|
1041
1041
|
y: o.y
|
|
1042
1042
|
},
|
|
1043
|
-
|
|
1043
|
+
n,
|
|
1044
1044
|
o
|
|
1045
|
-
) : o,
|
|
1046
|
-
{ x: t.x +
|
|
1045
|
+
) : o, w = a + h, p = m(
|
|
1046
|
+
{ x: t.x + w, y: t.y },
|
|
1047
1047
|
s,
|
|
1048
1048
|
t
|
|
1049
|
-
),
|
|
1049
|
+
), y = m({ x: o.x - w, y: o.y }, n, o), f = gt(
|
|
1050
1050
|
{
|
|
1051
|
-
x:
|
|
1052
|
-
y:
|
|
1051
|
+
x: p.x,
|
|
1052
|
+
y: p.y,
|
|
1053
1053
|
dirX: s.x
|
|
1054
1054
|
},
|
|
1055
1055
|
{
|
|
1056
|
-
x:
|
|
1057
|
-
y:
|
|
1058
|
-
dirX:
|
|
1056
|
+
x: y.x,
|
|
1057
|
+
y: y.y,
|
|
1058
|
+
dirX: n.x
|
|
1059
1059
|
}
|
|
1060
1060
|
);
|
|
1061
1061
|
this.path = R(
|
|
1062
|
-
[
|
|
1062
|
+
[g, ...f.points, l],
|
|
1063
1063
|
d
|
|
1064
1064
|
), this.midpoint = f.midpoint;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
|
-
class
|
|
1067
|
+
class wt {
|
|
1068
1068
|
constructor(e) {
|
|
1069
1069
|
i(this, "path");
|
|
1070
1070
|
i(this, "midpoint");
|
|
@@ -1072,50 +1072,50 @@ class gt {
|
|
|
1072
1072
|
hasSourceArrow: t,
|
|
1073
1073
|
hasTargetArrow: o,
|
|
1074
1074
|
from: s,
|
|
1075
|
-
to:
|
|
1076
|
-
arrowLength:
|
|
1075
|
+
to: n,
|
|
1076
|
+
arrowLength: a,
|
|
1077
1077
|
fromDir: h,
|
|
1078
1078
|
toDir: d,
|
|
1079
1079
|
arrowOffset: c,
|
|
1080
|
-
detourDir:
|
|
1081
|
-
detourDistance:
|
|
1080
|
+
detourDir: u,
|
|
1081
|
+
detourDistance: g,
|
|
1082
1082
|
roundness: l
|
|
1083
|
-
} = e,
|
|
1084
|
-
{ x: s.x +
|
|
1083
|
+
} = e, w = t ? m(
|
|
1084
|
+
{ x: s.x + a, y: s.y },
|
|
1085
1085
|
h,
|
|
1086
1086
|
s
|
|
1087
|
-
) : s,
|
|
1087
|
+
) : s, p = o ? m(
|
|
1088
1088
|
{
|
|
1089
|
-
x:
|
|
1090
|
-
y:
|
|
1089
|
+
x: n.x - a,
|
|
1090
|
+
y: n.y
|
|
1091
1091
|
},
|
|
1092
1092
|
d,
|
|
1093
|
-
|
|
1094
|
-
) :
|
|
1095
|
-
{ x: s.x +
|
|
1093
|
+
n
|
|
1094
|
+
) : n, y = a + c, f = Math.cos(u) * g, x = Math.sin(u) * g, E = m(
|
|
1095
|
+
{ x: s.x + y, y: s.y },
|
|
1096
1096
|
h,
|
|
1097
1097
|
s
|
|
1098
|
-
),
|
|
1099
|
-
x:
|
|
1100
|
-
y:
|
|
1101
|
-
},
|
|
1102
|
-
{ x:
|
|
1098
|
+
), b = {
|
|
1099
|
+
x: E.x + f,
|
|
1100
|
+
y: E.y + x
|
|
1101
|
+
}, T = m(
|
|
1102
|
+
{ x: n.x - y, y: n.y },
|
|
1103
1103
|
d,
|
|
1104
|
-
|
|
1105
|
-
),
|
|
1106
|
-
x:
|
|
1107
|
-
y:
|
|
1104
|
+
n
|
|
1105
|
+
), C = {
|
|
1106
|
+
x: T.x + f,
|
|
1107
|
+
y: T.y + x
|
|
1108
1108
|
};
|
|
1109
1109
|
this.midpoint = {
|
|
1110
|
-
x: (
|
|
1111
|
-
y: (
|
|
1110
|
+
x: (b.x + C.x) / 2,
|
|
1111
|
+
y: (b.y + C.y) / 2
|
|
1112
1112
|
}, this.path = R(
|
|
1113
|
-
[
|
|
1113
|
+
[w, E, b, C, T, p],
|
|
1114
1114
|
l
|
|
1115
1115
|
);
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
|
-
class
|
|
1118
|
+
class yt {
|
|
1119
1119
|
constructor(e) {
|
|
1120
1120
|
i(this, "path");
|
|
1121
1121
|
i(this, "midpoint");
|
|
@@ -1123,44 +1123,44 @@ class ut {
|
|
|
1123
1123
|
from: t,
|
|
1124
1124
|
to: o,
|
|
1125
1125
|
hasSourceArrow: s,
|
|
1126
|
-
hasTargetArrow:
|
|
1127
|
-
arrowLength:
|
|
1126
|
+
hasTargetArrow: n,
|
|
1127
|
+
arrowLength: a,
|
|
1128
1128
|
fromDir: h,
|
|
1129
1129
|
toDir: d,
|
|
1130
1130
|
arrowOffset: c,
|
|
1131
|
-
roundness:
|
|
1132
|
-
} = e,
|
|
1131
|
+
roundness: u
|
|
1132
|
+
} = e, g = this.createArrowPoint(
|
|
1133
1133
|
s,
|
|
1134
1134
|
h,
|
|
1135
1135
|
t,
|
|
1136
|
-
|
|
1136
|
+
a
|
|
1137
1137
|
), l = this.createArrowPoint(
|
|
1138
|
-
|
|
1138
|
+
n,
|
|
1139
1139
|
d,
|
|
1140
1140
|
o,
|
|
1141
|
-
-
|
|
1142
|
-
),
|
|
1141
|
+
-a
|
|
1142
|
+
), w = a + c, p = { x: t.x + w, y: t.y }, y = m(p, h, t), f = { x: o.x - w, y: o.y }, x = m(f, d, o);
|
|
1143
1143
|
this.path = R(
|
|
1144
|
-
[
|
|
1145
|
-
|
|
1144
|
+
[g, y, x, l],
|
|
1145
|
+
u
|
|
1146
1146
|
);
|
|
1147
|
-
const
|
|
1148
|
-
this.midpoint = { x:
|
|
1147
|
+
const E = (y.x + x.x) / 2, b = (y.y + x.y) / 2;
|
|
1148
|
+
this.midpoint = { x: E, y: b };
|
|
1149
1149
|
}
|
|
1150
1150
|
createArrowPoint(e, t, o, s) {
|
|
1151
1151
|
if (!e)
|
|
1152
1152
|
return o;
|
|
1153
|
-
const
|
|
1153
|
+
const n = {
|
|
1154
1154
|
x: o.x + s,
|
|
1155
1155
|
y: o.y
|
|
1156
1156
|
};
|
|
1157
|
-
return
|
|
1157
|
+
return m(n, t, o);
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
|
-
const
|
|
1160
|
+
const ft = (r, e) => {
|
|
1161
1161
|
const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
|
|
1162
1162
|
if (o === s) {
|
|
1163
|
-
const c = o === t,
|
|
1163
|
+
const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
|
|
1164
1164
|
return c ? {
|
|
1165
1165
|
points: [
|
|
1166
1166
|
{ x: r.x, y: r.y },
|
|
@@ -1179,8 +1179,8 @@ const pt = (r, e) => {
|
|
|
1179
1179
|
midpoint: l
|
|
1180
1180
|
};
|
|
1181
1181
|
}
|
|
1182
|
-
const
|
|
1183
|
-
if (
|
|
1182
|
+
const a = o === t, h = (r.x + e.x) / 2;
|
|
1183
|
+
if (a) {
|
|
1184
1184
|
const c = { x: r.x, y: e.y };
|
|
1185
1185
|
return {
|
|
1186
1186
|
points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
|
|
@@ -1193,7 +1193,7 @@ const pt = (r, e) => {
|
|
|
1193
1193
|
midpoint: { x: h, y: d.y }
|
|
1194
1194
|
};
|
|
1195
1195
|
};
|
|
1196
|
-
class
|
|
1196
|
+
class vt {
|
|
1197
1197
|
constructor(e) {
|
|
1198
1198
|
i(this, "path");
|
|
1199
1199
|
i(this, "midpoint");
|
|
@@ -1201,50 +1201,50 @@ class yt {
|
|
|
1201
1201
|
from: t,
|
|
1202
1202
|
to: o,
|
|
1203
1203
|
hasSourceArrow: s,
|
|
1204
|
-
hasTargetArrow:
|
|
1205
|
-
arrowLength:
|
|
1204
|
+
hasTargetArrow: n,
|
|
1205
|
+
arrowLength: a,
|
|
1206
1206
|
arrowOffset: h,
|
|
1207
1207
|
fromDir: d,
|
|
1208
1208
|
toDir: c,
|
|
1209
|
-
roundness:
|
|
1210
|
-
} = e,
|
|
1211
|
-
{ x: t.x +
|
|
1209
|
+
roundness: u
|
|
1210
|
+
} = e, g = s ? m(
|
|
1211
|
+
{ x: t.x + a, y: t.y },
|
|
1212
1212
|
d,
|
|
1213
1213
|
t
|
|
1214
|
-
) : t, l =
|
|
1214
|
+
) : t, l = n ? m(
|
|
1215
1215
|
{
|
|
1216
|
-
x: o.x -
|
|
1216
|
+
x: o.x - a,
|
|
1217
1217
|
y: o.y
|
|
1218
1218
|
},
|
|
1219
1219
|
c,
|
|
1220
1220
|
o
|
|
1221
|
-
) : o,
|
|
1222
|
-
{ x: t.x +
|
|
1221
|
+
) : o, w = a + h, p = m(
|
|
1222
|
+
{ x: t.x + w, y: t.y },
|
|
1223
1223
|
d,
|
|
1224
1224
|
t
|
|
1225
|
-
),
|
|
1225
|
+
), y = m({ x: o.x - w, y: o.y }, c, o), f = ft(
|
|
1226
1226
|
{
|
|
1227
|
-
x:
|
|
1228
|
-
y:
|
|
1227
|
+
x: p.x,
|
|
1228
|
+
y: p.y,
|
|
1229
1229
|
dirY: d.y
|
|
1230
1230
|
},
|
|
1231
1231
|
{
|
|
1232
|
-
x:
|
|
1233
|
-
y:
|
|
1232
|
+
x: y.x,
|
|
1233
|
+
y: y.y,
|
|
1234
1234
|
dirY: c.y
|
|
1235
1235
|
}
|
|
1236
1236
|
);
|
|
1237
1237
|
this.path = R(
|
|
1238
|
-
[
|
|
1239
|
-
|
|
1238
|
+
[g, ...f.points, l],
|
|
1239
|
+
u
|
|
1240
1240
|
), this.midpoint = f.midpoint;
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
class
|
|
1243
|
+
class re {
|
|
1244
1244
|
constructor(e) {
|
|
1245
1245
|
i(this, "path");
|
|
1246
1246
|
i(this, "midpoint");
|
|
1247
|
-
const { side: t, arrowLength: o, arrowOffset: s, dir:
|
|
1247
|
+
const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, g = [
|
|
1248
1248
|
{ x: o, y: 0 },
|
|
1249
1249
|
{ x: d, y: 0 },
|
|
1250
1250
|
{ x: d, y: t },
|
|
@@ -1253,29 +1253,29 @@ class te {
|
|
|
1253
1253
|
{ x: d, y: -t },
|
|
1254
1254
|
{ x: d, y: 0 },
|
|
1255
1255
|
{ x: o, y: 0 }
|
|
1256
|
-
].map((
|
|
1257
|
-
this.path = `${h ? "" : l}${R(
|
|
1256
|
+
].map((w) => m(w, n, { x: 0, y: 0 })).map((w) => ({ x: w.x + a.x, y: w.y + a.y })), l = `M ${a.x} ${a.y} L ${g[0].x} ${g[0].y} `;
|
|
1257
|
+
this.path = `${h ? "" : l}${R(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
|
|
1258
1258
|
}
|
|
1259
1259
|
}
|
|
1260
|
-
class
|
|
1260
|
+
class mt {
|
|
1261
1261
|
constructor(e) {
|
|
1262
1262
|
i(this, "path");
|
|
1263
1263
|
i(this, "midpoint");
|
|
1264
|
-
const { arrowLength: t, radius: o, smallRadius: s, dir:
|
|
1264
|
+
const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), g = u * s / d, l = u + o + t, w = t + g, y = [
|
|
1265
1265
|
{ x: t, y: 0 },
|
|
1266
|
-
{ x:
|
|
1267
|
-
{ x:
|
|
1266
|
+
{ x: w, y: c },
|
|
1267
|
+
{ x: w, y: -c },
|
|
1268
1268
|
{ x: l, y: 0 }
|
|
1269
|
-
].map((
|
|
1270
|
-
`M ${
|
|
1271
|
-
`A ${s} ${s} 0 0 1 ${
|
|
1272
|
-
`A ${o} ${o} 0 1 0 ${
|
|
1273
|
-
`A ${s} ${s} 0 0 1 ${
|
|
1274
|
-
].join(" "),
|
|
1275
|
-
this.path = `${h ? "" :
|
|
1269
|
+
].map((E) => m(E, n, { x: 0, y: 0 })).map((E) => ({ x: E.x + a.x, y: E.y + a.y })), f = [
|
|
1270
|
+
`M ${y[0].x} ${y[0].y}`,
|
|
1271
|
+
`A ${s} ${s} 0 0 1 ${y[1].x} ${y[1].y}`,
|
|
1272
|
+
`A ${o} ${o} 0 1 0 ${y[2].x} ${y[2].y}`,
|
|
1273
|
+
`A ${s} ${s} 0 0 1 ${y[0].x} ${y[0].y}`
|
|
1274
|
+
].join(" "), x = `M ${a.x} ${a.y} L ${y[0].x} ${y[0].y} `;
|
|
1275
|
+
this.path = `${h ? "" : x}${f}`, this.midpoint = y[3];
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
|
-
class
|
|
1278
|
+
class xt {
|
|
1279
1279
|
constructor(e) {
|
|
1280
1280
|
i(this, "path");
|
|
1281
1281
|
i(this, "midpoint");
|
|
@@ -1284,47 +1284,47 @@ class ft {
|
|
|
1284
1284
|
from: t,
|
|
1285
1285
|
to: o,
|
|
1286
1286
|
sourceOffset: s,
|
|
1287
|
-
targetOffset:
|
|
1288
|
-
hasSourceArrow:
|
|
1287
|
+
targetOffset: n,
|
|
1288
|
+
hasSourceArrow: a,
|
|
1289
1289
|
hasTargetArrow: h,
|
|
1290
1290
|
arrowLength: d
|
|
1291
1291
|
} = e;
|
|
1292
1292
|
this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
|
|
1293
|
-
const c = o.x - t.x,
|
|
1294
|
-
if (this.diagonalDistance = Math.sqrt(c * c +
|
|
1293
|
+
const c = o.x - t.x, u = o.y - t.y;
|
|
1294
|
+
if (this.diagonalDistance = Math.sqrt(c * c + u * u), this.diagonalDistance === 0) {
|
|
1295
1295
|
this.path = "";
|
|
1296
1296
|
return;
|
|
1297
1297
|
}
|
|
1298
|
-
const
|
|
1298
|
+
const g = { x: c, y: u }, l = this.createDirectLinePoint({
|
|
1299
1299
|
offset: s,
|
|
1300
|
-
hasArrow:
|
|
1300
|
+
hasArrow: a,
|
|
1301
1301
|
flip: 1,
|
|
1302
1302
|
shift: t,
|
|
1303
1303
|
arrowLength: d,
|
|
1304
|
-
dir:
|
|
1305
|
-
}),
|
|
1306
|
-
offset:
|
|
1304
|
+
dir: g
|
|
1305
|
+
}), w = this.createDirectLinePoint({
|
|
1306
|
+
offset: n,
|
|
1307
1307
|
hasArrow: h,
|
|
1308
1308
|
flip: -1,
|
|
1309
1309
|
shift: o,
|
|
1310
1310
|
arrowLength: d,
|
|
1311
|
-
dir:
|
|
1311
|
+
dir: g
|
|
1312
1312
|
});
|
|
1313
|
-
this.path = `M ${l.x} ${l.y} L ${
|
|
1313
|
+
this.path = `M ${l.x} ${l.y} L ${w.x} ${w.y}`;
|
|
1314
1314
|
}
|
|
1315
1315
|
createDirectLinePoint(e) {
|
|
1316
|
-
const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir:
|
|
1316
|
+
const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
|
|
1317
1317
|
return {
|
|
1318
|
-
x:
|
|
1319
|
-
y:
|
|
1318
|
+
x: n.x * s + a.x,
|
|
1319
|
+
y: n.y * s + a.y
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
|
-
const
|
|
1323
|
+
const Et = (r, e, t) => {
|
|
1324
1324
|
const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
|
|
1325
1325
|
return (t >= 0 ? o : s) + t;
|
|
1326
1326
|
};
|
|
1327
|
-
class
|
|
1327
|
+
class At {
|
|
1328
1328
|
constructor(e) {
|
|
1329
1329
|
i(this, "path");
|
|
1330
1330
|
i(this, "midpoint");
|
|
@@ -1332,54 +1332,54 @@ class xt {
|
|
|
1332
1332
|
hasSourceArrow: t,
|
|
1333
1333
|
hasTargetArrow: o,
|
|
1334
1334
|
arrowLength: s,
|
|
1335
|
-
from:
|
|
1336
|
-
to:
|
|
1335
|
+
from: n,
|
|
1336
|
+
to: a,
|
|
1337
1337
|
fromDir: h,
|
|
1338
1338
|
toDir: d,
|
|
1339
1339
|
arrowOffset: c,
|
|
1340
|
-
roundness:
|
|
1341
|
-
detourDistance:
|
|
1342
|
-
} = e, l = t ?
|
|
1343
|
-
{ x:
|
|
1340
|
+
roundness: u,
|
|
1341
|
+
detourDistance: g
|
|
1342
|
+
} = e, l = t ? m(
|
|
1343
|
+
{ x: n.x + s, y: n.y },
|
|
1344
1344
|
h,
|
|
1345
|
-
|
|
1346
|
-
) :
|
|
1345
|
+
n
|
|
1346
|
+
) : n, w = o ? m(
|
|
1347
1347
|
{
|
|
1348
|
-
x:
|
|
1349
|
-
y:
|
|
1348
|
+
x: a.x - s,
|
|
1349
|
+
y: a.y
|
|
1350
1350
|
},
|
|
1351
1351
|
d,
|
|
1352
|
-
n
|
|
1353
|
-
) : n, y = s + c, w = x(
|
|
1354
|
-
{ x: a.x + y, y: a.y },
|
|
1355
|
-
h,
|
|
1356
1352
|
a
|
|
1357
|
-
),
|
|
1358
|
-
{ x: n.x
|
|
1359
|
-
|
|
1353
|
+
) : a, p = s + c, y = m(
|
|
1354
|
+
{ x: n.x + p, y: n.y },
|
|
1355
|
+
h,
|
|
1360
1356
|
n
|
|
1361
|
-
),
|
|
1357
|
+
), f = m(
|
|
1358
|
+
{ x: a.x - p, y: a.y },
|
|
1359
|
+
d,
|
|
1360
|
+
a
|
|
1361
|
+
), x = Et(y, f, g);
|
|
1362
1362
|
this.midpoint = {
|
|
1363
|
-
x: (
|
|
1364
|
-
y:
|
|
1363
|
+
x: (y.x + f.x) / 2,
|
|
1364
|
+
y: x
|
|
1365
1365
|
}, this.path = R(
|
|
1366
1366
|
[
|
|
1367
1367
|
l,
|
|
1368
|
-
|
|
1369
|
-
{ x:
|
|
1370
|
-
{ x: f.x, y:
|
|
1368
|
+
y,
|
|
1369
|
+
{ x: y.x, y: x },
|
|
1370
|
+
{ x: f.x, y: x },
|
|
1371
1371
|
f,
|
|
1372
|
-
|
|
1372
|
+
w
|
|
1373
1373
|
],
|
|
1374
|
-
|
|
1374
|
+
u
|
|
1375
1375
|
);
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
const
|
|
1378
|
+
const St = (r, e, t) => {
|
|
1379
1379
|
const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
|
|
1380
1380
|
return (t >= 0 ? o : s) + t;
|
|
1381
1381
|
};
|
|
1382
|
-
class
|
|
1382
|
+
class Nt {
|
|
1383
1383
|
constructor(e) {
|
|
1384
1384
|
i(this, "path");
|
|
1385
1385
|
i(this, "midpoint");
|
|
@@ -1387,46 +1387,46 @@ class At {
|
|
|
1387
1387
|
hasSourceArrow: t,
|
|
1388
1388
|
hasTargetArrow: o,
|
|
1389
1389
|
arrowLength: s,
|
|
1390
|
-
fromDir:
|
|
1391
|
-
toDir:
|
|
1390
|
+
fromDir: n,
|
|
1391
|
+
toDir: a,
|
|
1392
1392
|
from: h,
|
|
1393
1393
|
to: d,
|
|
1394
1394
|
arrowOffset: c,
|
|
1395
|
-
detourDistance:
|
|
1396
|
-
roundness:
|
|
1397
|
-
} = e, l = t ?
|
|
1395
|
+
detourDistance: u,
|
|
1396
|
+
roundness: g
|
|
1397
|
+
} = e, l = t ? m(
|
|
1398
1398
|
{ x: h.x + s, y: h.y },
|
|
1399
|
-
|
|
1399
|
+
n,
|
|
1400
1400
|
h
|
|
1401
|
-
) : h,
|
|
1401
|
+
) : h, w = o ? m(
|
|
1402
1402
|
{
|
|
1403
1403
|
x: d.x - s,
|
|
1404
1404
|
y: d.y
|
|
1405
1405
|
},
|
|
1406
|
-
n,
|
|
1407
|
-
d
|
|
1408
|
-
) : d, y = s + c, w = x(
|
|
1409
|
-
{ x: h.x + y, y: h.y },
|
|
1410
1406
|
a,
|
|
1411
|
-
|
|
1412
|
-
),
|
|
1413
|
-
{ x:
|
|
1407
|
+
d
|
|
1408
|
+
) : d, p = s + c, y = m(
|
|
1409
|
+
{ x: h.x + p, y: h.y },
|
|
1414
1410
|
n,
|
|
1411
|
+
h
|
|
1412
|
+
), f = m(
|
|
1413
|
+
{ x: d.x - p, y: d.y },
|
|
1414
|
+
a,
|
|
1415
1415
|
d
|
|
1416
|
-
),
|
|
1416
|
+
), x = St(y, f, u);
|
|
1417
1417
|
this.midpoint = {
|
|
1418
|
-
x
|
|
1419
|
-
y: (
|
|
1418
|
+
x,
|
|
1419
|
+
y: (y.y + f.y) / 2
|
|
1420
1420
|
}, this.path = R(
|
|
1421
1421
|
[
|
|
1422
1422
|
l,
|
|
1423
|
-
|
|
1424
|
-
{ x
|
|
1425
|
-
{ x
|
|
1423
|
+
y,
|
|
1424
|
+
{ x, y: y.y },
|
|
1425
|
+
{ x, y: f.y },
|
|
1426
1426
|
f,
|
|
1427
|
-
|
|
1427
|
+
w
|
|
1428
1428
|
],
|
|
1429
|
-
|
|
1429
|
+
g
|
|
1430
1430
|
);
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
@@ -1452,8 +1452,8 @@ const v = Object.freeze({
|
|
|
1452
1452
|
curvature: 90,
|
|
1453
1453
|
interactiveWidth: 10,
|
|
1454
1454
|
preOffset: 0
|
|
1455
|
-
}),
|
|
1456
|
-
class
|
|
1455
|
+
}), me = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
|
|
1456
|
+
class G {
|
|
1457
1457
|
constructor(e) {
|
|
1458
1458
|
i(this, "svg");
|
|
1459
1459
|
i(this, "group", document.createElementNS(
|
|
@@ -1466,64 +1466,64 @@ class X {
|
|
|
1466
1466
|
i(this, "onAfterRender");
|
|
1467
1467
|
i(this, "afterRenderEmitter");
|
|
1468
1468
|
i(this, "arrowRenderer");
|
|
1469
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1469
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Re(e.color), this.svg.appendChild(this.group), this.line = Ve(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = H(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = H(), this.group.appendChild(this.targetArrow));
|
|
1470
1470
|
}
|
|
1471
1471
|
render(e) {
|
|
1472
|
-
const { x: t, y: o, width: s, height:
|
|
1472
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = Le(
|
|
1473
1473
|
e.from,
|
|
1474
1474
|
e.to,
|
|
1475
1475
|
this.params.padding
|
|
1476
1476
|
);
|
|
1477
|
-
|
|
1478
|
-
const d =
|
|
1479
|
-
let
|
|
1480
|
-
e.category ===
|
|
1481
|
-
const l =
|
|
1477
|
+
Fe(this.svg, { x: t, y: o, width: s, height: n });
|
|
1478
|
+
const d = me(e.from.direction), c = me(e.to.direction);
|
|
1479
|
+
let u = { x: -c.x, y: -c.y }, g;
|
|
1480
|
+
e.category === V.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === V.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
|
|
1481
|
+
const l = g(a, h, d, c);
|
|
1482
1482
|
this.line.setAttribute("d", l.path);
|
|
1483
|
-
let
|
|
1484
|
-
this.sourceArrow && (
|
|
1483
|
+
let w = null;
|
|
1484
|
+
this.sourceArrow && (w = this.arrowRenderer({
|
|
1485
1485
|
direction: d,
|
|
1486
|
-
shift:
|
|
1486
|
+
shift: a,
|
|
1487
1487
|
arrowLength: this.params.arrowLength
|
|
1488
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1489
|
-
let
|
|
1490
|
-
this.targetArrow && (
|
|
1491
|
-
direction:
|
|
1488
|
+
}), this.sourceArrow.setAttribute("d", w));
|
|
1489
|
+
let p = null;
|
|
1490
|
+
this.targetArrow && (p = this.arrowRenderer({
|
|
1491
|
+
direction: u,
|
|
1492
1492
|
shift: h,
|
|
1493
1493
|
arrowLength: this.params.arrowLength
|
|
1494
|
-
}), this.targetArrow.setAttribute("d",
|
|
1494
|
+
}), this.targetArrow.setAttribute("d", p)), this.afterRenderEmitter.emit({
|
|
1495
1495
|
edgePath: l,
|
|
1496
|
-
sourceArrowPath:
|
|
1497
|
-
targetArrowPath:
|
|
1496
|
+
sourceArrowPath: w,
|
|
1497
|
+
targetArrowPath: p
|
|
1498
1498
|
});
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
const
|
|
1501
|
+
const bt = (r) => (e) => {
|
|
1502
1502
|
const o = [
|
|
1503
1503
|
{ x: 0, y: 0 },
|
|
1504
1504
|
{ x: e.arrowLength, y: r.radius },
|
|
1505
1505
|
{ x: e.arrowLength, y: -r.radius }
|
|
1506
1506
|
].map(
|
|
1507
|
-
(h) =>
|
|
1507
|
+
(h) => m(h, e.direction, { x: 0, y: 0 })
|
|
1508
1508
|
).map((h) => ({
|
|
1509
1509
|
x: h.x + e.shift.x,
|
|
1510
1510
|
y: h.y + e.shift.y
|
|
1511
|
-
})), s = `M ${o[0].x} ${o[0].y}`,
|
|
1512
|
-
return `${s} ${
|
|
1513
|
-
},
|
|
1514
|
-
const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t),
|
|
1511
|
+
})), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
|
|
1512
|
+
return `${s} ${n} ${a} Z`;
|
|
1513
|
+
}, Pt = (r) => (e) => {
|
|
1514
|
+
const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
|
|
1515
1515
|
{ x: 0, y: 0 },
|
|
1516
|
-
{ x:
|
|
1517
|
-
{ x:
|
|
1516
|
+
{ x: a, y: -h },
|
|
1517
|
+
{ x: a, y: h }
|
|
1518
1518
|
].map(
|
|
1519
|
-
(
|
|
1520
|
-
).map((
|
|
1521
|
-
x:
|
|
1522
|
-
y:
|
|
1523
|
-
})),
|
|
1524
|
-
return `${
|
|
1525
|
-
},
|
|
1526
|
-
const t = r.smallRadius, o = r.radius, s =
|
|
1519
|
+
(p) => m(p, e.direction, { x: 0, y: 0 })
|
|
1520
|
+
).map((p) => ({
|
|
1521
|
+
x: p.x + e.shift.x,
|
|
1522
|
+
y: p.y + e.shift.y
|
|
1523
|
+
})), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1524
|
+
return `${u} ${g} ${l} ${w}`;
|
|
1525
|
+
}, Tt = (r) => (e) => {
|
|
1526
|
+
const t = r.smallRadius, o = r.radius, s = m(
|
|
1527
1527
|
{
|
|
1528
1528
|
x: e.arrowLength,
|
|
1529
1529
|
y: 0
|
|
@@ -1536,34 +1536,34 @@ const Et = (r) => (e) => {
|
|
|
1536
1536
|
x: e.arrowLength + r.smallRadius,
|
|
1537
1537
|
y: 0
|
|
1538
1538
|
}
|
|
1539
|
-
),
|
|
1540
|
-
(
|
|
1541
|
-
).map((
|
|
1542
|
-
x:
|
|
1543
|
-
y:
|
|
1544
|
-
})), h = `M ${
|
|
1545
|
-
return `${h} ${d} ${c} ${
|
|
1546
|
-
},
|
|
1539
|
+
), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
|
|
1540
|
+
(g) => m(g, e.direction, { x: 0, y: 0 })
|
|
1541
|
+
).map((g) => ({
|
|
1542
|
+
x: g.x + e.shift.x,
|
|
1543
|
+
y: g.y + e.shift.y
|
|
1544
|
+
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, u = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1545
|
+
return `${h} ${d} ${c} ${u}`;
|
|
1546
|
+
}, W = (r) => {
|
|
1547
1547
|
if (typeof r == "function")
|
|
1548
1548
|
return r;
|
|
1549
1549
|
switch (r.type) {
|
|
1550
1550
|
case "triangle":
|
|
1551
|
-
return
|
|
1551
|
+
return bt({
|
|
1552
1552
|
radius: r.radius ?? v.polygonArrowRadius
|
|
1553
1553
|
});
|
|
1554
1554
|
case "arc":
|
|
1555
|
-
return
|
|
1555
|
+
return Pt({
|
|
1556
1556
|
radius: r.radius ?? v.circleArrowRadius
|
|
1557
1557
|
});
|
|
1558
1558
|
default:
|
|
1559
|
-
return
|
|
1559
|
+
return Tt({
|
|
1560
1560
|
smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
|
|
1561
1561
|
angle: r.angle ?? v.wedgeArrowAngle,
|
|
1562
1562
|
radius: r.radius ?? v.wedgeArrowRadius
|
|
1563
1563
|
});
|
|
1564
1564
|
}
|
|
1565
1565
|
}, O = 50;
|
|
1566
|
-
class
|
|
1566
|
+
class Ct {
|
|
1567
1567
|
constructor(e) {
|
|
1568
1568
|
i(this, "svg");
|
|
1569
1569
|
i(this, "group");
|
|
@@ -1580,7 +1580,7 @@ class Nt {
|
|
|
1580
1580
|
i(this, "hasSourceArrow");
|
|
1581
1581
|
i(this, "hasTargetArrow");
|
|
1582
1582
|
i(this, "pathShape");
|
|
1583
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1583
|
+
i(this, "createCyclePath", (e, t, o) => new mt({
|
|
1584
1584
|
origin: e,
|
|
1585
1585
|
dir: o,
|
|
1586
1586
|
radius: this.portCycleRadius,
|
|
@@ -1588,7 +1588,7 @@ class Nt {
|
|
|
1588
1588
|
arrowLength: this.arrowLength,
|
|
1589
1589
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1590
1590
|
}));
|
|
1591
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1591
|
+
i(this, "createDetourPath", (e, t, o, s) => new ut({
|
|
1592
1592
|
from: e,
|
|
1593
1593
|
to: t,
|
|
1594
1594
|
fromDir: o,
|
|
@@ -1600,7 +1600,7 @@ class Nt {
|
|
|
1600
1600
|
hasSourceArrow: this.hasSourceArrow,
|
|
1601
1601
|
hasTargetArrow: this.hasTargetArrow
|
|
1602
1602
|
}));
|
|
1603
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1603
|
+
i(this, "createLinePath", (e, t, o, s) => new lt({
|
|
1604
1604
|
from: e,
|
|
1605
1605
|
to: t,
|
|
1606
1606
|
fromDir: o,
|
|
@@ -1610,10 +1610,10 @@ class Nt {
|
|
|
1610
1610
|
hasSourceArrow: this.hasSourceArrow,
|
|
1611
1611
|
hasTargetArrow: this.hasTargetArrow
|
|
1612
1612
|
}));
|
|
1613
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1613
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
|
|
1614
1614
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1615
1615
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1616
|
-
arrowRenderer:
|
|
1616
|
+
arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1617
1617
|
arrowLength: this.arrowLength,
|
|
1618
1618
|
hasSourceArrow: this.hasSourceArrow,
|
|
1619
1619
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1627,7 +1627,7 @@ class Nt {
|
|
|
1627
1627
|
this.pathShape.render(e);
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
|
-
class
|
|
1630
|
+
class Mt {
|
|
1631
1631
|
constructor(e) {
|
|
1632
1632
|
i(this, "svg");
|
|
1633
1633
|
i(this, "group");
|
|
@@ -1643,7 +1643,7 @@ class Pt {
|
|
|
1643
1643
|
i(this, "hasSourceArrow");
|
|
1644
1644
|
i(this, "hasTargetArrow");
|
|
1645
1645
|
i(this, "pathShape");
|
|
1646
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1646
|
+
i(this, "createCyclePath", (e, t, o) => new re({
|
|
1647
1647
|
origin: e,
|
|
1648
1648
|
dir: o,
|
|
1649
1649
|
arrowLength: this.arrowLength,
|
|
@@ -1652,7 +1652,7 @@ class Pt {
|
|
|
1652
1652
|
roundness: this.roundness,
|
|
1653
1653
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1654
1654
|
}));
|
|
1655
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1655
|
+
i(this, "createDetourPath", (e, t, o, s) => new At({
|
|
1656
1656
|
from: e,
|
|
1657
1657
|
to: t,
|
|
1658
1658
|
fromDir: o,
|
|
@@ -1664,7 +1664,7 @@ class Pt {
|
|
|
1664
1664
|
hasSourceArrow: this.hasSourceArrow,
|
|
1665
1665
|
hasTargetArrow: this.hasTargetArrow
|
|
1666
1666
|
}));
|
|
1667
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1667
|
+
i(this, "createLinePath", (e, t, o, s) => new pt({
|
|
1668
1668
|
from: e,
|
|
1669
1669
|
to: t,
|
|
1670
1670
|
fromDir: o,
|
|
@@ -1681,10 +1681,10 @@ class Pt {
|
|
|
1681
1681
|
t,
|
|
1682
1682
|
this.arrowOffset,
|
|
1683
1683
|
this.cycleSquareSide / 2
|
|
1684
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1684
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
|
|
1685
1685
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1686
1686
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1687
|
-
arrowRenderer:
|
|
1687
|
+
arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1688
1688
|
arrowLength: this.arrowLength,
|
|
1689
1689
|
hasSourceArrow: this.hasSourceArrow,
|
|
1690
1690
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1698,7 +1698,7 @@ class Pt {
|
|
|
1698
1698
|
this.pathShape.render(e);
|
|
1699
1699
|
}
|
|
1700
1700
|
}
|
|
1701
|
-
class
|
|
1701
|
+
class Dt {
|
|
1702
1702
|
constructor(e) {
|
|
1703
1703
|
i(this, "svg");
|
|
1704
1704
|
i(this, "group");
|
|
@@ -1715,7 +1715,7 @@ class Ct {
|
|
|
1715
1715
|
i(this, "hasSourceArrow");
|
|
1716
1716
|
i(this, "hasTargetArrow");
|
|
1717
1717
|
i(this, "pathShape");
|
|
1718
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1718
|
+
i(this, "createCyclePath", (e, t, o) => new re({
|
|
1719
1719
|
origin: e,
|
|
1720
1720
|
dir: o,
|
|
1721
1721
|
arrowLength: this.arrowLength,
|
|
@@ -1724,7 +1724,7 @@ class Ct {
|
|
|
1724
1724
|
roundness: this.roundness,
|
|
1725
1725
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1726
1726
|
}));
|
|
1727
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1727
|
+
i(this, "createDetourPath", (e, t, o, s) => new wt({
|
|
1728
1728
|
from: e,
|
|
1729
1729
|
to: t,
|
|
1730
1730
|
fromDir: o,
|
|
@@ -1737,7 +1737,7 @@ class Ct {
|
|
|
1737
1737
|
hasSourceArrow: this.hasSourceArrow,
|
|
1738
1738
|
hasTargetArrow: this.hasTargetArrow
|
|
1739
1739
|
}));
|
|
1740
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1740
|
+
i(this, "createLinePath", (e, t, o, s) => new yt({
|
|
1741
1741
|
from: e,
|
|
1742
1742
|
to: t,
|
|
1743
1743
|
fromDir: o,
|
|
@@ -1754,10 +1754,10 @@ class Ct {
|
|
|
1754
1754
|
t,
|
|
1755
1755
|
this.arrowOffset,
|
|
1756
1756
|
this.cycleSquareSide / 2
|
|
1757
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1757
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
|
|
1758
1758
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1759
1759
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1760
|
-
arrowRenderer:
|
|
1760
|
+
arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1761
1761
|
arrowLength: this.arrowLength,
|
|
1762
1762
|
hasSourceArrow: this.hasSourceArrow,
|
|
1763
1763
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1771,7 +1771,7 @@ class Ct {
|
|
|
1771
1771
|
this.pathShape.render(e);
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
|
-
class
|
|
1774
|
+
class Lt {
|
|
1775
1775
|
constructor(e) {
|
|
1776
1776
|
i(this, "svg");
|
|
1777
1777
|
i(this, "group");
|
|
@@ -1787,7 +1787,7 @@ class Tt {
|
|
|
1787
1787
|
i(this, "hasSourceArrow");
|
|
1788
1788
|
i(this, "hasTargetArrow");
|
|
1789
1789
|
i(this, "pathShape");
|
|
1790
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1790
|
+
i(this, "createCyclePath", (e, t, o) => new re({
|
|
1791
1791
|
origin: e,
|
|
1792
1792
|
dir: o,
|
|
1793
1793
|
arrowLength: this.arrowLength,
|
|
@@ -1796,7 +1796,7 @@ class Tt {
|
|
|
1796
1796
|
roundness: this.roundness,
|
|
1797
1797
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1798
1798
|
}));
|
|
1799
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1799
|
+
i(this, "createDetourPath", (e, t, o, s) => new Nt({
|
|
1800
1800
|
from: e,
|
|
1801
1801
|
to: t,
|
|
1802
1802
|
fromDir: o,
|
|
@@ -1808,7 +1808,7 @@ class Tt {
|
|
|
1808
1808
|
hasSourceArrow: this.hasSourceArrow,
|
|
1809
1809
|
hasTargetArrow: this.hasTargetArrow
|
|
1810
1810
|
}));
|
|
1811
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1811
|
+
i(this, "createLinePath", (e, t, o, s) => new vt({
|
|
1812
1812
|
from: e,
|
|
1813
1813
|
to: t,
|
|
1814
1814
|
fromDir: o,
|
|
@@ -1825,10 +1825,10 @@ class Tt {
|
|
|
1825
1825
|
t,
|
|
1826
1826
|
this.arrowOffset,
|
|
1827
1827
|
this.cycleSquareSide / 2
|
|
1828
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1828
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
|
|
1829
1829
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1830
1830
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1831
|
-
arrowRenderer:
|
|
1831
|
+
arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1832
1832
|
arrowLength: this.arrowLength,
|
|
1833
1833
|
hasSourceArrow: this.hasSourceArrow,
|
|
1834
1834
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1842,7 +1842,7 @@ class Tt {
|
|
|
1842
1842
|
this.pathShape.render(e);
|
|
1843
1843
|
}
|
|
1844
1844
|
}
|
|
1845
|
-
class
|
|
1845
|
+
class Ie {
|
|
1846
1846
|
constructor(e) {
|
|
1847
1847
|
i(this, "svg");
|
|
1848
1848
|
i(this, "group", document.createElementNS(
|
|
@@ -1860,17 +1860,17 @@ class Le {
|
|
|
1860
1860
|
i(this, "onAfterRender");
|
|
1861
1861
|
i(this, "afterRenderEmitter");
|
|
1862
1862
|
i(this, "arrowRenderer");
|
|
1863
|
-
[this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer =
|
|
1863
|
+
[this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = W((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Re(this.color), this.svg.appendChild(this.group), this.line = Ve(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = H(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = H(), this.group.appendChild(this.targetArrow));
|
|
1864
1864
|
}
|
|
1865
1865
|
render(e) {
|
|
1866
|
-
const { x: t, y: o, width: s, height:
|
|
1866
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = Le(
|
|
1867
1867
|
e.from,
|
|
1868
1868
|
e.to,
|
|
1869
1869
|
O
|
|
1870
1870
|
);
|
|
1871
|
-
|
|
1872
|
-
const d = new
|
|
1873
|
-
from:
|
|
1871
|
+
Fe(this.svg, { x: t, y: o, width: s, height: n });
|
|
1872
|
+
const d = new xt({
|
|
1873
|
+
from: a,
|
|
1874
1874
|
to: h,
|
|
1875
1875
|
sourceOffset: this.sourceOffset,
|
|
1876
1876
|
targetOffset: this.targetOffset,
|
|
@@ -1879,82 +1879,82 @@ class Le {
|
|
|
1879
1879
|
arrowLength: this.arrowLength
|
|
1880
1880
|
});
|
|
1881
1881
|
this.line.setAttribute("d", d.path);
|
|
1882
|
-
let c = null,
|
|
1883
|
-
const
|
|
1884
|
-
if (
|
|
1885
|
-
this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (
|
|
1882
|
+
let c = null, u = null;
|
|
1883
|
+
const g = d.diagonalDistance;
|
|
1884
|
+
if (g === 0)
|
|
1885
|
+
this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (u = "", this.targetArrow.setAttribute("d", u));
|
|
1886
1886
|
else {
|
|
1887
1887
|
const l = {
|
|
1888
|
-
x: (h.x -
|
|
1889
|
-
y: (h.y -
|
|
1888
|
+
x: (h.x - a.x) / g,
|
|
1889
|
+
y: (h.y - a.y) / g
|
|
1890
1890
|
};
|
|
1891
1891
|
if (this.sourceArrow) {
|
|
1892
|
-
const
|
|
1892
|
+
const w = {
|
|
1893
1893
|
x: l.x * this.sourceOffset,
|
|
1894
1894
|
y: l.y * this.sourceOffset
|
|
1895
1895
|
};
|
|
1896
1896
|
c = this.arrowRenderer({
|
|
1897
1897
|
direction: l,
|
|
1898
|
-
shift:
|
|
1898
|
+
shift: w,
|
|
1899
1899
|
arrowLength: this.arrowLength
|
|
1900
1900
|
}), this.sourceArrow.setAttribute("d", c);
|
|
1901
1901
|
}
|
|
1902
1902
|
if (this.targetArrow) {
|
|
1903
|
-
const
|
|
1903
|
+
const w = {
|
|
1904
1904
|
x: l.x * this.targetOffset,
|
|
1905
1905
|
y: l.y * this.targetOffset
|
|
1906
1906
|
};
|
|
1907
|
-
|
|
1907
|
+
u = this.arrowRenderer({
|
|
1908
1908
|
direction: { x: -l.x, y: -l.y },
|
|
1909
1909
|
shift: {
|
|
1910
|
-
x: h.x -
|
|
1911
|
-
y: h.y -
|
|
1910
|
+
x: h.x - w.x,
|
|
1911
|
+
y: h.y - w.y
|
|
1912
1912
|
},
|
|
1913
1913
|
arrowLength: this.arrowLength
|
|
1914
|
-
}), this.targetArrow.setAttribute("d",
|
|
1914
|
+
}), this.targetArrow.setAttribute("d", u);
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
1917
|
this.afterRenderEmitter.emit({
|
|
1918
1918
|
edgePath: d,
|
|
1919
1919
|
sourceArrowPath: c,
|
|
1920
|
-
targetArrowPath:
|
|
1920
|
+
targetArrowPath: u
|
|
1921
1921
|
});
|
|
1922
1922
|
}
|
|
1923
1923
|
}
|
|
1924
|
-
const
|
|
1924
|
+
const Rt = () => {
|
|
1925
1925
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1926
1926
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1927
|
-
},
|
|
1927
|
+
}, Vt = (r) => {
|
|
1928
1928
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1929
1929
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1930
|
-
},
|
|
1930
|
+
}, xe = (r) => {
|
|
1931
1931
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1932
1932
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1933
1933
|
};
|
|
1934
|
-
class
|
|
1934
|
+
class Ft extends Error {
|
|
1935
1935
|
constructor(e) {
|
|
1936
1936
|
super(e), this.name = "InteractiveEdgeError";
|
|
1937
1937
|
}
|
|
1938
1938
|
}
|
|
1939
|
-
class
|
|
1939
|
+
class Ue {
|
|
1940
1940
|
constructor(e, t) {
|
|
1941
1941
|
i(this, "svg");
|
|
1942
1942
|
i(this, "group");
|
|
1943
1943
|
i(this, "line");
|
|
1944
1944
|
i(this, "sourceArrow");
|
|
1945
1945
|
i(this, "targetArrow");
|
|
1946
|
-
i(this, "handle",
|
|
1946
|
+
i(this, "handle", Rt());
|
|
1947
1947
|
i(this, "onAfterRender");
|
|
1948
1948
|
i(this, "interactiveLine");
|
|
1949
1949
|
i(this, "interactiveSourceArrow", null);
|
|
1950
1950
|
i(this, "interactiveTargetArrow", null);
|
|
1951
|
-
if (this.baseEdge = e, e instanceof
|
|
1952
|
-
throw new
|
|
1951
|
+
if (this.baseEdge = e, e instanceof Ue)
|
|
1952
|
+
throw new Ft(
|
|
1953
1953
|
"interactive edge can be configured only once"
|
|
1954
1954
|
);
|
|
1955
1955
|
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;
|
|
1956
1956
|
const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
|
|
1957
|
-
this.interactiveLine =
|
|
1957
|
+
this.interactiveLine = Vt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = xe(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = xe(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
|
|
1958
1958
|
this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
|
|
1959
1959
|
});
|
|
1960
1960
|
}
|
|
@@ -1962,7 +1962,7 @@ class Fe {
|
|
|
1962
1962
|
this.baseEdge.render(e);
|
|
1963
1963
|
}
|
|
1964
1964
|
}
|
|
1965
|
-
class
|
|
1965
|
+
class Fr {
|
|
1966
1966
|
constructor(e, t) {
|
|
1967
1967
|
i(this, "group");
|
|
1968
1968
|
i(this, "line");
|
|
@@ -1971,15 +1971,15 @@ class Mr {
|
|
|
1971
1971
|
i(this, "onAfterRender");
|
|
1972
1972
|
i(this, "svg");
|
|
1973
1973
|
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((o) => {
|
|
1974
|
-
const s = o.edgePath.midpoint,
|
|
1975
|
-
this.midpointElement.style.setProperty("transform",
|
|
1974
|
+
const s = o.edgePath.midpoint, n = `translate(${s.x}px, ${s.y}px)`;
|
|
1975
|
+
this.midpointElement.style.setProperty("transform", n);
|
|
1976
1976
|
});
|
|
1977
1977
|
}
|
|
1978
1978
|
render(e) {
|
|
1979
1979
|
this.baseShape.render(e);
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
class
|
|
1982
|
+
class $e {
|
|
1983
1983
|
constructor(e) {
|
|
1984
1984
|
i(this, "onAfterNodeAdded");
|
|
1985
1985
|
i(this, "onAfterNodeUpdated");
|
|
@@ -2075,7 +2075,7 @@ class Ie {
|
|
|
2075
2075
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2076
2076
|
}
|
|
2077
2077
|
}
|
|
2078
|
-
class
|
|
2078
|
+
class K {
|
|
2079
2079
|
constructor(e) {
|
|
2080
2080
|
i(this, "counter", 0);
|
|
2081
2081
|
this.checkExists = e;
|
|
@@ -2091,15 +2091,15 @@ class J {
|
|
|
2091
2091
|
this.counter = 0;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
class
|
|
2094
|
+
class Be {
|
|
2095
2095
|
constructor(e, t, o) {
|
|
2096
|
-
i(this, "nodeIdGenerator", new
|
|
2096
|
+
i(this, "nodeIdGenerator", new K(
|
|
2097
2097
|
(e) => this.graphStore.hasNode(e)
|
|
2098
2098
|
));
|
|
2099
|
-
i(this, "portIdGenerator", new
|
|
2099
|
+
i(this, "portIdGenerator", new K(
|
|
2100
2100
|
(e) => this.graphStore.hasPort(e)
|
|
2101
2101
|
));
|
|
2102
|
-
i(this, "edgeIdGenerator", new
|
|
2102
|
+
i(this, "edgeIdGenerator", new K(
|
|
2103
2103
|
(e) => this.graphStore.hasEdge(e)
|
|
2104
2104
|
));
|
|
2105
2105
|
i(this, "onAfterNodeAdded", (e) => {
|
|
@@ -2222,18 +2222,18 @@ class Ve {
|
|
|
2222
2222
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
const
|
|
2225
|
+
const It = (r) => {
|
|
2226
2226
|
setTimeout(() => {
|
|
2227
2227
|
r();
|
|
2228
2228
|
});
|
|
2229
|
-
},
|
|
2229
|
+
}, Ut = (r) => {
|
|
2230
2230
|
queueMicrotask(() => {
|
|
2231
2231
|
r();
|
|
2232
2232
|
});
|
|
2233
|
-
},
|
|
2233
|
+
}, oe = (r) => {
|
|
2234
2234
|
r();
|
|
2235
2235
|
};
|
|
2236
|
-
class
|
|
2236
|
+
class We {
|
|
2237
2237
|
constructor(e) {
|
|
2238
2238
|
i(this, "onBeforeUpdated");
|
|
2239
2239
|
i(this, "onAfterUpdated");
|
|
@@ -2256,7 +2256,7 @@ class $e {
|
|
|
2256
2256
|
return this.viewportStore.createViewportCoords(e);
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
|
-
const
|
|
2259
|
+
const $t = (r, e) => Symbol.iterator in r ? {
|
|
2260
2260
|
minContentScale: e.focus.minContentScale,
|
|
2261
2261
|
nodes: r,
|
|
2262
2262
|
contentPadding: e.focus.contentPadding,
|
|
@@ -2266,16 +2266,16 @@ const It = (r, e) => Symbol.iterator in r ? {
|
|
|
2266
2266
|
nodes: r.nodes ?? [],
|
|
2267
2267
|
contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
|
|
2268
2268
|
animationDuration: r.animationDuration ?? e.focus.animationDuration
|
|
2269
|
-
},
|
|
2269
|
+
}, Oe = (r, e, t) => ({
|
|
2270
2270
|
scale: r.scale,
|
|
2271
2271
|
x: r.x + r.scale * e,
|
|
2272
2272
|
y: r.y + r.scale * t
|
|
2273
|
-
}),
|
|
2273
|
+
}), ze = (r, e, t, o) => ({
|
|
2274
2274
|
scale: r.scale * e,
|
|
2275
2275
|
x: r.scale * (1 - e) * t + r.x,
|
|
2276
2276
|
y: r.scale * (1 - e) * o + r.y
|
|
2277
2277
|
});
|
|
2278
|
-
class
|
|
2278
|
+
class ke {
|
|
2279
2279
|
constructor(e, t, o, s) {
|
|
2280
2280
|
this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
|
|
2281
2281
|
}
|
|
@@ -2286,23 +2286,23 @@ class Oe {
|
|
|
2286
2286
|
this.viewportStore.patchContentMatrix(e);
|
|
2287
2287
|
}
|
|
2288
2288
|
center(e, t) {
|
|
2289
|
-
const { width: o, height: s } = this.viewportStore.getDimensions(),
|
|
2290
|
-
let
|
|
2291
|
-
const
|
|
2292
|
-
if (
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2289
|
+
const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
|
|
2290
|
+
let u = Oe(a, d, c);
|
|
2291
|
+
const g = t == null ? void 0 : t.contentScale;
|
|
2292
|
+
if (g !== void 0) {
|
|
2293
|
+
const w = 1 / g;
|
|
2294
|
+
u = ze(
|
|
2295
|
+
u,
|
|
2296
|
+
w / a.scale,
|
|
2297
|
+
n.x,
|
|
2298
|
+
n.y
|
|
2299
2299
|
);
|
|
2300
2300
|
}
|
|
2301
2301
|
const l = (t == null ? void 0 : t.animationDuration) ?? 0;
|
|
2302
|
-
l > 0 ? this.animateNavigation(
|
|
2302
|
+
l > 0 ? this.animateNavigation(a, u, l) : this.viewportStore.patchViewportMatrix(u);
|
|
2303
2303
|
}
|
|
2304
2304
|
focus(e) {
|
|
2305
|
-
const t =
|
|
2305
|
+
const t = $t(e ?? {}, this.params);
|
|
2306
2306
|
this.params.focus.schedule(() => {
|
|
2307
2307
|
this.navigate(t);
|
|
2308
2308
|
});
|
|
@@ -2311,22 +2311,22 @@ class Oe {
|
|
|
2311
2311
|
this.viewportStore.destroy();
|
|
2312
2312
|
}
|
|
2313
2313
|
navigate(e) {
|
|
2314
|
-
let t = 1 / 0, o = -1 / 0, s = 1 / 0,
|
|
2314
|
+
let t = 1 / 0, o = -1 / 0, s = 1 / 0, n = -1 / 0, a = 0;
|
|
2315
2315
|
const h = /* @__PURE__ */ new Set();
|
|
2316
2316
|
for (const d of e.nodes)
|
|
2317
2317
|
h.add(d);
|
|
2318
2318
|
if (this.graphStore.getAllNodeIds().forEach((d) => {
|
|
2319
2319
|
const { payload: c } = this.graphStore.getNode(d);
|
|
2320
|
-
c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s),
|
|
2321
|
-
}),
|
|
2322
|
-
t -= e.contentPadding, s -= e.contentPadding, o += e.contentPadding,
|
|
2320
|
+
c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), n = Math.max(c.y, n), a++);
|
|
2321
|
+
}), a > 0) {
|
|
2322
|
+
t -= e.contentPadding, s -= e.contentPadding, o += e.contentPadding, n += e.contentPadding;
|
|
2323
2323
|
const d = {
|
|
2324
2324
|
x: (t + o) / 2,
|
|
2325
|
-
y: (s +
|
|
2326
|
-
}, { scale: c } = this.viewportStore.getContentMatrix(),
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
),
|
|
2325
|
+
y: (s + n) / 2
|
|
2326
|
+
}, { scale: c } = this.viewportStore.getContentMatrix(), u = (n - s) * c, g = (o - t) * c, { width: l, height: w } = this.viewportStore.getDimensions(), p = Math.max(
|
|
2327
|
+
g / l,
|
|
2328
|
+
u / w
|
|
2329
|
+
), y = p > 1 ? c / p : c, f = Math.max(y, e.minContentScale);
|
|
2330
2330
|
this.center(d, {
|
|
2331
2331
|
contentScale: f,
|
|
2332
2332
|
animationDuration: e.animationDuration
|
|
@@ -2335,55 +2335,55 @@ class Oe {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
animateNavigation(e, t, o) {
|
|
2337
2337
|
let s;
|
|
2338
|
-
const
|
|
2338
|
+
const n = {
|
|
2339
2339
|
scale: t.scale - e.scale,
|
|
2340
2340
|
x: t.x - e.x,
|
|
2341
2341
|
y: t.y - e.y
|
|
2342
|
-
},
|
|
2342
|
+
}, a = (h) => {
|
|
2343
2343
|
s === void 0 && (s = h);
|
|
2344
2344
|
const d = Math.min((h - s) / o, 1);
|
|
2345
2345
|
d <= 1 && this.viewportStore.patchViewportMatrix({
|
|
2346
|
-
scale: e.scale + d *
|
|
2347
|
-
x: e.x + d *
|
|
2348
|
-
y: e.y + d *
|
|
2349
|
-
}), d < 1 && this.win.requestAnimationFrame(
|
|
2346
|
+
scale: e.scale + d * n.scale,
|
|
2347
|
+
x: e.x + d * n.x,
|
|
2348
|
+
y: e.y + d * n.y
|
|
2349
|
+
}), d < 1 && this.win.requestAnimationFrame(a);
|
|
2350
2350
|
};
|
|
2351
|
-
this.win.requestAnimationFrame(
|
|
2351
|
+
this.win.requestAnimationFrame(a);
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
|
-
const
|
|
2355
|
-
const o = new
|
|
2354
|
+
const Ye = (r, e, t) => {
|
|
2355
|
+
const o = new Te(), s = new $e(o), n = new We(e), a = new be(o, e, r), h = {
|
|
2356
2356
|
nodes: {
|
|
2357
|
-
centerFn:
|
|
2357
|
+
centerFn: De,
|
|
2358
2358
|
priorityFn: () => 0
|
|
2359
2359
|
},
|
|
2360
2360
|
edges: {
|
|
2361
|
-
shapeFactory: () => new
|
|
2361
|
+
shapeFactory: () => new Ie(),
|
|
2362
2362
|
priorityFn: () => 0
|
|
2363
2363
|
},
|
|
2364
2364
|
ports: {
|
|
2365
2365
|
direction: 0
|
|
2366
2366
|
}
|
|
2367
|
-
}, d = new
|
|
2367
|
+
}, d = new Be(
|
|
2368
2368
|
o,
|
|
2369
|
-
|
|
2369
|
+
a,
|
|
2370
2370
|
h
|
|
2371
2371
|
), c = {
|
|
2372
2372
|
focus: {
|
|
2373
2373
|
contentPadding: 0,
|
|
2374
2374
|
minContentScale: 0,
|
|
2375
|
-
schedule:
|
|
2375
|
+
schedule: oe,
|
|
2376
2376
|
animationDuration: 0
|
|
2377
2377
|
}
|
|
2378
|
-
},
|
|
2378
|
+
}, u = new ke(
|
|
2379
2379
|
o,
|
|
2380
2380
|
e,
|
|
2381
2381
|
c,
|
|
2382
2382
|
t
|
|
2383
2383
|
);
|
|
2384
|
-
return new
|
|
2384
|
+
return new Pe(s, n, d, u);
|
|
2385
2385
|
};
|
|
2386
|
-
class
|
|
2386
|
+
class j {
|
|
2387
2387
|
constructor(e, t, o, s) {
|
|
2388
2388
|
i(this, "onAfterPortMarked", (e) => {
|
|
2389
2389
|
const t = this.canvas.graph.getPort(e);
|
|
@@ -2408,7 +2408,7 @@ class G {
|
|
|
2408
2408
|
}));
|
|
2409
2409
|
});
|
|
2410
2410
|
i(this, "onWindowMouseMove", (e) => {
|
|
2411
|
-
if (!
|
|
2411
|
+
if (!D(
|
|
2412
2412
|
this.window,
|
|
2413
2413
|
this.element,
|
|
2414
2414
|
e.clientX,
|
|
@@ -2426,8 +2426,8 @@ class G {
|
|
|
2426
2426
|
const t = e;
|
|
2427
2427
|
if (t.touches.length !== 1)
|
|
2428
2428
|
return;
|
|
2429
|
-
const o = t.touches[0], s = e.currentTarget,
|
|
2430
|
-
this.params.onPortPointerDown(
|
|
2429
|
+
const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(s)[0];
|
|
2430
|
+
this.params.onPortPointerDown(n, {
|
|
2431
2431
|
x: o.clientX,
|
|
2432
2432
|
y: o.clientY
|
|
2433
2433
|
}) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
@@ -2440,7 +2440,7 @@ class G {
|
|
|
2440
2440
|
});
|
|
2441
2441
|
i(this, "onWindowTouchMove", (e) => {
|
|
2442
2442
|
const t = e.touches[0];
|
|
2443
|
-
if (!
|
|
2443
|
+
if (!D(
|
|
2444
2444
|
this.window,
|
|
2445
2445
|
this.element,
|
|
2446
2446
|
t.clientX,
|
|
@@ -2467,7 +2467,7 @@ class G {
|
|
|
2467
2467
|
this.canvas = e, this.element = t, this.window = o, this.params = s, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2468
2468
|
}
|
|
2469
2469
|
static configure(e, t, o, s) {
|
|
2470
|
-
new
|
|
2470
|
+
new j(e, t, o, s);
|
|
2471
2471
|
}
|
|
2472
2472
|
hookPortEvents(e) {
|
|
2473
2473
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2492,7 +2492,7 @@ class G {
|
|
|
2492
2492
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2493
2493
|
}
|
|
2494
2494
|
}
|
|
2495
|
-
class
|
|
2495
|
+
class Bt {
|
|
2496
2496
|
constructor(e, t, o) {
|
|
2497
2497
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
2498
2498
|
}
|
|
@@ -2506,7 +2506,7 @@ class Vt {
|
|
|
2506
2506
|
}), this.params.onAfterApplied();
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
|
-
class
|
|
2509
|
+
class Wt {
|
|
2510
2510
|
constructor(e, t, o) {
|
|
2511
2511
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
2512
2512
|
}
|
|
@@ -2521,7 +2521,7 @@ class $t {
|
|
|
2521
2521
|
}), this.params.onAfterApplied();
|
|
2522
2522
|
}
|
|
2523
2523
|
}
|
|
2524
|
-
class
|
|
2524
|
+
class se {
|
|
2525
2525
|
constructor(e, t, o, s) {
|
|
2526
2526
|
i(this, "grabbedNode", null);
|
|
2527
2527
|
i(this, "maxNodePriority", 0);
|
|
@@ -2546,7 +2546,7 @@ class oe {
|
|
|
2546
2546
|
const t = e;
|
|
2547
2547
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2548
2548
|
return;
|
|
2549
|
-
const o = e.currentTarget, s = this.graph.findNodeIdByElement(o),
|
|
2549
|
+
const o = e.currentTarget, s = this.graph.findNodeIdByElement(o), n = this.graph.getNode(s);
|
|
2550
2550
|
if (!this.params.nodeDragVerifier(s))
|
|
2551
2551
|
return;
|
|
2552
2552
|
this.params.onNodeDragStarted(s), e.stopPropagation();
|
|
@@ -2556,9 +2556,9 @@ class oe {
|
|
|
2556
2556
|
});
|
|
2557
2557
|
this.grabbedNode = {
|
|
2558
2558
|
nodeId: s,
|
|
2559
|
-
dx: h.x -
|
|
2560
|
-
dy: h.y -
|
|
2561
|
-
},
|
|
2559
|
+
dx: h.x - n.x,
|
|
2560
|
+
dy: h.y - n.y
|
|
2561
|
+
}, Y(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2562
2562
|
passive: !0
|
|
2563
2563
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2564
2564
|
passive: !0
|
|
@@ -2569,12 +2569,12 @@ class oe {
|
|
|
2569
2569
|
if (t.touches.length !== 1)
|
|
2570
2570
|
return;
|
|
2571
2571
|
e.stopPropagation();
|
|
2572
|
-
const o = t.touches[0], s = e.currentTarget,
|
|
2572
|
+
const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(s), a = this.graph.getNode(n);
|
|
2573
2573
|
if (!this.params.nodeDragVerifier({
|
|
2574
|
-
nodeId:
|
|
2575
|
-
element:
|
|
2576
|
-
x:
|
|
2577
|
-
y:
|
|
2574
|
+
nodeId: n,
|
|
2575
|
+
element: a.element,
|
|
2576
|
+
x: a.x,
|
|
2577
|
+
y: a.y
|
|
2578
2578
|
}))
|
|
2579
2579
|
return;
|
|
2580
2580
|
const d = this.calculateContentPoint({
|
|
@@ -2582,10 +2582,10 @@ class oe {
|
|
|
2582
2582
|
y: o.clientY
|
|
2583
2583
|
});
|
|
2584
2584
|
this.grabbedNode = {
|
|
2585
|
-
nodeId:
|
|
2586
|
-
dx: d.x -
|
|
2587
|
-
dy: d.y -
|
|
2588
|
-
}, this.moveNodeOnTop(
|
|
2585
|
+
nodeId: n,
|
|
2586
|
+
dx: d.x - a.x,
|
|
2587
|
+
dy: d.y - a.y
|
|
2588
|
+
}, this.moveNodeOnTop(n), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2589
2589
|
passive: !0
|
|
2590
2590
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2591
2591
|
passive: !0
|
|
@@ -2594,13 +2594,13 @@ class oe {
|
|
|
2594
2594
|
});
|
|
2595
2595
|
});
|
|
2596
2596
|
i(this, "onWindowMouseMove", (e) => {
|
|
2597
|
-
if (!
|
|
2597
|
+
if (!D(
|
|
2598
2598
|
this.window,
|
|
2599
2599
|
this.element,
|
|
2600
2600
|
e.clientX,
|
|
2601
2601
|
e.clientY
|
|
2602
2602
|
)) {
|
|
2603
|
-
this.
|
|
2603
|
+
this.stopMouseDrag();
|
|
2604
2604
|
return;
|
|
2605
2605
|
}
|
|
2606
2606
|
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
@@ -2609,19 +2609,19 @@ class oe {
|
|
|
2609
2609
|
});
|
|
2610
2610
|
});
|
|
2611
2611
|
i(this, "onWindowMouseUp", (e) => {
|
|
2612
|
-
this.params.mouseUpEventVerifier(e) && this.
|
|
2612
|
+
this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
|
|
2613
2613
|
});
|
|
2614
2614
|
i(this, "onWindowTouchMove", (e) => {
|
|
2615
2615
|
if (e.touches.length !== 1)
|
|
2616
2616
|
return;
|
|
2617
2617
|
const t = e.touches[0];
|
|
2618
|
-
if (!
|
|
2618
|
+
if (!D(
|
|
2619
2619
|
this.window,
|
|
2620
2620
|
this.element,
|
|
2621
2621
|
t.clientX,
|
|
2622
2622
|
t.clientY
|
|
2623
2623
|
)) {
|
|
2624
|
-
this.
|
|
2624
|
+
this.stopTouchDrag();
|
|
2625
2625
|
return;
|
|
2626
2626
|
}
|
|
2627
2627
|
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
@@ -2630,7 +2630,7 @@ class oe {
|
|
|
2630
2630
|
});
|
|
2631
2631
|
});
|
|
2632
2632
|
i(this, "onWindowTouchFinish", () => {
|
|
2633
|
-
this.
|
|
2633
|
+
this.stopTouchDrag();
|
|
2634
2634
|
});
|
|
2635
2635
|
i(this, "reset", () => {
|
|
2636
2636
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
@@ -2644,7 +2644,7 @@ class oe {
|
|
|
2644
2644
|
this.canvas = e, this.element = t, this.window = o, this.params = s, 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.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2645
2645
|
}
|
|
2646
2646
|
static configure(e, t, o, s) {
|
|
2647
|
-
new
|
|
2647
|
+
new se(e, t, o, s);
|
|
2648
2648
|
}
|
|
2649
2649
|
moveNode(e, t) {
|
|
2650
2650
|
if (!this.graph.hasNode(e.nodeId))
|
|
@@ -2652,10 +2652,10 @@ class oe {
|
|
|
2652
2652
|
const o = this.calculateContentPoint(t), s = {
|
|
2653
2653
|
x: o.x - e.dx,
|
|
2654
2654
|
y: o.y - e.dy
|
|
2655
|
-
},
|
|
2655
|
+
}, n = this.adjustNodeCoords(s);
|
|
2656
2656
|
this.canvas.updateNode(e.nodeId, {
|
|
2657
|
-
x:
|
|
2658
|
-
y:
|
|
2657
|
+
x: n.x,
|
|
2658
|
+
y: n.y
|
|
2659
2659
|
}), this.params.onNodeDrag(e.nodeId);
|
|
2660
2660
|
}
|
|
2661
2661
|
moveNodeOnTop(e) {
|
|
@@ -2669,13 +2669,13 @@ class oe {
|
|
|
2669
2669
|
this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
2670
2670
|
}
|
|
2671
2671
|
}
|
|
2672
|
-
|
|
2673
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2672
|
+
stopMouseDrag() {
|
|
2673
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, Y(this.element, null), this.removeMouseDragListeners();
|
|
2674
2674
|
}
|
|
2675
2675
|
removeMouseDragListeners() {
|
|
2676
2676
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
2677
2677
|
}
|
|
2678
|
-
|
|
2678
|
+
stopTouchDrag() {
|
|
2679
2679
|
if (this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId)) {
|
|
2680
2680
|
const e = this.graph.getNode(this.grabbedNode.nodeId);
|
|
2681
2681
|
this.params.onNodeDragFinished({
|
|
@@ -2713,26 +2713,26 @@ class oe {
|
|
|
2713
2713
|
return e;
|
|
2714
2714
|
}
|
|
2715
2715
|
}
|
|
2716
|
-
const
|
|
2716
|
+
const z = (r) => {
|
|
2717
2717
|
const e = [], t = r.touches.length;
|
|
2718
2718
|
for (let h = 0; h < t; h++)
|
|
2719
2719
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2720
2720
|
const o = e.reduce(
|
|
2721
2721
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2722
2722
|
[0, 0]
|
|
2723
|
-
), s = [o[0] / t, o[1] / t],
|
|
2723
|
+
), s = [o[0] / t, o[1] / t], a = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
|
|
2724
2724
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2725
2725
|
0
|
|
2726
2726
|
);
|
|
2727
2727
|
return {
|
|
2728
2728
|
x: s[0],
|
|
2729
2729
|
y: s[1],
|
|
2730
|
-
scale:
|
|
2730
|
+
scale: a / t,
|
|
2731
2731
|
touchesCnt: t,
|
|
2732
2732
|
touches: e
|
|
2733
2733
|
};
|
|
2734
2734
|
};
|
|
2735
|
-
class
|
|
2735
|
+
class J {
|
|
2736
2736
|
constructor(e, t, o, s) {
|
|
2737
2737
|
i(this, "viewport");
|
|
2738
2738
|
i(this, "prevTouches", null);
|
|
@@ -2742,14 +2742,14 @@ class j {
|
|
|
2742
2742
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2743
2743
|
});
|
|
2744
2744
|
i(this, "onMouseDown", (e) => {
|
|
2745
|
-
this.params.mouseDownEventVerifier(e) && (
|
|
2745
|
+
this.params.mouseDownEventVerifier(e) && (Y(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2746
2746
|
passive: !0
|
|
2747
2747
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2748
2748
|
passive: !0
|
|
2749
2749
|
}), this.startRegisteredTransform());
|
|
2750
2750
|
});
|
|
2751
2751
|
i(this, "onWindowMouseMove", (e) => {
|
|
2752
|
-
const t =
|
|
2752
|
+
const t = D(
|
|
2753
2753
|
this.window,
|
|
2754
2754
|
this.element,
|
|
2755
2755
|
e.clientX,
|
|
@@ -2768,17 +2768,17 @@ class j {
|
|
|
2768
2768
|
i(this, "onWheelScroll", (e) => {
|
|
2769
2769
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2770
2770
|
return;
|
|
2771
|
-
const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t,
|
|
2772
|
-
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s,
|
|
2771
|
+
const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, n = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
|
|
2772
|
+
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2773
2773
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2774
2774
|
}, this.params.scaleWheelFinishTimeout);
|
|
2775
2775
|
});
|
|
2776
2776
|
i(this, "onTouchStart", (e) => {
|
|
2777
2777
|
if (this.prevTouches !== null) {
|
|
2778
|
-
this.prevTouches =
|
|
2778
|
+
this.prevTouches = z(e);
|
|
2779
2779
|
return;
|
|
2780
2780
|
}
|
|
2781
|
-
this.prevTouches =
|
|
2781
|
+
this.prevTouches = z(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2782
2782
|
passive: !0
|
|
2783
2783
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2784
2784
|
passive: !0
|
|
@@ -2787,9 +2787,9 @@ class j {
|
|
|
2787
2787
|
}), this.startRegisteredTransform();
|
|
2788
2788
|
});
|
|
2789
2789
|
i(this, "onWindowTouchMove", (e) => {
|
|
2790
|
-
const t =
|
|
2790
|
+
const t = z(e);
|
|
2791
2791
|
if (!t.touches.every(
|
|
2792
|
-
(s) =>
|
|
2792
|
+
(s) => D(this.window, this.element, s[0], s[1])
|
|
2793
2793
|
)) {
|
|
2794
2794
|
this.stopTouchDrag();
|
|
2795
2795
|
return;
|
|
@@ -2798,13 +2798,13 @@ class j {
|
|
|
2798
2798
|
-(t.x - this.prevTouches.x),
|
|
2799
2799
|
-(t.y - this.prevTouches.y)
|
|
2800
2800
|
), t.touchesCnt === 2) {
|
|
2801
|
-
const { left: s, top:
|
|
2802
|
-
this.scaleViewport(c,
|
|
2801
|
+
const { left: s, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - s, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
|
|
2802
|
+
this.scaleViewport(c, a, h);
|
|
2803
2803
|
}
|
|
2804
2804
|
this.prevTouches = t;
|
|
2805
2805
|
});
|
|
2806
2806
|
i(this, "onWindowTouchFinish", (e) => {
|
|
2807
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2807
|
+
e.touches.length > 0 ? this.prevTouches = z(e) : this.stopTouchDrag();
|
|
2808
2808
|
});
|
|
2809
2809
|
i(this, "preventWheelScaleListener", (e) => {
|
|
2810
2810
|
e.preventDefault();
|
|
@@ -2822,28 +2822,28 @@ class j {
|
|
|
2822
2822
|
}), e.onBeforeDestroy.subscribe(this.revert);
|
|
2823
2823
|
}
|
|
2824
2824
|
static configure(e, t, o, s) {
|
|
2825
|
-
new
|
|
2825
|
+
new J(e, t, o, s);
|
|
2826
2826
|
}
|
|
2827
2827
|
moveViewport(e, t) {
|
|
2828
|
-
const o = this.viewport.getViewportMatrix(), s =
|
|
2828
|
+
const o = this.viewport.getViewportMatrix(), s = Oe(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2829
2829
|
prevTransform: o,
|
|
2830
2830
|
nextTransform: s,
|
|
2831
|
-
canvasWidth:
|
|
2832
|
-
canvasHeight:
|
|
2831
|
+
canvasWidth: n,
|
|
2832
|
+
canvasHeight: a
|
|
2833
2833
|
});
|
|
2834
2834
|
this.performTransform(h);
|
|
2835
2835
|
}
|
|
2836
2836
|
scaleViewport(e, t, o) {
|
|
2837
|
-
const s = this.canvas.viewport.getViewportMatrix(),
|
|
2837
|
+
const s = this.canvas.viewport.getViewportMatrix(), n = ze(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2838
2838
|
prevTransform: s,
|
|
2839
|
-
nextTransform:
|
|
2840
|
-
canvasWidth:
|
|
2839
|
+
nextTransform: n,
|
|
2840
|
+
canvasWidth: a,
|
|
2841
2841
|
canvasHeight: h
|
|
2842
2842
|
});
|
|
2843
2843
|
this.performTransform(d);
|
|
2844
2844
|
}
|
|
2845
2845
|
stopMouseDrag() {
|
|
2846
|
-
|
|
2846
|
+
Y(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2847
2847
|
}
|
|
2848
2848
|
removeMouseDragListeners() {
|
|
2849
2849
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2873,8 +2873,8 @@ class j {
|
|
|
2873
2873
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
|
|
2874
2874
|
}
|
|
2875
2875
|
}
|
|
2876
|
-
class
|
|
2877
|
-
constructor(e, t, o, s,
|
|
2876
|
+
class ie {
|
|
2877
|
+
constructor(e, t, o, s, n, a) {
|
|
2878
2878
|
i(this, "nodeHorizontal");
|
|
2879
2879
|
i(this, "nodeVertical");
|
|
2880
2880
|
i(this, "viewport");
|
|
@@ -2897,7 +2897,7 @@ class se {
|
|
|
2897
2897
|
this.userTransformInProgress || this.loadAreaAroundViewport();
|
|
2898
2898
|
});
|
|
2899
2899
|
i(this, "userTransformInProgress", !1);
|
|
2900
|
-
this.canvas = e, this.element = t, this.window = o, this.trigger =
|
|
2900
|
+
this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
|
|
2901
2901
|
this.scheduleLoadAreaAroundViewport();
|
|
2902
2902
|
});
|
|
2903
2903
|
const h = {
|
|
@@ -2920,21 +2920,21 @@ class se {
|
|
|
2920
2920
|
this.scheduleLoadAreaAroundViewport(), s.onTransformFinished();
|
|
2921
2921
|
}
|
|
2922
2922
|
};
|
|
2923
|
-
|
|
2923
|
+
J.configure(
|
|
2924
2924
|
e,
|
|
2925
2925
|
this.element,
|
|
2926
2926
|
this.window,
|
|
2927
2927
|
h
|
|
2928
2928
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2929
2929
|
}
|
|
2930
|
-
static configure(e, t, o, s,
|
|
2931
|
-
new
|
|
2930
|
+
static configure(e, t, o, s, n, a) {
|
|
2931
|
+
new ie(
|
|
2932
2932
|
e,
|
|
2933
2933
|
t,
|
|
2934
2934
|
o,
|
|
2935
2935
|
s,
|
|
2936
|
-
|
|
2937
|
-
|
|
2936
|
+
n,
|
|
2937
|
+
a
|
|
2938
2938
|
);
|
|
2939
2939
|
}
|
|
2940
2940
|
scheduleLoadAreaAroundViewport() {
|
|
@@ -2944,38 +2944,38 @@ class se {
|
|
|
2944
2944
|
}
|
|
2945
2945
|
scheduleEnsureViewportAreaLoaded() {
|
|
2946
2946
|
setTimeout(() => {
|
|
2947
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y:
|
|
2948
|
-
this.loadedArea.xFrom < d && this.loadedArea.xTo >
|
|
2947
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, u = s + a + this.nodeHorizontal, g = n + h + this.nodeVertical;
|
|
2948
|
+
this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > g || this.loadAreaAroundViewport();
|
|
2949
2949
|
});
|
|
2950
2950
|
}
|
|
2951
2951
|
loadAreaAroundViewport() {
|
|
2952
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y:
|
|
2952
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, u = 3 * a + 2 * this.nodeHorizontal, g = 3 * h + 2 * this.nodeVertical;
|
|
2953
2953
|
this.trigger.emit({
|
|
2954
2954
|
x: d,
|
|
2955
2955
|
y: c,
|
|
2956
|
-
width:
|
|
2957
|
-
height:
|
|
2956
|
+
width: u,
|
|
2957
|
+
height: g
|
|
2958
2958
|
});
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
2961
|
-
const
|
|
2961
|
+
const Ot = () => {
|
|
2962
2962
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2963
2963
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2964
|
-
},
|
|
2964
|
+
}, zt = () => {
|
|
2965
2965
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2966
2966
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2967
|
-
},
|
|
2967
|
+
}, kt = () => {
|
|
2968
2968
|
const r = document.createElementNS(
|
|
2969
2969
|
"http://www.w3.org/2000/svg",
|
|
2970
2970
|
"pattern"
|
|
2971
2971
|
);
|
|
2972
2972
|
return r.setAttribute("id", "pattern"), r;
|
|
2973
2973
|
};
|
|
2974
|
-
class
|
|
2974
|
+
class ne {
|
|
2975
2975
|
constructor(e, t, o) {
|
|
2976
|
-
i(this, "svg",
|
|
2977
|
-
i(this, "patternRenderingRectangle",
|
|
2978
|
-
i(this, "pattern",
|
|
2976
|
+
i(this, "svg", Ot());
|
|
2977
|
+
i(this, "patternRenderingRectangle", zt());
|
|
2978
|
+
i(this, "pattern", kt());
|
|
2979
2979
|
i(this, "patternContent");
|
|
2980
2980
|
i(this, "tileWidth");
|
|
2981
2981
|
i(this, "tileHeight");
|
|
@@ -2990,13 +2990,13 @@ class ie {
|
|
|
2990
2990
|
this.canvas = e, this.backgroundHost = o, 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;
|
|
2991
2991
|
const s = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2992
2992
|
this.patternContent.setAttribute("transform", s), this.pattern.appendChild(this.patternContent);
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2993
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2994
|
+
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
|
|
2995
2995
|
this.updateDimensions();
|
|
2996
2996
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2997
2997
|
}
|
|
2998
2998
|
static configure(e, t, o) {
|
|
2999
|
-
new
|
|
2999
|
+
new ne(e, t, o);
|
|
3000
3000
|
}
|
|
3001
3001
|
updateVisibility() {
|
|
3002
3002
|
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
@@ -3009,19 +3009,19 @@ class ie {
|
|
|
3009
3009
|
this.pattern.setAttribute("width", `${o}`), this.pattern.setAttribute("height", `${s}`);
|
|
3010
3010
|
}
|
|
3011
3011
|
}
|
|
3012
|
-
class
|
|
3013
|
-
constructor(e, t, o, s,
|
|
3012
|
+
class ae {
|
|
3013
|
+
constructor(e, t, o, s, n) {
|
|
3014
3014
|
i(this, "overlayCanvas");
|
|
3015
3015
|
i(this, "staticPortId", null);
|
|
3016
3016
|
i(this, "isTargetDragging", !0);
|
|
3017
3017
|
i(this, "onEdgeCreated", (e) => {
|
|
3018
3018
|
this.params.onAfterEdgeCreated(e);
|
|
3019
3019
|
});
|
|
3020
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params =
|
|
3020
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ye(
|
|
3021
3021
|
this.overlayLayer,
|
|
3022
3022
|
this.viewportStore,
|
|
3023
3023
|
this.window
|
|
3024
|
-
),
|
|
3024
|
+
), j.configure(
|
|
3025
3025
|
this.canvas,
|
|
3026
3026
|
this.overlayLayer,
|
|
3027
3027
|
this.window,
|
|
@@ -3031,51 +3031,51 @@ class ne {
|
|
|
3031
3031
|
onStopDrag: () => {
|
|
3032
3032
|
this.resetDragState();
|
|
3033
3033
|
},
|
|
3034
|
-
onPortPointerDown: (
|
|
3035
|
-
const d = this.params.connectionTypeResolver(
|
|
3036
|
-
return d === null ? !1 : (this.grabPort(
|
|
3034
|
+
onPortPointerDown: (a, h) => {
|
|
3035
|
+
const d = this.params.connectionTypeResolver(a);
|
|
3036
|
+
return d === null ? !1 : (this.grabPort(a, h, d), !0);
|
|
3037
3037
|
},
|
|
3038
|
-
onPointerMove: (
|
|
3039
|
-
this.moveDraggingPort(
|
|
3038
|
+
onPointerMove: (a) => {
|
|
3039
|
+
this.moveDraggingPort(a);
|
|
3040
3040
|
},
|
|
3041
|
-
onPointerUp: (
|
|
3042
|
-
this.tryCreateConnection(
|
|
3041
|
+
onPointerUp: (a) => {
|
|
3042
|
+
this.tryCreateConnection(a);
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
3045
|
);
|
|
3046
3046
|
}
|
|
3047
|
-
static configure(e, t, o, s,
|
|
3048
|
-
new
|
|
3047
|
+
static configure(e, t, o, s, n) {
|
|
3048
|
+
new ae(
|
|
3049
3049
|
e,
|
|
3050
3050
|
t,
|
|
3051
3051
|
o,
|
|
3052
3052
|
s,
|
|
3053
|
-
|
|
3053
|
+
n
|
|
3054
3054
|
);
|
|
3055
3055
|
}
|
|
3056
3056
|
grabPort(e, t, o) {
|
|
3057
3057
|
const s = this.canvas.graph.getPort(e);
|
|
3058
3058
|
this.staticPortId = e;
|
|
3059
|
-
const
|
|
3060
|
-
x:
|
|
3059
|
+
const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
|
|
3060
|
+
x: a - d.x,
|
|
3061
3061
|
y: h - d.y
|
|
3062
|
-
}),
|
|
3062
|
+
}), u = this.canvas.viewport.createContentCoords({
|
|
3063
3063
|
x: t.x - d.x,
|
|
3064
3064
|
y: t.y - d.y
|
|
3065
|
-
}),
|
|
3065
|
+
}), g = {
|
|
3066
3066
|
overlayNodeId: M.StaticNodeId,
|
|
3067
3067
|
portCoords: c,
|
|
3068
3068
|
portDirection: s.direction
|
|
3069
3069
|
}, l = {
|
|
3070
3070
|
overlayNodeId: M.DraggingNodeId,
|
|
3071
|
-
portCoords:
|
|
3071
|
+
portCoords: u,
|
|
3072
3072
|
portDirection: this.params.dragPortDirection
|
|
3073
3073
|
};
|
|
3074
3074
|
this.isTargetDragging = o === "direct";
|
|
3075
|
-
const [
|
|
3076
|
-
this.overlayCanvas.addNode(
|
|
3077
|
-
from:
|
|
3078
|
-
to:
|
|
3075
|
+
const [w, p] = this.isTargetDragging ? [g, l] : [l, g];
|
|
3076
|
+
this.overlayCanvas.addNode(X(w)), this.overlayCanvas.addNode(X(p)), this.overlayCanvas.addEdge({
|
|
3077
|
+
from: w.overlayNodeId,
|
|
3078
|
+
to: p.overlayNodeId,
|
|
3079
3079
|
shape: this.params.edgeShapeFactory(M.EdgeId)
|
|
3080
3080
|
});
|
|
3081
3081
|
}
|
|
@@ -3083,7 +3083,7 @@ class ne {
|
|
|
3083
3083
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
3084
3084
|
}
|
|
3085
3085
|
tryCreateConnection(e) {
|
|
3086
|
-
const t =
|
|
3086
|
+
const t = Me(this.canvas.graph, e), o = this.staticPortId;
|
|
3087
3087
|
if (t === null) {
|
|
3088
3088
|
this.params.onEdgeCreationInterrupted({
|
|
3089
3089
|
staticPortId: o,
|
|
@@ -3091,8 +3091,8 @@ class ne {
|
|
|
3091
3091
|
});
|
|
3092
3092
|
return;
|
|
3093
3093
|
}
|
|
3094
|
-
const s = this.isTargetDragging ? o : t,
|
|
3095
|
-
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(
|
|
3094
|
+
const s = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: s, to: n }, h = this.params.connectionPreprocessor(a);
|
|
3095
|
+
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
|
|
3096
3096
|
}
|
|
3097
3097
|
moveDraggingPort(e) {
|
|
3098
3098
|
const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
|
|
@@ -3105,8 +3105,8 @@ class ne {
|
|
|
3105
3105
|
});
|
|
3106
3106
|
}
|
|
3107
3107
|
}
|
|
3108
|
-
class
|
|
3109
|
-
constructor(e, t, o, s,
|
|
3108
|
+
class he {
|
|
3109
|
+
constructor(e, t, o, s, n) {
|
|
3110
3110
|
i(this, "overlayCanvas");
|
|
3111
3111
|
i(this, "staticPortId", null);
|
|
3112
3112
|
i(this, "isTargetDragging", !0);
|
|
@@ -3114,11 +3114,11 @@ class ae {
|
|
|
3114
3114
|
i(this, "onEdgeReattached", (e) => {
|
|
3115
3115
|
this.params.onAfterEdgeReattached(e);
|
|
3116
3116
|
});
|
|
3117
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params =
|
|
3117
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ye(
|
|
3118
3118
|
this.overlayLayer,
|
|
3119
3119
|
this.viewportStore,
|
|
3120
3120
|
this.window
|
|
3121
|
-
),
|
|
3121
|
+
), j.configure(
|
|
3122
3122
|
this.canvas,
|
|
3123
3123
|
this.overlayLayer,
|
|
3124
3124
|
this.window,
|
|
@@ -3128,38 +3128,38 @@ class ae {
|
|
|
3128
3128
|
onStopDrag: () => {
|
|
3129
3129
|
this.resetDragState();
|
|
3130
3130
|
},
|
|
3131
|
-
onPortPointerDown: (
|
|
3132
|
-
onPointerMove: (
|
|
3133
|
-
this.moveDraggingPort(
|
|
3131
|
+
onPortPointerDown: (a, h) => this.tryStartEdgeDragging(a, h),
|
|
3132
|
+
onPointerMove: (a) => {
|
|
3133
|
+
this.moveDraggingPort(a);
|
|
3134
3134
|
},
|
|
3135
|
-
onPointerUp: (
|
|
3136
|
-
this.tryCreateConnection(
|
|
3135
|
+
onPointerUp: (a) => {
|
|
3136
|
+
this.tryCreateConnection(a);
|
|
3137
3137
|
}
|
|
3138
3138
|
}
|
|
3139
3139
|
);
|
|
3140
3140
|
}
|
|
3141
|
-
static configure(e, t, o, s,
|
|
3142
|
-
new
|
|
3141
|
+
static configure(e, t, o, s, n) {
|
|
3142
|
+
new he(
|
|
3143
3143
|
e,
|
|
3144
3144
|
t,
|
|
3145
3145
|
o,
|
|
3146
3146
|
s,
|
|
3147
|
-
|
|
3147
|
+
n
|
|
3148
3148
|
);
|
|
3149
3149
|
}
|
|
3150
3150
|
tryStartEdgeDragging(e, t) {
|
|
3151
3151
|
const o = this.params.draggingEdgeResolver(e);
|
|
3152
3152
|
if (o === null || !this.canvas.graph.hasEdge(o))
|
|
3153
3153
|
return !1;
|
|
3154
|
-
const s = this.canvas.graph.getEdge(o),
|
|
3155
|
-
this.staticPortId = h, this.isTargetDragging =
|
|
3156
|
-
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h),
|
|
3157
|
-
x:
|
|
3158
|
-
y:
|
|
3159
|
-
}, l = this.overlayLayer.getBoundingClientRect(),
|
|
3160
|
-
x:
|
|
3161
|
-
y:
|
|
3162
|
-
}),
|
|
3154
|
+
const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
|
|
3155
|
+
this.staticPortId = h, this.isTargetDragging = a;
|
|
3156
|
+
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
|
|
3157
|
+
x: u.x + u.width / 2,
|
|
3158
|
+
y: u.y + u.height / 2
|
|
3159
|
+
}, l = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
|
|
3160
|
+
x: g.x - l.x,
|
|
3161
|
+
y: g.y - l.y
|
|
3162
|
+
}), p = this.canvas.viewport.createContentCoords({
|
|
3163
3163
|
x: t.x - l.x,
|
|
3164
3164
|
y: t.y - l.y
|
|
3165
3165
|
});
|
|
@@ -3170,22 +3170,22 @@ class ae {
|
|
|
3170
3170
|
shape: s.shape,
|
|
3171
3171
|
priority: s.priority
|
|
3172
3172
|
}, this.canvas.removeEdge(o);
|
|
3173
|
-
const
|
|
3173
|
+
const y = {
|
|
3174
3174
|
overlayNodeId: M.StaticNodeId,
|
|
3175
|
-
portCoords:
|
|
3175
|
+
portCoords: w,
|
|
3176
3176
|
portDirection: c.direction
|
|
3177
3177
|
}, f = {
|
|
3178
3178
|
overlayNodeId: M.DraggingNodeId,
|
|
3179
|
-
portCoords:
|
|
3179
|
+
portCoords: p,
|
|
3180
3180
|
portDirection: d.direction
|
|
3181
|
-
}, [
|
|
3182
|
-
this.overlayCanvas.addNode(
|
|
3183
|
-
const
|
|
3181
|
+
}, [x, E] = this.isTargetDragging ? [y, f] : [f, y];
|
|
3182
|
+
this.overlayCanvas.addNode(X(x)), this.overlayCanvas.addNode(X(E));
|
|
3183
|
+
const b = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
|
|
3184
3184
|
return this.overlayCanvas.addEdge({
|
|
3185
3185
|
id: M.EdgeId,
|
|
3186
|
-
from:
|
|
3187
|
-
to:
|
|
3188
|
-
shape:
|
|
3186
|
+
from: x.overlayNodeId,
|
|
3187
|
+
to: E.overlayNodeId,
|
|
3188
|
+
shape: b
|
|
3189
3189
|
}), !0;
|
|
3190
3190
|
}
|
|
3191
3191
|
resetDragState() {
|
|
@@ -3202,7 +3202,7 @@ class ae {
|
|
|
3202
3202
|
});
|
|
3203
3203
|
}
|
|
3204
3204
|
tryCreateConnection(e) {
|
|
3205
|
-
const t =
|
|
3205
|
+
const t = Me(this.canvas.graph, e);
|
|
3206
3206
|
if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
|
|
3207
3207
|
const d = this.draggingEdgePayload;
|
|
3208
3208
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -3214,13 +3214,13 @@ class ae {
|
|
|
3214
3214
|
});
|
|
3215
3215
|
return;
|
|
3216
3216
|
}
|
|
3217
|
-
const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId],
|
|
3218
|
-
id:
|
|
3217
|
+
const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
3218
|
+
id: n.id,
|
|
3219
3219
|
from: o,
|
|
3220
3220
|
to: s,
|
|
3221
|
-
shape:
|
|
3222
|
-
priority:
|
|
3223
|
-
}, h = this.params.connectionPreprocessor(
|
|
3221
|
+
shape: n.shape,
|
|
3222
|
+
priority: n.priority
|
|
3223
|
+
}, h = this.params.connectionPreprocessor(a);
|
|
3224
3224
|
if (h !== null)
|
|
3225
3225
|
this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeReattached), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeReattached);
|
|
3226
3226
|
else {
|
|
@@ -3235,17 +3235,17 @@ class ae {
|
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
3238
|
-
class
|
|
3238
|
+
class de {
|
|
3239
3239
|
constructor(e, t) {
|
|
3240
3240
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
3241
3241
|
this.applier.apply();
|
|
3242
3242
|
});
|
|
3243
3243
|
}
|
|
3244
3244
|
static configure(e, t) {
|
|
3245
|
-
new
|
|
3245
|
+
new de(e, t);
|
|
3246
3246
|
}
|
|
3247
3247
|
}
|
|
3248
|
-
class
|
|
3248
|
+
class ce {
|
|
3249
3249
|
constructor(e, t, o) {
|
|
3250
3250
|
i(this, "applyScheduled", !1);
|
|
3251
3251
|
i(this, "apply", () => {
|
|
@@ -3262,7 +3262,7 @@ class de {
|
|
|
3262
3262
|
});
|
|
3263
3263
|
}
|
|
3264
3264
|
static configure(e, t, o) {
|
|
3265
|
-
new
|
|
3265
|
+
new ce(
|
|
3266
3266
|
e,
|
|
3267
3267
|
t,
|
|
3268
3268
|
o
|
|
@@ -3272,23 +3272,23 @@ class de {
|
|
|
3272
3272
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
class
|
|
3275
|
+
class Yt {
|
|
3276
3276
|
static configure(e, t) {
|
|
3277
|
-
const o = t.applyOn, s = new
|
|
3277
|
+
const o = t.applyOn, s = new Bt(e, t.algorithm, {
|
|
3278
3278
|
staticNodeResolver: t.staticNodeResolver,
|
|
3279
3279
|
onBeforeApplied: t.onBeforeApplied,
|
|
3280
3280
|
onAfterApplied: t.onAfterApplied
|
|
3281
3281
|
});
|
|
3282
3282
|
switch (o.type) {
|
|
3283
3283
|
case "trigger": {
|
|
3284
|
-
|
|
3284
|
+
de.configure(
|
|
3285
3285
|
s,
|
|
3286
3286
|
o.trigger
|
|
3287
3287
|
);
|
|
3288
3288
|
break;
|
|
3289
3289
|
}
|
|
3290
3290
|
case "topologyChangeSchedule": {
|
|
3291
|
-
|
|
3291
|
+
ce.configure(
|
|
3292
3292
|
e.graph,
|
|
3293
3293
|
s,
|
|
3294
3294
|
o.schedule
|
|
@@ -3298,7 +3298,7 @@ class Wt {
|
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
3300
3300
|
}
|
|
3301
|
-
class
|
|
3301
|
+
class Xt {
|
|
3302
3302
|
constructor(e, t) {
|
|
3303
3303
|
i(this, "previousTimeStamp");
|
|
3304
3304
|
i(this, "step", (e) => {
|
|
@@ -3313,95 +3313,318 @@ class zt {
|
|
|
3313
3313
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3314
3314
|
}
|
|
3315
3315
|
}
|
|
3316
|
-
class
|
|
3316
|
+
class le {
|
|
3317
3317
|
constructor(e, t, o) {
|
|
3318
3318
|
i(this, "applier");
|
|
3319
3319
|
i(this, "step", (e) => {
|
|
3320
3320
|
this.applier.apply(e);
|
|
3321
3321
|
});
|
|
3322
|
-
this.win = o, this.applier = new
|
|
3322
|
+
this.win = o, this.applier = new Wt(e, t.algorithm, {
|
|
3323
3323
|
staticNodeResolver: t.staticNodeResolver,
|
|
3324
3324
|
onBeforeApplied: t.onBeforeApplied,
|
|
3325
3325
|
onAfterApplied: t.onAfterApplied
|
|
3326
|
-
}), new
|
|
3326
|
+
}), new Xt(this.win, this.step);
|
|
3327
3327
|
}
|
|
3328
3328
|
static configure(e, t, o) {
|
|
3329
|
-
new
|
|
3329
|
+
new le(e, t, o);
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
class ue {
|
|
3333
|
+
constructor(e) {
|
|
3334
|
+
i(this, "element");
|
|
3335
|
+
i(this, "canvas");
|
|
3336
|
+
i(this, "window");
|
|
3337
|
+
i(this, "onNodeSelected");
|
|
3338
|
+
i(this, "mouseDownEventVerifier");
|
|
3339
|
+
i(this, "mouseUpEventVerifier");
|
|
3340
|
+
i(this, "movementThreshold");
|
|
3341
|
+
i(this, "selectionCandidateNodeId", null);
|
|
3342
|
+
i(this, "movedDistance", 0);
|
|
3343
|
+
i(this, "previousMouse", null);
|
|
3344
|
+
i(this, "previousTouch", null);
|
|
3345
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
3346
|
+
const { element: t } = this.canvas.graph.getNode(e);
|
|
3347
|
+
t.addEventListener("mousedown", this.onNodeMouseDown, {
|
|
3348
|
+
passive: !0
|
|
3349
|
+
}), t.addEventListener("touchstart", this.onNodeTouchStart, {
|
|
3350
|
+
passive: !0
|
|
3351
|
+
});
|
|
3352
|
+
});
|
|
3353
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
3354
|
+
const { element: t } = this.canvas.graph.getNode(e);
|
|
3355
|
+
t.removeEventListener("mousedown", this.onNodeMouseDown), t.removeEventListener("touchstart", this.onNodeTouchStart);
|
|
3356
|
+
});
|
|
3357
|
+
i(this, "reset", () => {
|
|
3358
|
+
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
3359
|
+
const { element: t } = this.canvas.graph.getNode(e);
|
|
3360
|
+
t.removeEventListener("mousedown", this.onNodeMouseDown), t.removeEventListener("touchstart", this.onNodeTouchStart);
|
|
3361
|
+
});
|
|
3362
|
+
});
|
|
3363
|
+
i(this, "revert", () => {
|
|
3364
|
+
this.reset(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
3365
|
+
});
|
|
3366
|
+
i(this, "onNodeMouseDown", (e) => {
|
|
3367
|
+
const t = e;
|
|
3368
|
+
if (!this.mouseDownEventVerifier(t))
|
|
3369
|
+
return;
|
|
3370
|
+
const o = this.canvas.graph.findNodeIdByElement(
|
|
3371
|
+
e.currentTarget
|
|
3372
|
+
);
|
|
3373
|
+
this.selectionCandidateNodeId = o, this.previousMouse = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
3374
|
+
passive: !0
|
|
3375
|
+
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
3376
|
+
passive: !0
|
|
3377
|
+
});
|
|
3378
|
+
});
|
|
3379
|
+
i(this, "onNodeTouchStart", (e) => {
|
|
3380
|
+
const t = e;
|
|
3381
|
+
if (t.touches.length !== 1)
|
|
3382
|
+
return;
|
|
3383
|
+
const o = this.canvas.graph.findNodeIdByElement(
|
|
3384
|
+
t.currentTarget
|
|
3385
|
+
);
|
|
3386
|
+
this.selectionCandidateNodeId = o, this.previousTouch = t.touches[0], this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
3387
|
+
passive: !0
|
|
3388
|
+
}), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
|
|
3389
|
+
passive: !0
|
|
3390
|
+
}), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
|
|
3391
|
+
passive: !0
|
|
3392
|
+
});
|
|
3393
|
+
});
|
|
3394
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
3395
|
+
const t = e, o = this.previousMouse, s = t.clientX - o.x, n = t.clientY - o.y;
|
|
3396
|
+
if (!D(
|
|
3397
|
+
this.window,
|
|
3398
|
+
this.element,
|
|
3399
|
+
t.clientX,
|
|
3400
|
+
t.clientY
|
|
3401
|
+
)) {
|
|
3402
|
+
this.removeWindowMouseListeners();
|
|
3403
|
+
return;
|
|
3404
|
+
}
|
|
3405
|
+
this.processMoveThresholdVerification(s, n, () => {
|
|
3406
|
+
this.removeWindowMouseListeners();
|
|
3407
|
+
}), this.previousMouse = { x: t.clientX, y: t.clientY };
|
|
3408
|
+
});
|
|
3409
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
3410
|
+
const t = e;
|
|
3411
|
+
if (t.touches.length !== 1) {
|
|
3412
|
+
this.removeWindowTouchListeners();
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
const o = t.touches[0];
|
|
3416
|
+
if (!D(this.window, this.element, o.clientX, o.clientY)) {
|
|
3417
|
+
this.removeWindowTouchListeners();
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
const s = this.previousTouch, n = o.clientX - s.clientX, a = o.clientY - s.clientY;
|
|
3421
|
+
this.processMoveThresholdVerification(n, a, () => {
|
|
3422
|
+
this.removeWindowTouchListeners();
|
|
3423
|
+
}), this.previousTouch = o;
|
|
3424
|
+
});
|
|
3425
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
3426
|
+
const t = e;
|
|
3427
|
+
this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.trySelectNode(e));
|
|
3428
|
+
});
|
|
3429
|
+
i(this, "onWindowTouchEnd", (e) => {
|
|
3430
|
+
this.removeWindowTouchListeners(), this.trySelectNode(e);
|
|
3431
|
+
});
|
|
3432
|
+
i(this, "onWindowTouchCancel", () => {
|
|
3433
|
+
this.removeWindowTouchListeners();
|
|
3434
|
+
});
|
|
3435
|
+
this.element = e.element, this.canvas = e.canvas, this.window = e.window, this.mouseDownEventVerifier = e.mouseDownEventVerifier, this.mouseUpEventVerifier = e.mouseUpEventVerifier, this.onNodeSelected = e.onNodeSelected, this.movementThreshold = e.movementThreshold, this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
3436
|
+
}
|
|
3437
|
+
static configure(e) {
|
|
3438
|
+
new ue(e);
|
|
3439
|
+
}
|
|
3440
|
+
removeWindowMouseListeners() {
|
|
3441
|
+
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
3442
|
+
}
|
|
3443
|
+
removeWindowTouchListeners() {
|
|
3444
|
+
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
|
|
3445
|
+
}
|
|
3446
|
+
trySelectNode(e) {
|
|
3447
|
+
const t = this.selectionCandidateNodeId;
|
|
3448
|
+
this.canvas.graph.hasNode(t) && (this.onNodeSelected(t), e.ignoreCanvasSelection = !0);
|
|
3449
|
+
}
|
|
3450
|
+
processMoveThresholdVerification(e, t, o) {
|
|
3451
|
+
const s = Math.sqrt(e * e + t * t);
|
|
3452
|
+
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
3330
3453
|
}
|
|
3331
3454
|
}
|
|
3332
|
-
|
|
3455
|
+
class ge {
|
|
3456
|
+
constructor(e) {
|
|
3457
|
+
i(this, "element");
|
|
3458
|
+
i(this, "canvas");
|
|
3459
|
+
i(this, "window");
|
|
3460
|
+
i(this, "onCanvasSelected");
|
|
3461
|
+
i(this, "movementThreshold");
|
|
3462
|
+
i(this, "mouseDownEventVerifier");
|
|
3463
|
+
i(this, "mouseUpEventVerifier");
|
|
3464
|
+
i(this, "movedDistance", 0);
|
|
3465
|
+
i(this, "previousMouseDown", null);
|
|
3466
|
+
i(this, "previousTouch", null);
|
|
3467
|
+
i(this, "onMouseDown", (e) => {
|
|
3468
|
+
const t = e;
|
|
3469
|
+
this.mouseDownEventVerifier(t) && (this.previousMouseDown = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
3470
|
+
passive: !0
|
|
3471
|
+
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
3472
|
+
passive: !0
|
|
3473
|
+
}));
|
|
3474
|
+
});
|
|
3475
|
+
i(this, "onTouchStart", (e) => {
|
|
3476
|
+
const t = e;
|
|
3477
|
+
if (t.touches.length !== 1)
|
|
3478
|
+
return;
|
|
3479
|
+
const o = t.touches[0];
|
|
3480
|
+
this.previousTouch = o, this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
3481
|
+
passive: !0
|
|
3482
|
+
}), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
|
|
3483
|
+
passive: !0
|
|
3484
|
+
}), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
|
|
3485
|
+
passive: !0
|
|
3486
|
+
});
|
|
3487
|
+
});
|
|
3488
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
3489
|
+
const t = e;
|
|
3490
|
+
if (!D(
|
|
3491
|
+
this.window,
|
|
3492
|
+
this.element,
|
|
3493
|
+
t.clientX,
|
|
3494
|
+
t.clientY
|
|
3495
|
+
)) {
|
|
3496
|
+
this.removeWindowMouseListeners();
|
|
3497
|
+
return;
|
|
3498
|
+
}
|
|
3499
|
+
const o = this.previousMouseDown, s = t.clientX - o.x, n = t.clientY - o.y;
|
|
3500
|
+
this.processMoveThresholdVerification(s, n, () => {
|
|
3501
|
+
this.removeWindowMouseListeners();
|
|
3502
|
+
}), this.previousMouseDown = { x: t.clientX, y: t.clientY };
|
|
3503
|
+
});
|
|
3504
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
3505
|
+
const t = e;
|
|
3506
|
+
if (t.touches.length !== 1) {
|
|
3507
|
+
this.removeWindowTouchListeners();
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
const o = t.touches[0];
|
|
3511
|
+
if (!D(this.window, this.element, o.clientX, o.clientY)) {
|
|
3512
|
+
this.removeWindowTouchListeners();
|
|
3513
|
+
return;
|
|
3514
|
+
}
|
|
3515
|
+
const s = this.previousTouch, n = o.clientX - s.clientX, a = o.clientY - s.clientY;
|
|
3516
|
+
this.processMoveThresholdVerification(n, a, () => {
|
|
3517
|
+
this.removeWindowTouchListeners();
|
|
3518
|
+
}), this.previousTouch = o;
|
|
3519
|
+
});
|
|
3520
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
3521
|
+
const t = e;
|
|
3522
|
+
if (!this.mouseUpEventVerifier(t))
|
|
3523
|
+
return;
|
|
3524
|
+
e.ignoreCanvasSelection !== !0 && this.onCanvasSelected(), this.removeWindowMouseListeners();
|
|
3525
|
+
});
|
|
3526
|
+
i(this, "onWindowTouchEnd", () => {
|
|
3527
|
+
this.onCanvasSelected(), this.removeWindowTouchListeners();
|
|
3528
|
+
});
|
|
3529
|
+
i(this, "onWindowTouchCancel", () => {
|
|
3530
|
+
this.removeWindowTouchListeners();
|
|
3531
|
+
});
|
|
3532
|
+
i(this, "restore", () => {
|
|
3533
|
+
this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("touchstart", this.onTouchStart), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
3534
|
+
});
|
|
3535
|
+
this.element = e.element, this.window = e.window, this.onCanvasSelected = e.onCanvasSelected, this.canvas = e.canvas, this.movementThreshold = e.movementThreshold, this.mouseDownEventVerifier = e.mouseDownEventVerifier, this.mouseUpEventVerifier = e.mouseUpEventVerifier, this.canvas.onBeforeDestroy.subscribe(this.restore), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
3536
|
+
passive: !0
|
|
3537
|
+
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
3538
|
+
passive: !0
|
|
3539
|
+
});
|
|
3540
|
+
}
|
|
3541
|
+
static configure(e) {
|
|
3542
|
+
new ge(e);
|
|
3543
|
+
}
|
|
3544
|
+
removeWindowMouseListeners() {
|
|
3545
|
+
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
3546
|
+
}
|
|
3547
|
+
removeWindowTouchListeners() {
|
|
3548
|
+
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
|
|
3549
|
+
}
|
|
3550
|
+
processMoveThresholdVerification(e, t, o) {
|
|
3551
|
+
const s = Math.sqrt(e * e + t * t);
|
|
3552
|
+
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
const Ht = () => {
|
|
3333
3556
|
const r = document.createElement("div");
|
|
3334
3557
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3335
|
-
},
|
|
3558
|
+
}, Z = () => {
|
|
3336
3559
|
const r = document.createElement("div");
|
|
3337
3560
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3338
|
-
},
|
|
3339
|
-
const r =
|
|
3561
|
+
}, Ee = () => {
|
|
3562
|
+
const r = Z();
|
|
3340
3563
|
return r.style.pointerEvents = "none", r;
|
|
3341
3564
|
};
|
|
3342
|
-
class
|
|
3565
|
+
class Gt {
|
|
3343
3566
|
constructor(e) {
|
|
3344
|
-
i(this, "background",
|
|
3345
|
-
i(this, "main",
|
|
3346
|
-
i(this, "overlayConnectablePorts",
|
|
3347
|
-
i(this, "overlayDraggableEdges",
|
|
3348
|
-
i(this, "host",
|
|
3567
|
+
i(this, "background", Z());
|
|
3568
|
+
i(this, "main", Z());
|
|
3569
|
+
i(this, "overlayConnectablePorts", Ee());
|
|
3570
|
+
i(this, "overlayDraggableEdges", Ee());
|
|
3571
|
+
i(this, "host", Ht());
|
|
3349
3572
|
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);
|
|
3350
3573
|
}
|
|
3351
3574
|
destroy() {
|
|
3352
3575
|
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);
|
|
3353
3576
|
}
|
|
3354
3577
|
}
|
|
3355
|
-
const
|
|
3356
|
-
var p, y,
|
|
3357
|
-
const e = ((
|
|
3358
|
-
}), t = ((
|
|
3359
|
-
}), o = r.nodeDragVerifier ?? (() => !0), s = ((
|
|
3360
|
-
}),
|
|
3578
|
+
const jt = (r) => {
|
|
3579
|
+
var w, p, y, f, x, E;
|
|
3580
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3581
|
+
}), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
3582
|
+
}), o = r.nodeDragVerifier ?? (() => !0), s = ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
|
|
3583
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (x = r.mouse) == null ? void 0 : x.mouseDownEventVerifier, u = c !== void 0 ? c : (b) => b.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (b) => b.button === 0;
|
|
3361
3584
|
return {
|
|
3362
|
-
moveOnTop:
|
|
3363
|
-
moveEdgesOnTop:
|
|
3585
|
+
moveOnTop: n,
|
|
3586
|
+
moveEdgesOnTop: a,
|
|
3364
3587
|
dragCursor: d,
|
|
3365
3588
|
gridSize: r.gridSize ?? null,
|
|
3366
|
-
mouseDownEventVerifier:
|
|
3589
|
+
mouseDownEventVerifier: u,
|
|
3367
3590
|
mouseUpEventVerifier: l,
|
|
3368
3591
|
onNodeDragStarted: e,
|
|
3369
3592
|
onNodeDrag: t,
|
|
3370
3593
|
nodeDragVerifier: o,
|
|
3371
3594
|
onNodeDragFinished: s
|
|
3372
3595
|
};
|
|
3373
|
-
},
|
|
3596
|
+
}, Jt = (r) => {
|
|
3374
3597
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, s = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3375
|
-
return (
|
|
3376
|
-
let
|
|
3377
|
-
|
|
3378
|
-
const d =
|
|
3379
|
-
|
|
3380
|
-
const
|
|
3381
|
-
return h >
|
|
3598
|
+
return (n) => {
|
|
3599
|
+
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3600
|
+
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3601
|
+
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3602
|
+
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
|
|
3603
|
+
const u = n.canvasHeight * n.prevTransform.scale, g = s - u;
|
|
3604
|
+
return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3382
3605
|
};
|
|
3383
|
-
},
|
|
3606
|
+
}, Kt = (r) => {
|
|
3384
3607
|
const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
|
|
3385
|
-
return (
|
|
3386
|
-
const
|
|
3387
|
-
let d = h.scale, c = h.x,
|
|
3388
|
-
if (h.scale > s && h.scale >
|
|
3389
|
-
d = Math.max(
|
|
3390
|
-
const
|
|
3391
|
-
c =
|
|
3608
|
+
return (n) => {
|
|
3609
|
+
const a = n.prevTransform, h = n.nextTransform;
|
|
3610
|
+
let d = h.scale, c = h.x, u = h.y;
|
|
3611
|
+
if (h.scale > s && h.scale > a.scale) {
|
|
3612
|
+
d = Math.max(a.scale, s), c = a.x, u = a.y;
|
|
3613
|
+
const g = (d - a.scale) / (h.scale - a.scale);
|
|
3614
|
+
c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
|
|
3392
3615
|
}
|
|
3393
|
-
if (h.scale < o && h.scale <
|
|
3394
|
-
d = Math.min(
|
|
3395
|
-
const
|
|
3396
|
-
c =
|
|
3616
|
+
if (h.scale < o && h.scale < a.scale) {
|
|
3617
|
+
d = Math.min(a.scale, o), c = a.x, u = a.y;
|
|
3618
|
+
const g = (d - a.scale) / (h.scale - a.scale);
|
|
3619
|
+
c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
|
|
3397
3620
|
}
|
|
3398
3621
|
return {
|
|
3399
3622
|
scale: d,
|
|
3400
3623
|
x: c,
|
|
3401
|
-
y:
|
|
3624
|
+
y: u
|
|
3402
3625
|
};
|
|
3403
3626
|
};
|
|
3404
|
-
},
|
|
3627
|
+
}, Qt = (r) => (e) => r.reduce(
|
|
3405
3628
|
(t, o) => o({
|
|
3406
3629
|
prevTransform: e.prevTransform,
|
|
3407
3630
|
nextTransform: t,
|
|
@@ -3409,77 +3632,77 @@ const Yt = (r) => {
|
|
|
3409
3632
|
canvasHeight: e.canvasHeight
|
|
3410
3633
|
}),
|
|
3411
3634
|
e.nextTransform
|
|
3412
|
-
),
|
|
3635
|
+
), Ae = (r) => {
|
|
3413
3636
|
if (typeof r == "function")
|
|
3414
3637
|
return r;
|
|
3415
3638
|
switch (r.type) {
|
|
3416
3639
|
case "scale-limit":
|
|
3417
|
-
return
|
|
3640
|
+
return Kt({
|
|
3418
3641
|
minContentScale: r.minContentScale ?? 0,
|
|
3419
3642
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3420
3643
|
});
|
|
3421
3644
|
case "shift-limit":
|
|
3422
|
-
return
|
|
3645
|
+
return Jt({
|
|
3423
3646
|
minX: r.minX ?? -1 / 0,
|
|
3424
3647
|
maxX: r.maxX ?? 1 / 0,
|
|
3425
3648
|
minY: r.minY ?? -1 / 0,
|
|
3426
3649
|
maxY: r.maxY ?? 1 / 0
|
|
3427
3650
|
});
|
|
3428
3651
|
}
|
|
3429
|
-
},
|
|
3430
|
-
var
|
|
3431
|
-
const e = (
|
|
3652
|
+
}, Se = (r) => {
|
|
3653
|
+
var p, y, f, x, E, b, T, C, I, U, $, we;
|
|
3654
|
+
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
|
|
3432
3655
|
let s;
|
|
3433
|
-
o !== void 0 ? Array.isArray(o) ? s =
|
|
3656
|
+
o !== void 0 ? Array.isArray(o) ? s = Qt(
|
|
3434
3657
|
o.map(
|
|
3435
|
-
(
|
|
3658
|
+
(L) => Ae(L)
|
|
3436
3659
|
)
|
|
3437
|
-
) : s =
|
|
3438
|
-
const
|
|
3439
|
-
}), h = ((
|
|
3440
|
-
}), d = (
|
|
3660
|
+
) : s = Ae(o) : s = (L) => L.nextTransform;
|
|
3661
|
+
const n = ((y = r == null ? void 0 : r.shift) == null ? void 0 : y.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
|
|
3662
|
+
}), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
3663
|
+
}), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (L) => L.button === 0, u = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = u !== void 0 ? u : (L) => L.button === 0, l = (T = r == null ? void 0 : r.scale) == null ? void 0 : T.mouseWheelEventVerifier, w = l !== void 0 ? l : () => !0;
|
|
3441
3664
|
return {
|
|
3442
3665
|
wheelSensitivity: t,
|
|
3443
|
-
onTransformStarted: ((
|
|
3666
|
+
onTransformStarted: ((C = r == null ? void 0 : r.events) == null ? void 0 : C.onTransformStarted) ?? (() => {
|
|
3444
3667
|
}),
|
|
3445
3668
|
onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
|
|
3446
3669
|
}),
|
|
3447
|
-
onBeforeTransformChange:
|
|
3670
|
+
onBeforeTransformChange: a,
|
|
3448
3671
|
onTransformChange: h,
|
|
3449
3672
|
transformPreprocessor: s,
|
|
3450
|
-
shiftCursor:
|
|
3673
|
+
shiftCursor: n,
|
|
3451
3674
|
mouseDownEventVerifier: c,
|
|
3452
|
-
mouseUpEventVerifier:
|
|
3453
|
-
mouseWheelEventVerifier:
|
|
3454
|
-
scaleWheelFinishTimeout: ((
|
|
3675
|
+
mouseUpEventVerifier: g,
|
|
3676
|
+
mouseWheelEventVerifier: w,
|
|
3677
|
+
scaleWheelFinishTimeout: ((U = r == null ? void 0 : r.scale) == null ? void 0 : U.wheelFinishTimeout) ?? 500,
|
|
3455
3678
|
onResizeTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onResizeTransformStarted) ?? (() => {
|
|
3456
3679
|
}),
|
|
3457
|
-
onResizeTransformFinished: ((
|
|
3680
|
+
onResizeTransformFinished: ((we = r == null ? void 0 : r.events) == null ? void 0 : we.onResizeTransformFinished) ?? (() => {
|
|
3458
3681
|
})
|
|
3459
3682
|
};
|
|
3460
|
-
},
|
|
3683
|
+
}, Zt = (r, e) => {
|
|
3461
3684
|
const t = document.createElementNS(
|
|
3462
3685
|
"http://www.w3.org/2000/svg",
|
|
3463
3686
|
"circle"
|
|
3464
3687
|
);
|
|
3465
3688
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3466
|
-
},
|
|
3689
|
+
}, _t = (r) => r instanceof SVGElement ? r : Zt(
|
|
3467
3690
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3468
3691
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3469
|
-
),
|
|
3470
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s =
|
|
3692
|
+
), qt = (r) => {
|
|
3693
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = _t(r.renderer ?? {});
|
|
3471
3694
|
return {
|
|
3472
3695
|
tileWidth: t,
|
|
3473
3696
|
tileHeight: o,
|
|
3474
3697
|
renderer: s,
|
|
3475
3698
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3476
3699
|
};
|
|
3477
|
-
},
|
|
3700
|
+
}, pe = (r) => {
|
|
3478
3701
|
if (typeof r == "function")
|
|
3479
3702
|
return r;
|
|
3480
3703
|
switch (r.type) {
|
|
3481
3704
|
case "straight":
|
|
3482
|
-
return () => new
|
|
3705
|
+
return () => new Dt({
|
|
3483
3706
|
color: r.color,
|
|
3484
3707
|
width: r.width,
|
|
3485
3708
|
arrowLength: r.arrowLength,
|
|
@@ -3493,7 +3716,7 @@ const Yt = (r) => {
|
|
|
3493
3716
|
detourDirection: r.detourDirection
|
|
3494
3717
|
});
|
|
3495
3718
|
case "horizontal":
|
|
3496
|
-
return () => new
|
|
3719
|
+
return () => new Mt({
|
|
3497
3720
|
color: r.color,
|
|
3498
3721
|
width: r.width,
|
|
3499
3722
|
arrowLength: r.arrowLength,
|
|
@@ -3506,7 +3729,7 @@ const Yt = (r) => {
|
|
|
3506
3729
|
detourDistance: r.detourDistance
|
|
3507
3730
|
});
|
|
3508
3731
|
case "vertical":
|
|
3509
|
-
return () => new
|
|
3732
|
+
return () => new Lt({
|
|
3510
3733
|
color: r.color,
|
|
3511
3734
|
width: r.width,
|
|
3512
3735
|
arrowLength: r.arrowLength,
|
|
@@ -3519,7 +3742,7 @@ const Yt = (r) => {
|
|
|
3519
3742
|
detourDistance: r.detourDistance
|
|
3520
3743
|
});
|
|
3521
3744
|
case "direct":
|
|
3522
|
-
return () => new
|
|
3745
|
+
return () => new Ie({
|
|
3523
3746
|
color: r.color,
|
|
3524
3747
|
width: r.width,
|
|
3525
3748
|
arrowLength: r.arrowLength,
|
|
@@ -3530,7 +3753,7 @@ const Yt = (r) => {
|
|
|
3530
3753
|
targetOffset: r.targetOffset
|
|
3531
3754
|
});
|
|
3532
3755
|
default:
|
|
3533
|
-
return () => new
|
|
3756
|
+
return () => new Ct({
|
|
3534
3757
|
color: r.color,
|
|
3535
3758
|
width: r.width,
|
|
3536
3759
|
arrowLength: r.arrowLength,
|
|
@@ -3544,29 +3767,29 @@ const Yt = (r) => {
|
|
|
3544
3767
|
detourDirection: r.detourDirection
|
|
3545
3768
|
});
|
|
3546
3769
|
}
|
|
3547
|
-
},
|
|
3548
|
-
var c,
|
|
3549
|
-
const o = () => "direct", s = (l) => l,
|
|
3770
|
+
}, er = (r, e, t) => {
|
|
3771
|
+
var c, u, g;
|
|
3772
|
+
const o = () => "direct", s = (l) => l, n = (l) => l.button === 0, a = () => {
|
|
3550
3773
|
}, h = () => {
|
|
3551
3774
|
}, d = () => {
|
|
3552
3775
|
};
|
|
3553
3776
|
return {
|
|
3554
3777
|
connectionTypeResolver: r.connectionTypeResolver ?? o,
|
|
3555
3778
|
connectionPreprocessor: r.connectionPreprocessor ?? s,
|
|
3556
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ??
|
|
3557
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
3558
|
-
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ??
|
|
3559
|
-
onEdgeCreationInterrupted: ((
|
|
3560
|
-
onEdgeCreationPrevented: ((
|
|
3779
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3780
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3781
|
+
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
3782
|
+
onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
|
|
3783
|
+
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
|
|
3561
3784
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3562
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3785
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? pe(r.edgeShape) : e
|
|
3563
3786
|
};
|
|
3564
|
-
},
|
|
3565
|
-
var c,
|
|
3566
|
-
const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0,
|
|
3567
|
-
const
|
|
3568
|
-
return
|
|
3569
|
-
},
|
|
3787
|
+
}, tr = (r, e) => {
|
|
3788
|
+
var c, u, g;
|
|
3789
|
+
const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, n = (l) => {
|
|
3790
|
+
const w = e.getPortAdjacentEdgeIds(l);
|
|
3791
|
+
return w.length > 0 ? w[w.length - 1] : null;
|
|
3792
|
+
}, a = () => {
|
|
3570
3793
|
}, h = () => {
|
|
3571
3794
|
}, d = () => {
|
|
3572
3795
|
};
|
|
@@ -3574,16 +3797,16 @@ const Yt = (r) => {
|
|
|
3574
3797
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3575
3798
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
|
|
3576
3799
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
|
|
3577
|
-
draggingEdgeResolver: r.draggingEdgeResolver ??
|
|
3578
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3579
|
-
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ??
|
|
3580
|
-
onEdgeReattachInterrupted: ((
|
|
3581
|
-
onEdgeReattachPrevented: ((
|
|
3800
|
+
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3801
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? pe(r.draggingEdgeShape) : null,
|
|
3802
|
+
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3803
|
+
onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
|
|
3804
|
+
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
|
|
3582
3805
|
};
|
|
3583
|
-
},
|
|
3806
|
+
}, rr = (r) => ({
|
|
3584
3807
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3585
3808
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3586
|
-
}),
|
|
3809
|
+
}), or = (r) => {
|
|
3587
3810
|
var e, t;
|
|
3588
3811
|
return {
|
|
3589
3812
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3592,13 +3815,13 @@ const Yt = (r) => {
|
|
|
3592
3815
|
})
|
|
3593
3816
|
};
|
|
3594
3817
|
};
|
|
3595
|
-
class
|
|
3818
|
+
class sr extends Error {
|
|
3596
3819
|
constructor() {
|
|
3597
3820
|
super(...arguments);
|
|
3598
3821
|
i(this, "name", "CanvasBuilderError");
|
|
3599
3822
|
}
|
|
3600
3823
|
}
|
|
3601
|
-
class
|
|
3824
|
+
class Xe {
|
|
3602
3825
|
constructor(e, t, o) {
|
|
3603
3826
|
i(this, "dt");
|
|
3604
3827
|
i(this, "nodeMass");
|
|
@@ -3613,10 +3836,10 @@ class ze {
|
|
|
3613
3836
|
const t = /* @__PURE__ */ new Map();
|
|
3614
3837
|
return this.graph.getAllNodeIds().forEach((s) => {
|
|
3615
3838
|
t.set(s, { x: 0, y: 0 });
|
|
3616
|
-
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s,
|
|
3617
|
-
const
|
|
3618
|
-
x:
|
|
3619
|
-
y:
|
|
3839
|
+
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s, n) => {
|
|
3840
|
+
const a = t.get(n), h = {
|
|
3841
|
+
x: a.x / this.nodeMass * this.dt,
|
|
3842
|
+
y: a.y / this.nodeMass * this.dt
|
|
3620
3843
|
};
|
|
3621
3844
|
e = Math.max(
|
|
3622
3845
|
e,
|
|
@@ -3628,22 +3851,22 @@ class ze {
|
|
|
3628
3851
|
}
|
|
3629
3852
|
applyEdgeForces(e) {
|
|
3630
3853
|
this.graph.getAllEdgeIds().forEach((t) => {
|
|
3631
|
-
const o = this.graph.getEdge(t), s = this.graph.getPort(o.from),
|
|
3632
|
-
|
|
3854
|
+
const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), n = this.graph.getPort(o.to), a = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3855
|
+
a,
|
|
3633
3856
|
h
|
|
3634
|
-
),
|
|
3635
|
-
|
|
3857
|
+
), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, g = d.ex * u, l = d.ey * u, w = e.get(s.nodeId), p = e.get(n.nodeId);
|
|
3858
|
+
w.x += g, w.y += l, p.x -= g, p.y -= l;
|
|
3636
3859
|
});
|
|
3637
3860
|
}
|
|
3638
3861
|
}
|
|
3639
|
-
class
|
|
3862
|
+
class He {
|
|
3640
3863
|
constructor(e) {
|
|
3641
3864
|
i(this, "PI2", 2 * Math.PI);
|
|
3642
3865
|
this.rand = e;
|
|
3643
3866
|
}
|
|
3644
3867
|
create(e, t) {
|
|
3645
|
-
const o = t.x - e.x, s = t.y - e.y,
|
|
3646
|
-
if (
|
|
3868
|
+
const o = t.x - e.x, s = t.y - e.y, n = o * o + s * s;
|
|
3869
|
+
if (n === 0) {
|
|
3647
3870
|
const c = this.PI2 * this.rand();
|
|
3648
3871
|
return {
|
|
3649
3872
|
ex: Math.cos(c),
|
|
@@ -3651,17 +3874,17 @@ class ke {
|
|
|
3651
3874
|
d: 0
|
|
3652
3875
|
};
|
|
3653
3876
|
}
|
|
3654
|
-
const
|
|
3655
|
-
return { ex: h, ey: d, d:
|
|
3877
|
+
const a = Math.sqrt(n), h = o / a, d = s / a;
|
|
3878
|
+
return { ex: h, ey: d, d: a };
|
|
3656
3879
|
}
|
|
3657
3880
|
}
|
|
3658
|
-
const
|
|
3881
|
+
const Ge = (r) => {
|
|
3659
3882
|
if (r.distance === 0)
|
|
3660
3883
|
return r.maxForce;
|
|
3661
3884
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3662
3885
|
return Math.min(e, r.maxForce);
|
|
3663
3886
|
};
|
|
3664
|
-
class
|
|
3887
|
+
class ir {
|
|
3665
3888
|
constructor(e) {
|
|
3666
3889
|
i(this, "nodeCharge");
|
|
3667
3890
|
i(this, "distanceVectorGenerator");
|
|
@@ -3670,25 +3893,25 @@ class rr {
|
|
|
3670
3893
|
}
|
|
3671
3894
|
apply(e, t) {
|
|
3672
3895
|
const o = Array.from(t.keys()), s = o.length;
|
|
3673
|
-
for (let
|
|
3674
|
-
const
|
|
3675
|
-
for (let h =
|
|
3676
|
-
const d = o[h], c = e.get(
|
|
3896
|
+
for (let n = 0; n < s; n++) {
|
|
3897
|
+
const a = o[n];
|
|
3898
|
+
for (let h = n + 1; h < s; h++) {
|
|
3899
|
+
const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
|
|
3677
3900
|
c,
|
|
3678
|
-
|
|
3679
|
-
), l =
|
|
3901
|
+
u
|
|
3902
|
+
), l = Ge({
|
|
3680
3903
|
coefficient: 1,
|
|
3681
3904
|
sourceCharge: this.nodeCharge,
|
|
3682
3905
|
targetCharge: this.nodeCharge,
|
|
3683
|
-
distance:
|
|
3906
|
+
distance: g.d,
|
|
3684
3907
|
maxForce: this.maxForce
|
|
3685
|
-
}),
|
|
3686
|
-
|
|
3908
|
+
}), w = l * g.ex, p = l * g.ey, y = t.get(a), f = t.get(d);
|
|
3909
|
+
y.x -= w, y.y -= p, f.x += w, f.y += p;
|
|
3687
3910
|
}
|
|
3688
3911
|
}
|
|
3689
3912
|
}
|
|
3690
3913
|
}
|
|
3691
|
-
const
|
|
3914
|
+
const nr = (r) => {
|
|
3692
3915
|
if (r.size === 0)
|
|
3693
3916
|
return {
|
|
3694
3917
|
centerX: 0,
|
|
@@ -3699,14 +3922,14 @@ const or = (r) => {
|
|
|
3699
3922
|
r.forEach((d) => {
|
|
3700
3923
|
e = Math.min(e, d.x), t = Math.max(t, d.x), o = Math.min(o, d.y), s = Math.max(s, d.y);
|
|
3701
3924
|
});
|
|
3702
|
-
const
|
|
3925
|
+
const n = t - e, a = s - o, h = Math.max(n, a);
|
|
3703
3926
|
return {
|
|
3704
3927
|
centerX: (e + t) / 2,
|
|
3705
3928
|
centerY: (o + s) / 2,
|
|
3706
3929
|
radius: h / 2
|
|
3707
3930
|
};
|
|
3708
3931
|
};
|
|
3709
|
-
class
|
|
3932
|
+
class ar {
|
|
3710
3933
|
constructor(e) {
|
|
3711
3934
|
i(this, "root");
|
|
3712
3935
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3735,15 +3958,15 @@ class sr {
|
|
|
3735
3958
|
const o = [];
|
|
3736
3959
|
for (; t.length > 0; ) {
|
|
3737
3960
|
const s = t.pop();
|
|
3738
|
-
this.processNode(s).forEach((
|
|
3739
|
-
o.push(
|
|
3961
|
+
this.processNode(s).forEach((a) => {
|
|
3962
|
+
o.push(a);
|
|
3740
3963
|
});
|
|
3741
3964
|
}
|
|
3742
3965
|
t = o;
|
|
3743
3966
|
}
|
|
3744
3967
|
this.sortedParentNodes.reverse().forEach((o) => {
|
|
3745
|
-
let s = 0,
|
|
3746
|
-
o.lb !== null && (
|
|
3968
|
+
let s = 0, n = 0, a = 0, h = 0;
|
|
3969
|
+
o.lb !== null && (a += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, n += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (a += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, n += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (a += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, n += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (a += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, n += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = a, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = n / h;
|
|
3747
3970
|
});
|
|
3748
3971
|
}
|
|
3749
3972
|
getRoot() {
|
|
@@ -3759,21 +3982,21 @@ class sr {
|
|
|
3759
3982
|
if (s < this.areaRadiusThreshold)
|
|
3760
3983
|
return this.setLeaf(e), [];
|
|
3761
3984
|
this.sortedParentNodes.push(e);
|
|
3762
|
-
const
|
|
3985
|
+
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
|
|
3763
3986
|
e.nodeIds.forEach((l) => {
|
|
3764
|
-
const { x:
|
|
3765
|
-
|
|
3987
|
+
const { x: w, y: p } = this.coords.get(l);
|
|
3988
|
+
w < t ? p < o ? d.add(l) : h.add(l) : p < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
|
|
3766
3989
|
});
|
|
3767
|
-
const
|
|
3990
|
+
const u = {
|
|
3768
3991
|
parent: e,
|
|
3769
3992
|
lb: null,
|
|
3770
3993
|
lt: null,
|
|
3771
3994
|
rb: null,
|
|
3772
3995
|
rt: null
|
|
3773
|
-
},
|
|
3774
|
-
if (
|
|
3996
|
+
}, g = [];
|
|
3997
|
+
if (n.size > 0) {
|
|
3775
3998
|
const l = {
|
|
3776
|
-
nodeIds:
|
|
3999
|
+
nodeIds: n,
|
|
3777
4000
|
totalMass: 0,
|
|
3778
4001
|
totalCharge: 0,
|
|
3779
4002
|
chargeCenter: {
|
|
@@ -3785,13 +4008,13 @@ class sr {
|
|
|
3785
4008
|
centerY: o + c,
|
|
3786
4009
|
radius: c
|
|
3787
4010
|
},
|
|
3788
|
-
...
|
|
4011
|
+
...u
|
|
3789
4012
|
};
|
|
3790
|
-
e.rt = l,
|
|
4013
|
+
e.rt = l, g.push(l);
|
|
3791
4014
|
}
|
|
3792
|
-
if (
|
|
4015
|
+
if (a.size > 0) {
|
|
3793
4016
|
const l = {
|
|
3794
|
-
nodeIds:
|
|
4017
|
+
nodeIds: a,
|
|
3795
4018
|
totalMass: 0,
|
|
3796
4019
|
totalCharge: 0,
|
|
3797
4020
|
chargeCenter: {
|
|
@@ -3803,9 +4026,9 @@ class sr {
|
|
|
3803
4026
|
centerY: o - c,
|
|
3804
4027
|
radius: c
|
|
3805
4028
|
},
|
|
3806
|
-
...
|
|
4029
|
+
...u
|
|
3807
4030
|
};
|
|
3808
|
-
e.rb = l,
|
|
4031
|
+
e.rb = l, g.push(l);
|
|
3809
4032
|
}
|
|
3810
4033
|
if (h.size > 0) {
|
|
3811
4034
|
const l = {
|
|
@@ -3821,9 +4044,9 @@ class sr {
|
|
|
3821
4044
|
centerY: o + c,
|
|
3822
4045
|
radius: c
|
|
3823
4046
|
},
|
|
3824
|
-
...
|
|
4047
|
+
...u
|
|
3825
4048
|
};
|
|
3826
|
-
e.lt = l,
|
|
4049
|
+
e.lt = l, g.push(l);
|
|
3827
4050
|
}
|
|
3828
4051
|
if (d.size > 0) {
|
|
3829
4052
|
const l = {
|
|
@@ -3839,11 +4062,11 @@ class sr {
|
|
|
3839
4062
|
centerY: o - c,
|
|
3840
4063
|
radius: c
|
|
3841
4064
|
},
|
|
3842
|
-
...
|
|
4065
|
+
...u
|
|
3843
4066
|
};
|
|
3844
|
-
e.lb = l,
|
|
4067
|
+
e.lb = l, g.push(l);
|
|
3845
4068
|
}
|
|
3846
|
-
return
|
|
4069
|
+
return g;
|
|
3847
4070
|
}
|
|
3848
4071
|
setLeaf(e) {
|
|
3849
4072
|
e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
|
|
@@ -3858,12 +4081,12 @@ class sr {
|
|
|
3858
4081
|
};
|
|
3859
4082
|
let t = 0, o = 0;
|
|
3860
4083
|
return e.forEach((s) => {
|
|
3861
|
-
const
|
|
3862
|
-
t +=
|
|
4084
|
+
const n = this.coords.get(s);
|
|
4085
|
+
t += n.x, o += n.y;
|
|
3863
4086
|
}), { x: t / e.size, y: o / e.size };
|
|
3864
4087
|
}
|
|
3865
4088
|
}
|
|
3866
|
-
class
|
|
4089
|
+
class hr {
|
|
3867
4090
|
constructor(e) {
|
|
3868
4091
|
i(this, "areaRadiusThreshold");
|
|
3869
4092
|
i(this, "nodeMass");
|
|
@@ -3875,24 +4098,24 @@ class ir {
|
|
|
3875
4098
|
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;
|
|
3876
4099
|
}
|
|
3877
4100
|
apply(e, t) {
|
|
3878
|
-
const o =
|
|
4101
|
+
const o = nr(e), s = new ar({
|
|
3879
4102
|
box: o,
|
|
3880
4103
|
coords: e,
|
|
3881
4104
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
3882
4105
|
nodeMass: this.nodeMass,
|
|
3883
4106
|
nodeCharge: this.nodeCharge
|
|
3884
4107
|
});
|
|
3885
|
-
e.forEach((
|
|
4108
|
+
e.forEach((n, a) => {
|
|
3886
4109
|
const h = this.calculateForceForNode(
|
|
3887
|
-
s.getLeaf(
|
|
3888
|
-
|
|
4110
|
+
s.getLeaf(a),
|
|
4111
|
+
a,
|
|
3889
4112
|
e
|
|
3890
|
-
), d = t.get(
|
|
4113
|
+
), d = t.get(a);
|
|
3891
4114
|
this.applyForce(d, h);
|
|
3892
4115
|
});
|
|
3893
4116
|
}
|
|
3894
4117
|
calculateForceForNode(e, t, o) {
|
|
3895
|
-
const s = o.get(t),
|
|
4118
|
+
const s = o.get(t), n = { x: 0, y: 0 };
|
|
3896
4119
|
e.nodeIds.forEach((h) => {
|
|
3897
4120
|
if (h !== t) {
|
|
3898
4121
|
const d = o.get(h), c = this.calculateNodeRepulsiveForce({
|
|
@@ -3901,72 +4124,72 @@ class ir {
|
|
|
3901
4124
|
sourceCoords: d,
|
|
3902
4125
|
targetCoords: s
|
|
3903
4126
|
});
|
|
3904
|
-
this.applyForce(
|
|
4127
|
+
this.applyForce(n, c);
|
|
3905
4128
|
}
|
|
3906
4129
|
});
|
|
3907
|
-
let
|
|
3908
|
-
for (;
|
|
3909
|
-
const h =
|
|
4130
|
+
let a = e;
|
|
4131
|
+
for (; a !== null; ) {
|
|
4132
|
+
const h = a.parent;
|
|
3910
4133
|
if (h !== null) {
|
|
3911
4134
|
const d = this.distanceVectorGenerator.create(
|
|
3912
4135
|
h.chargeCenter,
|
|
3913
4136
|
s
|
|
3914
4137
|
);
|
|
3915
4138
|
h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
|
|
3916
|
-
totalForce:
|
|
4139
|
+
totalForce: n,
|
|
3917
4140
|
targetCoords: s,
|
|
3918
4141
|
target: h.lb,
|
|
3919
|
-
current:
|
|
4142
|
+
current: a
|
|
3920
4143
|
}), this.tryApplyFarForce({
|
|
3921
|
-
totalForce:
|
|
4144
|
+
totalForce: n,
|
|
3922
4145
|
targetCoords: s,
|
|
3923
4146
|
target: h.rb,
|
|
3924
|
-
current:
|
|
4147
|
+
current: a
|
|
3925
4148
|
}), this.tryApplyFarForce({
|
|
3926
|
-
totalForce:
|
|
4149
|
+
totalForce: n,
|
|
3927
4150
|
targetCoords: s,
|
|
3928
4151
|
target: h.rt,
|
|
3929
|
-
current:
|
|
4152
|
+
current: a
|
|
3930
4153
|
}), this.tryApplyFarForce({
|
|
3931
|
-
totalForce:
|
|
4154
|
+
totalForce: n,
|
|
3932
4155
|
targetCoords: s,
|
|
3933
4156
|
target: h.lt,
|
|
3934
|
-
current:
|
|
4157
|
+
current: a
|
|
3935
4158
|
})) : (this.tryApplyNearForce({
|
|
3936
|
-
totalForce:
|
|
4159
|
+
totalForce: n,
|
|
3937
4160
|
targetCoords: s,
|
|
3938
4161
|
target: h.lb,
|
|
3939
|
-
current:
|
|
4162
|
+
current: a,
|
|
3940
4163
|
nodesCoords: o
|
|
3941
4164
|
}), this.tryApplyNearForce({
|
|
3942
|
-
totalForce:
|
|
4165
|
+
totalForce: n,
|
|
3943
4166
|
targetCoords: s,
|
|
3944
4167
|
target: h.rb,
|
|
3945
|
-
current:
|
|
4168
|
+
current: a,
|
|
3946
4169
|
nodesCoords: o
|
|
3947
4170
|
}), this.tryApplyNearForce({
|
|
3948
|
-
totalForce:
|
|
4171
|
+
totalForce: n,
|
|
3949
4172
|
targetCoords: s,
|
|
3950
4173
|
target: h.rt,
|
|
3951
|
-
current:
|
|
4174
|
+
current: a,
|
|
3952
4175
|
nodesCoords: o
|
|
3953
4176
|
}), this.tryApplyNearForce({
|
|
3954
|
-
totalForce:
|
|
4177
|
+
totalForce: n,
|
|
3955
4178
|
targetCoords: s,
|
|
3956
4179
|
target: h.lt,
|
|
3957
|
-
current:
|
|
4180
|
+
current: a,
|
|
3958
4181
|
nodesCoords: o
|
|
3959
4182
|
}));
|
|
3960
4183
|
}
|
|
3961
|
-
|
|
4184
|
+
a = a.parent;
|
|
3962
4185
|
}
|
|
3963
|
-
return
|
|
4186
|
+
return n;
|
|
3964
4187
|
}
|
|
3965
4188
|
calculateExactForce(e, t, o) {
|
|
3966
|
-
const s = { x: 0, y: 0 },
|
|
3967
|
-
for (;
|
|
3968
|
-
const
|
|
3969
|
-
|
|
4189
|
+
const s = { x: 0, y: 0 }, n = [e];
|
|
4190
|
+
for (; n.length > 0; ) {
|
|
4191
|
+
const a = n.pop();
|
|
4192
|
+
a.nodeIds.forEach((h) => {
|
|
3970
4193
|
const d = o.get(h), c = this.calculateNodeRepulsiveForce({
|
|
3971
4194
|
sourceCharge: this.nodeCharge,
|
|
3972
4195
|
targetCharge: this.nodeCharge,
|
|
@@ -3974,7 +4197,7 @@ class ir {
|
|
|
3974
4197
|
targetCoords: t
|
|
3975
4198
|
});
|
|
3976
4199
|
this.applyForce(s, c);
|
|
3977
|
-
}),
|
|
4200
|
+
}), 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);
|
|
3978
4201
|
}
|
|
3979
4202
|
return s;
|
|
3980
4203
|
}
|
|
@@ -3990,7 +4213,7 @@ class ir {
|
|
|
3990
4213
|
const t = this.distanceVectorGenerator.create(
|
|
3991
4214
|
e.sourceCoords,
|
|
3992
4215
|
e.targetCoords
|
|
3993
|
-
), o =
|
|
4216
|
+
), o = Ge({
|
|
3994
4217
|
coefficient: this.nodeForceCoefficient,
|
|
3995
4218
|
sourceCharge: e.sourceCharge,
|
|
3996
4219
|
targetCharge: e.targetCharge,
|
|
@@ -4025,7 +4248,7 @@ class ir {
|
|
|
4025
4248
|
}
|
|
4026
4249
|
}
|
|
4027
4250
|
}
|
|
4028
|
-
const
|
|
4251
|
+
const je = (r) => r.theta !== 0 ? new hr({
|
|
4029
4252
|
nodeCharge: r.nodeCharge,
|
|
4030
4253
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4031
4254
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -4033,36 +4256,36 @@ const Ye = (r) => r.theta !== 0 ? new ir({
|
|
|
4033
4256
|
theta: r.theta,
|
|
4034
4257
|
nodeMass: r.nodeMass,
|
|
4035
4258
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
4036
|
-
}) : new
|
|
4259
|
+
}) : new ir({
|
|
4037
4260
|
nodeCharge: r.nodeCharge,
|
|
4038
4261
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4039
4262
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
4040
4263
|
maxForce: r.maxForce
|
|
4041
4264
|
});
|
|
4042
|
-
class
|
|
4265
|
+
class Je {
|
|
4043
4266
|
constructor(e) {
|
|
4044
4267
|
i(this, "rand");
|
|
4045
4268
|
i(this, "sparsity");
|
|
4046
4269
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
4047
4270
|
}
|
|
4048
4271
|
calculateCoordinates(e) {
|
|
4049
|
-
const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(),
|
|
4050
|
-
const
|
|
4051
|
-
return
|
|
4052
|
-
}),
|
|
4053
|
-
x:
|
|
4054
|
-
y:
|
|
4272
|
+
const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((p) => {
|
|
4273
|
+
const y = t.getNode(p);
|
|
4274
|
+
return y.x === null || y.y === null;
|
|
4275
|
+
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), g = a / 2, l = {
|
|
4276
|
+
x: u.x - g,
|
|
4277
|
+
y: u.y - g
|
|
4055
4278
|
};
|
|
4056
|
-
return t.getAllNodeIds().forEach((
|
|
4057
|
-
const
|
|
4058
|
-
s.set(
|
|
4059
|
-
x:
|
|
4060
|
-
y:
|
|
4279
|
+
return t.getAllNodeIds().forEach((p) => {
|
|
4280
|
+
const y = t.getNode(p);
|
|
4281
|
+
s.set(p, {
|
|
4282
|
+
x: y.x ?? l.x + a * this.rand(),
|
|
4283
|
+
y: y.y ?? l.y + a * this.rand()
|
|
4061
4284
|
});
|
|
4062
4285
|
}), s;
|
|
4063
4286
|
}
|
|
4064
4287
|
}
|
|
4065
|
-
class
|
|
4288
|
+
class dr {
|
|
4066
4289
|
constructor(e) {
|
|
4067
4290
|
i(this, "distanceVectorGenerator");
|
|
4068
4291
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4073,7 +4296,7 @@ class nr {
|
|
|
4073
4296
|
i(this, "edgeEquilibriumLength");
|
|
4074
4297
|
i(this, "edgeStiffness");
|
|
4075
4298
|
i(this, "convergenceVelocity");
|
|
4076
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new
|
|
4299
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new He(e.rand), this.nodeForcesApplicationStrategy = je({
|
|
4077
4300
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4078
4301
|
nodeCharge: e.nodeCharge,
|
|
4079
4302
|
maxForce: e.maxForce,
|
|
@@ -4081,7 +4304,7 @@ class nr {
|
|
|
4081
4304
|
theta: e.barnesHutTheta,
|
|
4082
4305
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4083
4306
|
nodeMass: e.nodeMass
|
|
4084
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4307
|
+
}), this.fillerLayoutAlgorithm = new Je({
|
|
4085
4308
|
rand: e.rand,
|
|
4086
4309
|
sparsity: e.edgeEquilibriumLength
|
|
4087
4310
|
});
|
|
@@ -4091,7 +4314,7 @@ class nr {
|
|
|
4091
4314
|
graph: t,
|
|
4092
4315
|
viewport: o
|
|
4093
4316
|
});
|
|
4094
|
-
for (let
|
|
4317
|
+
for (let n = 0; n < this.maxIterations && !(new Xe(
|
|
4095
4318
|
t,
|
|
4096
4319
|
s,
|
|
4097
4320
|
{
|
|
@@ -4102,12 +4325,12 @@ class nr {
|
|
|
4102
4325
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4103
4326
|
edgeStiffness: this.edgeStiffness
|
|
4104
4327
|
}
|
|
4105
|
-
).apply() < this.convergenceVelocity);
|
|
4328
|
+
).apply() < this.convergenceVelocity); n++)
|
|
4106
4329
|
;
|
|
4107
4330
|
return s;
|
|
4108
4331
|
}
|
|
4109
4332
|
}
|
|
4110
|
-
class
|
|
4333
|
+
class cr {
|
|
4111
4334
|
constructor(e) {
|
|
4112
4335
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
4113
4336
|
i(this, "remainingNodeIds");
|
|
@@ -4127,93 +4350,93 @@ class ar {
|
|
|
4127
4350
|
this.forest.add({ root: t, sequence: o });
|
|
4128
4351
|
let s = [t];
|
|
4129
4352
|
for (this.remainingNodeIds.delete(t.nodeId); s.length > 0; ) {
|
|
4130
|
-
const
|
|
4131
|
-
s.forEach((
|
|
4132
|
-
o.push(
|
|
4133
|
-
const h = this.graph.getNodeOutgoingEdgeIds(
|
|
4134
|
-
const
|
|
4135
|
-
return this.graph.getPort(
|
|
4136
|
-
}), d = this.graph.getNodeIncomingEdgeIds(
|
|
4137
|
-
const
|
|
4138
|
-
return this.graph.getPort(
|
|
4353
|
+
const n = [];
|
|
4354
|
+
s.forEach((a) => {
|
|
4355
|
+
o.push(a);
|
|
4356
|
+
const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((u) => {
|
|
4357
|
+
const g = this.graph.getEdge(u);
|
|
4358
|
+
return this.graph.getPort(g.to).nodeId;
|
|
4359
|
+
}), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((u) => {
|
|
4360
|
+
const g = this.graph.getEdge(u);
|
|
4361
|
+
return this.graph.getPort(g.from).nodeId;
|
|
4139
4362
|
});
|
|
4140
4363
|
(/* @__PURE__ */ new Set([
|
|
4141
4364
|
...h,
|
|
4142
4365
|
...d
|
|
4143
|
-
])).forEach((
|
|
4144
|
-
if (!this.remainingNodeIds.has(
|
|
4366
|
+
])).forEach((u) => {
|
|
4367
|
+
if (!this.remainingNodeIds.has(u))
|
|
4145
4368
|
return;
|
|
4146
|
-
this.remainingNodeIds.delete(
|
|
4147
|
-
const
|
|
4148
|
-
nodeId:
|
|
4369
|
+
this.remainingNodeIds.delete(u);
|
|
4370
|
+
const g = {
|
|
4371
|
+
nodeId: u,
|
|
4149
4372
|
children: /* @__PURE__ */ new Set()
|
|
4150
4373
|
};
|
|
4151
|
-
|
|
4374
|
+
a.children.add(g), n.push(g);
|
|
4152
4375
|
});
|
|
4153
|
-
}), s =
|
|
4376
|
+
}), s = n;
|
|
4154
4377
|
}
|
|
4155
4378
|
}
|
|
4156
4379
|
}
|
|
4157
|
-
class
|
|
4380
|
+
class lr {
|
|
4158
4381
|
constructor(e) {
|
|
4159
4382
|
this.params = e;
|
|
4160
4383
|
}
|
|
4161
4384
|
generate(e) {
|
|
4162
4385
|
let t = 0;
|
|
4163
|
-
const o = [], s = e.length - 1,
|
|
4386
|
+
const o = [], s = e.length - 1, n = [];
|
|
4164
4387
|
e.forEach((h, d) => {
|
|
4165
|
-
if (t += this.params.spaceAroundRadius, h.forEach((c,
|
|
4166
|
-
|
|
4388
|
+
if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
|
|
4389
|
+
n[u] === void 0 ? n[u] = {
|
|
4167
4390
|
start: t + c.start,
|
|
4168
4391
|
end: t + c.end
|
|
4169
|
-
} :
|
|
4392
|
+
} : n[u].end = t + c.end;
|
|
4170
4393
|
}), o.push(t), d !== s) {
|
|
4171
|
-
const c = e[d + 1],
|
|
4172
|
-
start:
|
|
4173
|
-
end:
|
|
4394
|
+
const c = e[d + 1], u = n.map((g) => ({
|
|
4395
|
+
start: g.start - t,
|
|
4396
|
+
end: g.end - t
|
|
4174
4397
|
}));
|
|
4175
|
-
t += this.calculateMaxDiff(
|
|
4398
|
+
t += this.calculateMaxDiff(u, c);
|
|
4176
4399
|
}
|
|
4177
4400
|
t += this.params.spaceAroundRadius;
|
|
4178
4401
|
});
|
|
4179
|
-
const
|
|
4402
|
+
const a = t / 2;
|
|
4180
4403
|
return {
|
|
4181
|
-
childOffsets: o.map((h) => h -
|
|
4182
|
-
subtreeSpans:
|
|
4183
|
-
start: h.start -
|
|
4184
|
-
end: h.end -
|
|
4404
|
+
childOffsets: o.map((h) => h - a),
|
|
4405
|
+
subtreeSpans: n.map((h) => ({
|
|
4406
|
+
start: h.start - a,
|
|
4407
|
+
end: h.end - a
|
|
4185
4408
|
}))
|
|
4186
4409
|
};
|
|
4187
4410
|
}
|
|
4188
4411
|
calculateMaxDiff(e, t) {
|
|
4189
4412
|
let o = 0;
|
|
4190
4413
|
const s = Math.min(e.length, t.length);
|
|
4191
|
-
for (let
|
|
4192
|
-
const
|
|
4193
|
-
o = Math.max(o,
|
|
4414
|
+
for (let n = 0; n < s; n++) {
|
|
4415
|
+
const a = e[n].end - t[n].start;
|
|
4416
|
+
o = Math.max(o, a);
|
|
4194
4417
|
}
|
|
4195
4418
|
return o - 2 * this.params.spaceAroundRadius;
|
|
4196
4419
|
}
|
|
4197
4420
|
}
|
|
4198
|
-
class
|
|
4421
|
+
class ur {
|
|
4199
4422
|
constructor(e, t) {
|
|
4200
4423
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
4201
4424
|
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
4202
4425
|
this.tree = e;
|
|
4203
|
-
const o = t.spaceAroundRadius, s = new
|
|
4426
|
+
const o = t.spaceAroundRadius, s = new lr({
|
|
4204
4427
|
spaceAroundRadius: o
|
|
4205
4428
|
});
|
|
4206
|
-
[...this.tree.sequence].reverse().forEach((
|
|
4207
|
-
const
|
|
4429
|
+
[...this.tree.sequence].reverse().forEach((n) => {
|
|
4430
|
+
const a = Array.from(n.children).map(
|
|
4208
4431
|
(c) => this.treeSpans.get(c.nodeId)
|
|
4209
|
-
), h = s.generate(
|
|
4432
|
+
), h = s.generate(a);
|
|
4210
4433
|
let d = 0;
|
|
4211
|
-
|
|
4434
|
+
n.children.forEach((c) => {
|
|
4212
4435
|
this.offsets.set(c.nodeId, h.childOffsets[d]), d++;
|
|
4213
|
-
}), this.treeSpans.set(
|
|
4436
|
+
}), this.treeSpans.set(n.nodeId, [
|
|
4214
4437
|
{ start: -o, end: o },
|
|
4215
4438
|
...h.subtreeSpans
|
|
4216
|
-
]),
|
|
4439
|
+
]), n.children.forEach((c) => {
|
|
4217
4440
|
this.treeSpans.delete(c.nodeId);
|
|
4218
4441
|
});
|
|
4219
4442
|
}), this.offsets.set(this.tree.root.nodeId, 0);
|
|
@@ -4222,37 +4445,37 @@ class dr {
|
|
|
4222
4445
|
return this.offsets;
|
|
4223
4446
|
}
|
|
4224
4447
|
}
|
|
4225
|
-
class
|
|
4448
|
+
class gr {
|
|
4226
4449
|
constructor(e) {
|
|
4227
4450
|
this.params = e;
|
|
4228
4451
|
}
|
|
4229
4452
|
calculateCoordinates(e) {
|
|
4230
|
-
const t = /* @__PURE__ */ new Map(), s = new
|
|
4231
|
-
let
|
|
4232
|
-
return s.forEach((
|
|
4233
|
-
t.set(
|
|
4234
|
-
const d = new
|
|
4453
|
+
const t = /* @__PURE__ */ new Map(), s = new cr(e.graph).generate();
|
|
4454
|
+
let n = 0;
|
|
4455
|
+
return s.forEach((a) => {
|
|
4456
|
+
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
4457
|
+
const d = new ur(a, {
|
|
4235
4458
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
4236
4459
|
}).generate();
|
|
4237
|
-
let c = [
|
|
4460
|
+
let c = [a.root];
|
|
4238
4461
|
for (; c.length > 0; ) {
|
|
4239
|
-
const
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
const
|
|
4462
|
+
const u = [];
|
|
4463
|
+
n += this.params.layerWidth, c.forEach((g) => {
|
|
4464
|
+
g.children.forEach((l) => {
|
|
4465
|
+
const w = t.get(g.nodeId).y;
|
|
4243
4466
|
t.set(l.nodeId, {
|
|
4244
|
-
y:
|
|
4245
|
-
x:
|
|
4246
|
-
}),
|
|
4467
|
+
y: w + d.get(l.nodeId),
|
|
4468
|
+
x: n
|
|
4469
|
+
}), u.push(l);
|
|
4247
4470
|
});
|
|
4248
|
-
}), c =
|
|
4471
|
+
}), c = u;
|
|
4249
4472
|
}
|
|
4250
|
-
}), t.forEach((
|
|
4251
|
-
t.set(h, this.params.transform(
|
|
4473
|
+
}), t.forEach((a, h) => {
|
|
4474
|
+
t.set(h, this.params.transform(a));
|
|
4252
4475
|
}), t;
|
|
4253
4476
|
}
|
|
4254
4477
|
}
|
|
4255
|
-
class
|
|
4478
|
+
class pr {
|
|
4256
4479
|
constructor(e) {
|
|
4257
4480
|
i(this, "distanceVectorGenerator");
|
|
4258
4481
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4262,7 +4485,7 @@ class lr {
|
|
|
4262
4485
|
i(this, "edgeEquilibriumLength");
|
|
4263
4486
|
i(this, "edgeStiffness");
|
|
4264
4487
|
i(this, "fillerLayoutAlgorithm");
|
|
4265
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4488
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new He(e.rand), this.nodeForcesApplicationStrategy = je({
|
|
4266
4489
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4267
4490
|
nodeCharge: e.nodeCharge,
|
|
4268
4491
|
maxForce: e.maxForce,
|
|
@@ -4270,19 +4493,19 @@ class lr {
|
|
|
4270
4493
|
theta: e.barnesHutTheta,
|
|
4271
4494
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4272
4495
|
nodeMass: e.nodeMass
|
|
4273
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4496
|
+
}), this.fillerLayoutAlgorithm = new Je({
|
|
4274
4497
|
rand: e.rand,
|
|
4275
4498
|
sparsity: e.edgeEquilibriumLength
|
|
4276
4499
|
});
|
|
4277
4500
|
}
|
|
4278
4501
|
calculateNextCoordinates(e) {
|
|
4279
|
-
const { graph: t, viewport: o, dt: s } = e,
|
|
4502
|
+
const { graph: t, viewport: o, dt: s } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
|
|
4280
4503
|
graph: t,
|
|
4281
4504
|
viewport: o
|
|
4282
4505
|
});
|
|
4283
|
-
return new
|
|
4506
|
+
return new Xe(
|
|
4284
4507
|
t,
|
|
4285
|
-
|
|
4508
|
+
n,
|
|
4286
4509
|
{
|
|
4287
4510
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4288
4511
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
@@ -4292,21 +4515,21 @@ class lr {
|
|
|
4292
4515
|
edgeStiffness: this.edgeStiffness
|
|
4293
4516
|
}
|
|
4294
4517
|
).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
|
|
4295
|
-
const
|
|
4296
|
-
return
|
|
4297
|
-
}) ? /* @__PURE__ */ new Map() :
|
|
4518
|
+
const u = t.getNode(c);
|
|
4519
|
+
return u.x === null || u.y === null;
|
|
4520
|
+
}) ? /* @__PURE__ */ new Map() : n;
|
|
4298
4521
|
}
|
|
4299
4522
|
}
|
|
4300
|
-
const
|
|
4523
|
+
const Ke = (r) => {
|
|
4301
4524
|
let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
|
|
4302
|
-
for (let
|
|
4303
|
-
|
|
4525
|
+
for (let n = 0, a; n < r.length; n++)
|
|
4526
|
+
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
|
|
4304
4527
|
return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
|
|
4305
|
-
},
|
|
4528
|
+
}, Qe = (r, e, t, o) => function() {
|
|
4306
4529
|
r |= 0, e |= 0, t |= 0, o |= 0;
|
|
4307
4530
|
const s = (r + e | 0) + o | 0;
|
|
4308
4531
|
return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
|
|
4309
|
-
},
|
|
4532
|
+
}, A = Object.freeze({
|
|
4310
4533
|
seed: "HTMLGraph is awesome",
|
|
4311
4534
|
maxTimeDeltaSec: 0.01,
|
|
4312
4535
|
nodeCharge: 1e5,
|
|
@@ -4320,51 +4543,55 @@ const Ge = (r) => {
|
|
|
4320
4543
|
nodeForceCoefficient: 1,
|
|
4321
4544
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4322
4545
|
barnesHutTheta: 1
|
|
4323
|
-
}),
|
|
4546
|
+
}), F = Object.freeze({
|
|
4547
|
+
mouseDownEventVerifier: (r) => r.button === 0,
|
|
4548
|
+
mouseUpEventVerifier: (r) => r.button === 0,
|
|
4549
|
+
movementThreshold: 10
|
|
4550
|
+
}), wr = (r) => {
|
|
4324
4551
|
var e, t;
|
|
4325
4552
|
switch (r == null ? void 0 : r.type) {
|
|
4326
4553
|
case "custom":
|
|
4327
4554
|
return r.instance;
|
|
4328
4555
|
default: {
|
|
4329
|
-
const o =
|
|
4330
|
-
return new
|
|
4556
|
+
const o = Ke((r == null ? void 0 : r.seed) ?? A.seed), s = Qe(o[0], o[1], o[2], o[3]);
|
|
4557
|
+
return new pr({
|
|
4331
4558
|
rand: s,
|
|
4332
|
-
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ??
|
|
4333
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4334
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4335
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4336
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4337
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4338
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4339
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4340
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4341
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4559
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4560
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4561
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4562
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4563
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4564
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4565
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4566
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4567
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4568
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4342
4569
|
});
|
|
4343
4570
|
}
|
|
4344
4571
|
}
|
|
4345
|
-
},
|
|
4572
|
+
}, Q = {
|
|
4346
4573
|
staticNodeResolver: () => !1,
|
|
4347
4574
|
onBeforeApplied: () => {
|
|
4348
4575
|
},
|
|
4349
4576
|
onAfterApplied: () => {
|
|
4350
4577
|
}
|
|
4351
|
-
},
|
|
4578
|
+
}, yr = (r) => {
|
|
4352
4579
|
var t, o;
|
|
4353
4580
|
return {
|
|
4354
|
-
algorithm:
|
|
4355
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4356
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4357
|
-
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ??
|
|
4581
|
+
algorithm: wr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4582
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Q.staticNodeResolver,
|
|
4583
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? Q.onBeforeApplied,
|
|
4584
|
+
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? Q.onAfterApplied
|
|
4358
4585
|
};
|
|
4359
|
-
},
|
|
4586
|
+
}, fr = (r) => r instanceof q ? {
|
|
4360
4587
|
type: "trigger",
|
|
4361
4588
|
trigger: r
|
|
4362
4589
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4363
4590
|
type: "topologyChangeSchedule",
|
|
4364
|
-
schedule:
|
|
4591
|
+
schedule: It
|
|
4365
4592
|
} : {
|
|
4366
4593
|
type: "topologyChangeSchedule",
|
|
4367
|
-
schedule:
|
|
4594
|
+
schedule: Ut
|
|
4368
4595
|
}, B = Object.freeze({
|
|
4369
4596
|
staticNodeResolver: () => !1,
|
|
4370
4597
|
onBeforeApplied: () => {
|
|
@@ -4375,25 +4602,25 @@ const Ge = (r) => {
|
|
|
4375
4602
|
layerWidth: 300,
|
|
4376
4603
|
layerSpace: 300
|
|
4377
4604
|
}
|
|
4378
|
-
}),
|
|
4605
|
+
}), k = (r, e) => ({
|
|
4379
4606
|
a: r.a * e.a + r.b * e.d,
|
|
4380
4607
|
b: r.a * e.b + r.b * e.e,
|
|
4381
4608
|
c: r.a * e.c + r.b * e.f + r.c,
|
|
4382
4609
|
d: r.d * e.a + r.e * e.d,
|
|
4383
4610
|
e: r.d * e.b + r.e * e.e,
|
|
4384
4611
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4385
|
-
}),
|
|
4386
|
-
const { a: e, b: t, c: o, d: s, e:
|
|
4612
|
+
}), vr = (r) => {
|
|
4613
|
+
const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
|
|
4387
4614
|
return {
|
|
4388
|
-
a:
|
|
4615
|
+
a: n / h,
|
|
4389
4616
|
b: -t / h,
|
|
4390
|
-
c: (t *
|
|
4617
|
+
c: (t * a - o * n) / h,
|
|
4391
4618
|
d: -s / h,
|
|
4392
4619
|
e: e / h,
|
|
4393
|
-
f: (o * s - e *
|
|
4620
|
+
f: (o * s - e * a) / h
|
|
4394
4621
|
};
|
|
4395
4622
|
};
|
|
4396
|
-
class
|
|
4623
|
+
class mr {
|
|
4397
4624
|
resolve(e) {
|
|
4398
4625
|
if ("shift" in e)
|
|
4399
4626
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4427,18 +4654,18 @@ class wr {
|
|
|
4427
4654
|
return this.createRelativeTransform(o, s);
|
|
4428
4655
|
}
|
|
4429
4656
|
createMirrorRelativeMatrix(e, t) {
|
|
4430
|
-
const o = this.createMirrorYBaseMatrix(), s =
|
|
4657
|
+
const o = this.createMirrorYBaseMatrix(), s = k(
|
|
4431
4658
|
this.createShiftBaseMatrix(t),
|
|
4432
4659
|
this.createRotateBaseMatrix(e)
|
|
4433
4660
|
);
|
|
4434
4661
|
return this.createRelativeTransform(o, s);
|
|
4435
4662
|
}
|
|
4436
4663
|
createRelativeTransform(e, t) {
|
|
4437
|
-
const o =
|
|
4664
|
+
const o = k(
|
|
4438
4665
|
t,
|
|
4439
4666
|
e
|
|
4440
|
-
), s =
|
|
4441
|
-
return
|
|
4667
|
+
), s = vr(t);
|
|
4668
|
+
return k(o, s);
|
|
4442
4669
|
}
|
|
4443
4670
|
createShiftBaseMatrix(e) {
|
|
4444
4671
|
return {
|
|
@@ -4482,7 +4709,7 @@ class wr {
|
|
|
4482
4709
|
};
|
|
4483
4710
|
}
|
|
4484
4711
|
}
|
|
4485
|
-
const
|
|
4712
|
+
const xr = (r) => {
|
|
4486
4713
|
if (r === void 0)
|
|
4487
4714
|
return (s) => s;
|
|
4488
4715
|
if (typeof r == "function")
|
|
@@ -4496,56 +4723,56 @@ const fr = (r) => {
|
|
|
4496
4723
|
e: 1,
|
|
4497
4724
|
f: 0
|
|
4498
4725
|
};
|
|
4499
|
-
const o = new
|
|
4726
|
+
const o = new mr();
|
|
4500
4727
|
return e.forEach((s) => {
|
|
4501
|
-
const
|
|
4502
|
-
t =
|
|
4728
|
+
const n = o.resolve(s);
|
|
4729
|
+
t = k(t, n);
|
|
4503
4730
|
}), (s) => {
|
|
4504
|
-
const { x:
|
|
4731
|
+
const { x: n, y: a } = s;
|
|
4505
4732
|
return {
|
|
4506
|
-
x: t.a *
|
|
4507
|
-
y: t.d *
|
|
4733
|
+
x: t.a * n + t.b * a + t.c,
|
|
4734
|
+
y: t.d * n + t.e * a + t.f
|
|
4508
4735
|
};
|
|
4509
4736
|
};
|
|
4510
|
-
},
|
|
4737
|
+
}, Er = (r) => {
|
|
4511
4738
|
var e, t;
|
|
4512
4739
|
switch (r == null ? void 0 : r.type) {
|
|
4513
4740
|
case "custom":
|
|
4514
4741
|
return r.instance;
|
|
4515
4742
|
case "hierarchical":
|
|
4516
|
-
return new
|
|
4743
|
+
return new gr({
|
|
4517
4744
|
layerWidth: r.layerWidth ?? B.hierarchicalLayout.layerWidth,
|
|
4518
4745
|
layerSpace: r.layerSpace ?? B.hierarchicalLayout.layerSpace,
|
|
4519
|
-
transform:
|
|
4746
|
+
transform: xr(r.transform)
|
|
4520
4747
|
});
|
|
4521
4748
|
default: {
|
|
4522
|
-
const o =
|
|
4523
|
-
return new
|
|
4524
|
-
dtSec: (r == null ? void 0 : r.dtSec) ??
|
|
4525
|
-
maxIterations: (r == null ? void 0 : r.maxIterations) ??
|
|
4749
|
+
const o = Ke((r == null ? void 0 : r.seed) ?? A.seed), s = Qe(o[0], o[1], o[2], o[3]);
|
|
4750
|
+
return new dr({
|
|
4751
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4752
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
4526
4753
|
rand: s,
|
|
4527
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4528
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4529
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4530
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4531
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4532
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4533
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4534
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4535
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4754
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4755
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4756
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4757
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4758
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4759
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4760
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4761
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4762
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4536
4763
|
});
|
|
4537
4764
|
}
|
|
4538
4765
|
}
|
|
4539
|
-
},
|
|
4766
|
+
}, Ar = (r) => {
|
|
4540
4767
|
var e, t;
|
|
4541
4768
|
return {
|
|
4542
|
-
algorithm:
|
|
4543
|
-
applyOn:
|
|
4769
|
+
algorithm: Er(r.algorithm),
|
|
4770
|
+
applyOn: fr(r.applyOn),
|
|
4544
4771
|
staticNodeResolver: r.staticNodeResolver ?? B.staticNodeResolver,
|
|
4545
4772
|
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? B.onBeforeApplied,
|
|
4546
4773
|
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? B.onAfterApplied
|
|
4547
4774
|
};
|
|
4548
|
-
},
|
|
4775
|
+
}, Sr = (r, e) => ({
|
|
4549
4776
|
...r,
|
|
4550
4777
|
onNodeDragStarted: (t) => {
|
|
4551
4778
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4553,7 +4780,7 @@ const fr = (r) => {
|
|
|
4553
4780
|
onNodeDragFinished: (t) => {
|
|
4554
4781
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4555
4782
|
}
|
|
4556
|
-
}),
|
|
4783
|
+
}), Nr = (r, e) => {
|
|
4557
4784
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4558
4785
|
e.delete(t);
|
|
4559
4786
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4561,51 +4788,67 @@ const fr = (r) => {
|
|
|
4561
4788
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4562
4789
|
e.clear();
|
|
4563
4790
|
});
|
|
4564
|
-
},
|
|
4791
|
+
}, br = (r, e) => ({
|
|
4565
4792
|
...r,
|
|
4566
4793
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4567
|
-
}),
|
|
4794
|
+
}), _ = (r) => () => r, Ne = _(0), Pr = () => {
|
|
4568
4795
|
let r = 0;
|
|
4569
4796
|
return () => r++;
|
|
4570
|
-
},
|
|
4571
|
-
let t =
|
|
4572
|
-
const s =
|
|
4573
|
-
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t =
|
|
4797
|
+
}, Tr = (r, e) => {
|
|
4798
|
+
let t = Ne, o = Ne;
|
|
4799
|
+
const s = Pr();
|
|
4800
|
+
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = _(r)), typeof e == "number" && (o = _(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
|
|
4574
4801
|
nodesPriorityFn: t,
|
|
4575
4802
|
edgesPriorityFn: o
|
|
4576
4803
|
};
|
|
4577
|
-
},
|
|
4578
|
-
var t, o, s,
|
|
4579
|
-
const e =
|
|
4804
|
+
}, Cr = (r) => {
|
|
4805
|
+
var t, o, s, n, a;
|
|
4806
|
+
const e = Tr(
|
|
4580
4807
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4581
4808
|
(o = r.edges) == null ? void 0 : o.priority
|
|
4582
4809
|
);
|
|
4583
4810
|
return {
|
|
4584
4811
|
nodes: {
|
|
4585
|
-
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ??
|
|
4812
|
+
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? De,
|
|
4586
4813
|
priorityFn: e.nodesPriorityFn
|
|
4587
4814
|
},
|
|
4588
4815
|
ports: {
|
|
4589
|
-
direction: ((
|
|
4816
|
+
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4590
4817
|
},
|
|
4591
4818
|
edges: {
|
|
4592
|
-
shapeFactory:
|
|
4819
|
+
shapeFactory: pe(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4593
4820
|
priorityFn: e.edgesPriorityFn
|
|
4594
4821
|
}
|
|
4595
4822
|
};
|
|
4596
|
-
},
|
|
4597
|
-
var o, s,
|
|
4598
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4823
|
+
}, Mr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Dr = (r) => {
|
|
4824
|
+
var o, s, n, a;
|
|
4825
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Mr(r.layoutParams) : oe;
|
|
4599
4826
|
return {
|
|
4600
4827
|
focus: {
|
|
4601
4828
|
contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
4602
|
-
minContentScale: ((
|
|
4829
|
+
minContentScale: ((n = e.focus) == null ? void 0 : n.minContentScale) ?? 0,
|
|
4603
4830
|
schedule: t,
|
|
4604
|
-
animationDuration: ((
|
|
4831
|
+
animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
|
|
4605
4832
|
}
|
|
4606
4833
|
};
|
|
4607
|
-
}
|
|
4608
|
-
|
|
4834
|
+
}, Lr = (r, e, t, o) => ({
|
|
4835
|
+
canvas: r,
|
|
4836
|
+
element: e,
|
|
4837
|
+
window: t,
|
|
4838
|
+
onNodeSelected: o.onNodeSelected,
|
|
4839
|
+
mouseDownEventVerifier: o.mouseDownEventVerifier ?? F.mouseDownEventVerifier,
|
|
4840
|
+
mouseUpEventVerifier: o.mouseUpEventVerifier ?? F.mouseUpEventVerifier,
|
|
4841
|
+
movementThreshold: o.movementThreshold ?? F.movementThreshold
|
|
4842
|
+
}), Rr = (r, e, t, o) => ({
|
|
4843
|
+
canvas: r,
|
|
4844
|
+
element: e,
|
|
4845
|
+
window: t,
|
|
4846
|
+
onCanvasSelected: o.onCanvasSelected,
|
|
4847
|
+
mouseDownEventVerifier: o.mouseDownEventVerifier ?? F.mouseDownEventVerifier,
|
|
4848
|
+
mouseUpEventVerifier: o.mouseUpEventVerifier ?? F.mouseUpEventVerifier,
|
|
4849
|
+
movementThreshold: o.movementThreshold ?? F.movementThreshold
|
|
4850
|
+
});
|
|
4851
|
+
class Ir {
|
|
4609
4852
|
constructor(e) {
|
|
4610
4853
|
i(this, "used", !1);
|
|
4611
4854
|
i(this, "canvasDefaults", {});
|
|
@@ -4617,6 +4860,8 @@ class Dr {
|
|
|
4617
4860
|
i(this, "virtualScrollConfig");
|
|
4618
4861
|
i(this, "layoutConfig", {});
|
|
4619
4862
|
i(this, "animatedLayoutConfig", {});
|
|
4863
|
+
i(this, "userSelectableNodesConfig");
|
|
4864
|
+
i(this, "userSelectableCanvasConfig");
|
|
4620
4865
|
i(this, "hasDraggableNodes", !1);
|
|
4621
4866
|
i(this, "hasTransformableViewport", !1);
|
|
4622
4867
|
i(this, "hasNodeResizeReactiveEdges", !1);
|
|
@@ -4625,7 +4870,7 @@ class Dr {
|
|
|
4625
4870
|
i(this, "hasUserDraggableEdges", !1);
|
|
4626
4871
|
i(this, "hasAnimatedLayout", !1);
|
|
4627
4872
|
i(this, "hasLayout", !1);
|
|
4628
|
-
i(this, "boxRenderingTrigger", new
|
|
4873
|
+
i(this, "boxRenderingTrigger", new q());
|
|
4629
4874
|
i(this, "window", window);
|
|
4630
4875
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4631
4876
|
this.element = e;
|
|
@@ -4660,131 +4905,155 @@ class Dr {
|
|
|
4660
4905
|
enableAnimatedLayout(e) {
|
|
4661
4906
|
return this.animatedLayoutConfig = e ?? {}, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
4662
4907
|
}
|
|
4908
|
+
enableUserSelectableNodes(e) {
|
|
4909
|
+
return this.userSelectableNodesConfig = e, this;
|
|
4910
|
+
}
|
|
4911
|
+
enableUserSelectableCanvas(e) {
|
|
4912
|
+
return this.userSelectableCanvasConfig = e, this;
|
|
4913
|
+
}
|
|
4663
4914
|
build() {
|
|
4664
4915
|
if (this.used)
|
|
4665
|
-
throw new
|
|
4916
|
+
throw new sr(
|
|
4666
4917
|
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
4667
4918
|
);
|
|
4668
4919
|
this.used = !0;
|
|
4669
|
-
const e = new
|
|
4920
|
+
const e = new at(this.element), t = new Te(), o = new Gt(this.element), s = this.createHtmlView(
|
|
4670
4921
|
o.main,
|
|
4671
4922
|
t,
|
|
4672
4923
|
e
|
|
4673
|
-
),
|
|
4924
|
+
), n = Cr(
|
|
4674
4925
|
this.canvasDefaults
|
|
4675
|
-
),
|
|
4926
|
+
), a = new Be(
|
|
4676
4927
|
t,
|
|
4677
4928
|
s,
|
|
4678
|
-
|
|
4679
|
-
), h =
|
|
4929
|
+
n
|
|
4930
|
+
), h = Ar(this.layoutConfig), d = Dr({
|
|
4680
4931
|
canvasDefaults: this.canvasDefaults,
|
|
4681
4932
|
hasLayout: this.hasLayout,
|
|
4682
4933
|
layoutParams: h
|
|
4683
|
-
}), c = new
|
|
4934
|
+
}), c = new ke(
|
|
4684
4935
|
t,
|
|
4685
4936
|
e,
|
|
4686
4937
|
d,
|
|
4687
4938
|
this.window
|
|
4688
|
-
),
|
|
4689
|
-
u,
|
|
4939
|
+
), u = new We(e), g = new $e(t), l = new Pe(
|
|
4690
4940
|
g,
|
|
4691
|
-
|
|
4941
|
+
u,
|
|
4942
|
+
a,
|
|
4692
4943
|
c
|
|
4693
4944
|
);
|
|
4694
|
-
if (this.hasBackground &&
|
|
4945
|
+
if (this.hasBackground && ne.configure(
|
|
4695
4946
|
l,
|
|
4696
|
-
|
|
4947
|
+
qt(this.backgroundConfig),
|
|
4697
4948
|
o.background
|
|
4698
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4949
|
+
), this.hasNodeResizeReactiveEdges && ee.configure(l), this.userSelectableNodesConfig !== void 0) {
|
|
4950
|
+
const p = Lr(
|
|
4951
|
+
l,
|
|
4952
|
+
o.main,
|
|
4953
|
+
this.window,
|
|
4954
|
+
this.userSelectableNodesConfig
|
|
4955
|
+
);
|
|
4956
|
+
ue.configure(p);
|
|
4957
|
+
}
|
|
4958
|
+
if (this.userSelectableCanvasConfig !== void 0) {
|
|
4959
|
+
const p = Rr(
|
|
4960
|
+
l,
|
|
4961
|
+
o.main,
|
|
4962
|
+
this.window,
|
|
4963
|
+
this.userSelectableCanvasConfig
|
|
4964
|
+
);
|
|
4965
|
+
ge.configure(p);
|
|
4966
|
+
}
|
|
4967
|
+
if (this.hasDraggableNodes) {
|
|
4968
|
+
let p = jt(this.dragConfig);
|
|
4969
|
+
this.hasAnimatedLayout && (p = Sr(
|
|
4970
|
+
p,
|
|
4702
4971
|
this.animationStaticNodes
|
|
4703
|
-
)),
|
|
4972
|
+
)), se.configure(
|
|
4704
4973
|
l,
|
|
4705
4974
|
o.main,
|
|
4706
4975
|
this.window,
|
|
4707
|
-
|
|
4976
|
+
p
|
|
4708
4977
|
);
|
|
4709
4978
|
}
|
|
4710
4979
|
if (this.hasUserConnectablePorts) {
|
|
4711
|
-
const
|
|
4980
|
+
const p = er(
|
|
4712
4981
|
this.connectablePortsConfig,
|
|
4713
|
-
|
|
4714
|
-
|
|
4982
|
+
n.edges.shapeFactory,
|
|
4983
|
+
n.ports.direction
|
|
4715
4984
|
);
|
|
4716
|
-
|
|
4985
|
+
ae.configure(
|
|
4717
4986
|
l,
|
|
4718
4987
|
o.overlayConnectablePorts,
|
|
4719
4988
|
e,
|
|
4720
4989
|
this.window,
|
|
4721
|
-
|
|
4990
|
+
p
|
|
4722
4991
|
);
|
|
4723
4992
|
}
|
|
4724
4993
|
if (this.hasUserDraggableEdges) {
|
|
4725
|
-
const
|
|
4994
|
+
const p = tr(
|
|
4726
4995
|
this.draggableEdgesConfig,
|
|
4727
4996
|
l.graph
|
|
4728
4997
|
);
|
|
4729
|
-
|
|
4998
|
+
he.configure(
|
|
4730
4999
|
l,
|
|
4731
5000
|
o.overlayDraggableEdges,
|
|
4732
5001
|
e,
|
|
4733
5002
|
this.window,
|
|
4734
|
-
|
|
5003
|
+
p
|
|
4735
5004
|
);
|
|
4736
5005
|
}
|
|
4737
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
5006
|
+
if (this.virtualScrollConfig !== void 0 ? ie.configure(
|
|
4738
5007
|
l,
|
|
4739
5008
|
o.main,
|
|
4740
5009
|
this.window,
|
|
4741
|
-
|
|
5010
|
+
Se(this.transformConfig),
|
|
4742
5011
|
this.boxRenderingTrigger,
|
|
4743
|
-
|
|
4744
|
-
) : this.hasTransformableViewport &&
|
|
5012
|
+
rr(this.virtualScrollConfig)
|
|
5013
|
+
) : this.hasTransformableViewport && J.configure(
|
|
4745
5014
|
l,
|
|
4746
5015
|
o.main,
|
|
4747
5016
|
this.window,
|
|
4748
|
-
|
|
4749
|
-
), this.hasLayout &&
|
|
4750
|
-
let
|
|
5017
|
+
Se(this.transformConfig)
|
|
5018
|
+
), this.hasLayout && Yt.configure(l, h), this.hasAnimatedLayout) {
|
|
5019
|
+
let p = yr(
|
|
4751
5020
|
this.animatedLayoutConfig
|
|
4752
5021
|
);
|
|
4753
|
-
this.hasDraggableNodes && (
|
|
5022
|
+
this.hasDraggableNodes && (Nr(
|
|
4754
5023
|
l,
|
|
4755
5024
|
this.animationStaticNodes
|
|
4756
|
-
),
|
|
4757
|
-
|
|
5025
|
+
), p = br(
|
|
5026
|
+
p,
|
|
4758
5027
|
this.animationStaticNodes
|
|
4759
|
-
)),
|
|
5028
|
+
)), le.configure(l, p, this.window);
|
|
4760
5029
|
}
|
|
4761
|
-
const
|
|
4762
|
-
o.destroy(), l.onBeforeDestroy.unsubscribe(
|
|
5030
|
+
const w = () => {
|
|
5031
|
+
o.destroy(), l.onBeforeDestroy.unsubscribe(w);
|
|
4763
5032
|
};
|
|
4764
|
-
return l.onBeforeDestroy.subscribe(
|
|
5033
|
+
return l.onBeforeDestroy.subscribe(w), l;
|
|
4765
5034
|
}
|
|
4766
5035
|
createHtmlView(e, t, o) {
|
|
4767
|
-
let s = new
|
|
4768
|
-
return this.virtualScrollConfig !== void 0 && (s = new
|
|
5036
|
+
let s = new be(t, o, e);
|
|
5037
|
+
return this.virtualScrollConfig !== void 0 && (s = new st(
|
|
4769
5038
|
s,
|
|
4770
5039
|
t,
|
|
4771
5040
|
this.boxRenderingTrigger,
|
|
4772
|
-
|
|
4773
|
-
)), s = new
|
|
5041
|
+
or(this.virtualScrollConfig)
|
|
5042
|
+
)), s = new it(s, t), s;
|
|
4774
5043
|
}
|
|
4775
5044
|
}
|
|
4776
5045
|
export {
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
5046
|
+
Ct as BezierEdgeShape,
|
|
5047
|
+
Ir as CanvasBuilder,
|
|
5048
|
+
sr as CanvasBuilderError,
|
|
4780
5049
|
S as CanvasError,
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
5050
|
+
V as ConnectionCategory,
|
|
5051
|
+
Ie as DirectEdgeShape,
|
|
5052
|
+
q as EventSubject,
|
|
5053
|
+
Mt as HorizontalEdgeShape,
|
|
5054
|
+
Ft as InteractiveEdgeError,
|
|
5055
|
+
Ue as InteractiveEdgeShape,
|
|
5056
|
+
Fr as MidpointEdgeShape,
|
|
5057
|
+
Dt as StraightEdgeShape,
|
|
5058
|
+
Lt as VerticalEdgeShape
|
|
4790
5059
|
};
|