@html-graph/html-graph 3.16.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/dist/html-graph.d.ts +34 -0
- package/dist/html-graph.js +566 -504
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r, e, t) =>
|
|
4
|
-
const
|
|
5
|
-
const r = document.createElement("div");
|
|
6
|
-
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
7
|
-
}, Re = () => {
|
|
8
|
-
const r = document.createElement("div");
|
|
9
|
-
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
10
|
-
}, Ce = (r) => {
|
|
11
|
-
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
12
|
-
}, T = (r, e) => ({
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var Le = (r, e, t) => e in r ? Me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => Le(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const D = (r, e) => ({
|
|
13
5
|
x: r.scale * e.x + r.x,
|
|
14
6
|
y: r.scale * e.y + r.y
|
|
15
7
|
});
|
|
16
|
-
|
|
8
|
+
var L = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(L || {});
|
|
9
|
+
const Re = () => {
|
|
10
|
+
const r = document.createElement("div");
|
|
11
|
+
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
12
|
+
}, Ce = () => {
|
|
13
|
+
const r = document.createElement("div");
|
|
14
|
+
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
15
|
+
}, Ve = (r) => {
|
|
16
|
+
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
|
+
};
|
|
18
|
+
class pe {
|
|
17
19
|
constructor(e, t, s) {
|
|
18
20
|
o(this, "host", Re());
|
|
19
|
-
o(this, "container",
|
|
21
|
+
o(this, "container", Ce());
|
|
20
22
|
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
23
|
o(this, "applyTransform", () => {
|
|
22
24
|
const e = this.viewportStore.getContentMatrix();
|
|
@@ -26,7 +28,7 @@ class ue {
|
|
|
26
28
|
}
|
|
27
29
|
attachNode(e) {
|
|
28
30
|
const t = this.graphStore.getNode(e);
|
|
29
|
-
|
|
31
|
+
Ve(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
30
32
|
}
|
|
31
33
|
detachNode(e) {
|
|
32
34
|
const t = this.graphStore.getNode(e);
|
|
@@ -78,7 +80,8 @@ class ue {
|
|
|
78
80
|
a,
|
|
79
81
|
d
|
|
80
82
|
);
|
|
81
|
-
|
|
83
|
+
let g = L.Line;
|
|
84
|
+
s.element === i.element ? g = L.PortCycle : s.nodeId === i.nodeId && (g = L.NodeCycle), t.shape.render({ from: c, to: l, category: g });
|
|
82
85
|
}
|
|
83
86
|
updateEdgePriority(e) {
|
|
84
87
|
const t = this.graphStore.getEdge(e);
|
|
@@ -88,7 +91,7 @@ class ue {
|
|
|
88
91
|
const h = {
|
|
89
92
|
x: s.left - i.left,
|
|
90
93
|
y: s.top - i.top
|
|
91
|
-
}, a =
|
|
94
|
+
}, a = D(n, h);
|
|
92
95
|
return {
|
|
93
96
|
x: a.x,
|
|
94
97
|
y: a.y,
|
|
@@ -121,7 +124,7 @@ class Ie {
|
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
class Ue {
|
|
124
|
-
constructor(e, t, s) {
|
|
127
|
+
constructor(e, t, s, i) {
|
|
125
128
|
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
129
|
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
127
130
|
o(this, "renderingBox");
|
|
@@ -144,7 +147,7 @@ class Ue {
|
|
|
144
147
|
this.handleAttachEdge(h);
|
|
145
148
|
});
|
|
146
149
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new Ie(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
150
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ie(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
151
|
}
|
|
149
152
|
attachNode(e) {
|
|
150
153
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -186,10 +189,10 @@ class Ue {
|
|
|
186
189
|
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
|
|
187
190
|
}
|
|
188
191
|
handleAttachNode(e) {
|
|
189
|
-
this.attachedNodes.add(e), this.htmlView.attachNode(e);
|
|
192
|
+
this.attachedNodes.add(e), this.params.onBeforeNodeAttached(e), this.htmlView.attachNode(e);
|
|
190
193
|
}
|
|
191
194
|
handleDetachNode(e) {
|
|
192
|
-
this.htmlView.detachNode(e), this.attachedNodes.delete(e);
|
|
195
|
+
this.htmlView.detachNode(e), this.params.onAfterNodeDetached(e), this.attachedNodes.delete(e);
|
|
193
196
|
}
|
|
194
197
|
handleAttachEdge(e) {
|
|
195
198
|
this.attachedEdges.add(e), this.htmlView.attachEdge(e);
|
|
@@ -198,7 +201,7 @@ class Ue {
|
|
|
198
201
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
|
-
class
|
|
204
|
+
class we {
|
|
202
205
|
constructor() {
|
|
203
206
|
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
204
207
|
}
|
|
@@ -215,11 +218,15 @@ class pe {
|
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
const A = () => {
|
|
218
|
-
const r = new
|
|
221
|
+
const r = new we();
|
|
219
222
|
return [r, r];
|
|
220
223
|
};
|
|
221
|
-
class
|
|
224
|
+
class Be {
|
|
222
225
|
constructor(e) {
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated
|
|
228
|
+
* do not use
|
|
229
|
+
*/
|
|
223
230
|
o(this, "onBeforeUpdated");
|
|
224
231
|
o(this, "onAfterUpdated");
|
|
225
232
|
this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
@@ -231,7 +238,7 @@ class Ve {
|
|
|
231
238
|
return { ...this.viewportStore.getContentMatrix() };
|
|
232
239
|
}
|
|
233
240
|
}
|
|
234
|
-
class
|
|
241
|
+
class We {
|
|
235
242
|
constructor(e) {
|
|
236
243
|
o(this, "onAfterNodeAdded");
|
|
237
244
|
o(this, "onAfterNodeUpdated");
|
|
@@ -339,7 +346,7 @@ class Be {
|
|
|
339
346
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
340
347
|
}
|
|
341
348
|
}
|
|
342
|
-
class
|
|
349
|
+
class k {
|
|
343
350
|
constructor(e) {
|
|
344
351
|
o(this, "counter", 0);
|
|
345
352
|
this.checkExists = e;
|
|
@@ -361,7 +368,7 @@ class S extends Error {
|
|
|
361
368
|
o(this, "name", "HtmlGraphError");
|
|
362
369
|
}
|
|
363
370
|
}
|
|
364
|
-
class
|
|
371
|
+
class fe {
|
|
365
372
|
constructor(e, t, s, i, n) {
|
|
366
373
|
/**
|
|
367
374
|
* provides api for accessing model of rendered graph
|
|
@@ -371,13 +378,13 @@ class we {
|
|
|
371
378
|
* provides api for accessing viewport state
|
|
372
379
|
*/
|
|
373
380
|
o(this, "viewport");
|
|
374
|
-
o(this, "nodeIdGenerator", new
|
|
381
|
+
o(this, "nodeIdGenerator", new k(
|
|
375
382
|
(e) => this.graph.getNode(e) !== null
|
|
376
383
|
));
|
|
377
|
-
o(this, "portIdGenerator", new
|
|
384
|
+
o(this, "portIdGenerator", new k(
|
|
378
385
|
(e) => this.graph.getPort(e) !== null
|
|
379
386
|
));
|
|
380
|
-
o(this, "edgeIdGenerator", new
|
|
387
|
+
o(this, "edgeIdGenerator", new k(
|
|
381
388
|
(e) => this.graph.getEdge(e) !== null
|
|
382
389
|
));
|
|
383
390
|
o(this, "onAfterNodeAdded", (e) => {
|
|
@@ -425,11 +432,12 @@ class we {
|
|
|
425
432
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
426
433
|
});
|
|
427
434
|
o(this, "onBeforeDestroyEmitter");
|
|
435
|
+
o(this, "destroyed", !1);
|
|
428
436
|
/**
|
|
429
437
|
* emits event just before destruction of canvas
|
|
430
438
|
*/
|
|
431
439
|
o(this, "onBeforeDestroy");
|
|
432
|
-
this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.params = n, this.graph = new
|
|
440
|
+
this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.params = n, this.graph = new We(this.graphStore), this.viewport = new Be(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
433
441
|
this.onAfterNodePriorityUpdated
|
|
434
442
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
435
443
|
this.onAfterEdgeShapeUpdated
|
|
@@ -575,16 +583,16 @@ class we {
|
|
|
575
583
|
* canvas element gets rolled back to initial state, and can not be reused
|
|
576
584
|
*/
|
|
577
585
|
destroy() {
|
|
578
|
-
this.clear(), this.onBeforeDestroyEmitter.emit(), this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(
|
|
586
|
+
this.destroyed || (this.clear(), this.onBeforeDestroyEmitter.emit(), this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(
|
|
579
587
|
this.onAfterNodePriorityUpdated
|
|
580
588
|
), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(
|
|
581
589
|
this.onAfterEdgeShapeUpdated
|
|
582
590
|
), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(
|
|
583
591
|
this.onAfterEdgePriorityUpdated
|
|
584
|
-
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
592
|
+
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
|
|
585
593
|
}
|
|
586
594
|
}
|
|
587
|
-
class
|
|
595
|
+
class $e {
|
|
588
596
|
constructor() {
|
|
589
597
|
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
590
598
|
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -624,7 +632,7 @@ class We {
|
|
|
624
632
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
625
633
|
}
|
|
626
634
|
}
|
|
627
|
-
class
|
|
635
|
+
class me {
|
|
628
636
|
constructor() {
|
|
629
637
|
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
630
638
|
o(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -633,7 +641,7 @@ class fe {
|
|
|
633
641
|
o(this, "incomingEdges", /* @__PURE__ */ new Map());
|
|
634
642
|
o(this, "outcomingEdges", /* @__PURE__ */ new Map());
|
|
635
643
|
o(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
636
|
-
o(this, "elementPorts", new
|
|
644
|
+
o(this, "elementPorts", new $e());
|
|
637
645
|
o(this, "afterNodeAddedEmitter");
|
|
638
646
|
o(this, "onAfterNodeAdded");
|
|
639
647
|
o(this, "afterNodeUpdatedEmitter");
|
|
@@ -806,22 +814,26 @@ class fe {
|
|
|
806
814
|
this.cycleEdges.get(s).delete(e), this.cycleEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.edges.delete(e);
|
|
807
815
|
}
|
|
808
816
|
}
|
|
809
|
-
const
|
|
817
|
+
const ie = (r) => ({
|
|
810
818
|
scale: 1 / r.scale,
|
|
811
819
|
x: -r.x / r.scale,
|
|
812
820
|
y: -r.y / r.scale
|
|
813
|
-
}),
|
|
821
|
+
}), ne = {
|
|
814
822
|
scale: 1,
|
|
815
823
|
x: 0,
|
|
816
824
|
y: 0
|
|
817
825
|
};
|
|
818
|
-
class
|
|
826
|
+
class Fe {
|
|
819
827
|
constructor() {
|
|
820
|
-
o(this, "viewportMatrix",
|
|
821
|
-
o(this, "contentMatrix",
|
|
828
|
+
o(this, "viewportMatrix", ne);
|
|
829
|
+
o(this, "contentMatrix", ne);
|
|
822
830
|
o(this, "afterUpdateEmitter");
|
|
823
831
|
o(this, "onAfterUpdated");
|
|
824
832
|
o(this, "beforeUpdateEmitter");
|
|
833
|
+
/**
|
|
834
|
+
* @deprecated
|
|
835
|
+
* do not use
|
|
836
|
+
*/
|
|
825
837
|
o(this, "onBeforeUpdated");
|
|
826
838
|
[this.afterUpdateEmitter, this.onAfterUpdated] = A(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = A();
|
|
827
839
|
}
|
|
@@ -836,14 +848,14 @@ class $e {
|
|
|
836
848
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
837
849
|
x: e.x ?? this.viewportMatrix.x,
|
|
838
850
|
y: e.y ?? this.viewportMatrix.y
|
|
839
|
-
}, this.contentMatrix =
|
|
851
|
+
}, this.contentMatrix = ie(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
840
852
|
}
|
|
841
853
|
patchContentMatrix(e) {
|
|
842
854
|
this.beforeUpdateEmitter.emit(), this.contentMatrix = {
|
|
843
855
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
844
856
|
x: e.x ?? this.contentMatrix.x,
|
|
845
857
|
y: e.y ?? this.contentMatrix.y
|
|
846
|
-
}, this.viewportMatrix =
|
|
858
|
+
}, this.viewportMatrix = ie(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
847
859
|
}
|
|
848
860
|
}
|
|
849
861
|
class Y {
|
|
@@ -861,15 +873,12 @@ class Y {
|
|
|
861
873
|
o(this, "onBeforeClear", () => {
|
|
862
874
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
863
875
|
});
|
|
864
|
-
o(this, "onBeforeDestroy", () => {
|
|
865
|
-
this.canvas.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
866
|
-
});
|
|
867
876
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
868
877
|
t.forEach((s) => {
|
|
869
878
|
const i = s.target;
|
|
870
879
|
this.handleNodeResize(i);
|
|
871
880
|
});
|
|
872
|
-
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear)
|
|
881
|
+
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
873
882
|
}
|
|
874
883
|
static configure(e) {
|
|
875
884
|
new Y(e);
|
|
@@ -879,12 +888,12 @@ class Y {
|
|
|
879
888
|
this.canvas.updateNode(t);
|
|
880
889
|
}
|
|
881
890
|
}
|
|
882
|
-
const
|
|
891
|
+
const Oe = (r, e, t) => {
|
|
883
892
|
const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
|
|
884
893
|
return e >= s && e <= s + n && t >= i && t <= i + h;
|
|
885
|
-
},
|
|
894
|
+
}, ke = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => Oe(e, t, s) && ke(r, t, s), U = (r, e) => {
|
|
886
895
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
887
|
-
},
|
|
896
|
+
}, B = (r) => {
|
|
888
897
|
const e = document.createElement("div");
|
|
889
898
|
return {
|
|
890
899
|
id: r.overlayId,
|
|
@@ -899,43 +908,43 @@ const Fe = (r, e, t) => {
|
|
|
899
908
|
}
|
|
900
909
|
]
|
|
901
910
|
};
|
|
902
|
-
},
|
|
911
|
+
}, ze = (r, e) => {
|
|
903
912
|
let t = e, s = null;
|
|
904
913
|
for (; t !== null && (s = r.getElementPortIds(t)[0] ?? null, s === null); )
|
|
905
914
|
t = t.parentElement;
|
|
906
915
|
return s;
|
|
907
|
-
},
|
|
916
|
+
}, ye = (r, e) => {
|
|
908
917
|
const t = document.elementsFromPoint(e.x, e.y);
|
|
909
918
|
for (const s of t) {
|
|
910
|
-
const i =
|
|
919
|
+
const i = ze(r, s);
|
|
911
920
|
if (i !== null)
|
|
912
921
|
return i;
|
|
913
922
|
}
|
|
914
923
|
return null;
|
|
915
924
|
};
|
|
916
|
-
var
|
|
917
|
-
const
|
|
925
|
+
var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
|
|
926
|
+
const ve = (r, e) => ({
|
|
918
927
|
x: r / 2,
|
|
919
928
|
y: e / 2
|
|
920
|
-
}),
|
|
929
|
+
}), y = (r, e, t) => ({
|
|
921
930
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
922
931
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
923
932
|
}), w = {
|
|
924
933
|
x: 0,
|
|
925
934
|
y: 0
|
|
926
935
|
};
|
|
927
|
-
class
|
|
936
|
+
class He {
|
|
928
937
|
constructor(e) {
|
|
929
938
|
o(this, "path");
|
|
930
939
|
o(this, "midpoint");
|
|
931
940
|
this.params = e;
|
|
932
941
|
const t = this.params.to;
|
|
933
942
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
934
|
-
const s =
|
|
943
|
+
const s = y(
|
|
935
944
|
{ x: this.params.arrowLength, y: w.y },
|
|
936
945
|
this.params.sourceDirection,
|
|
937
946
|
w
|
|
938
|
-
), i =
|
|
947
|
+
), i = y(
|
|
939
948
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
940
949
|
this.params.targetDirection,
|
|
941
950
|
this.params.to
|
|
@@ -949,7 +958,7 @@ class ze {
|
|
|
949
958
|
this.path = `${d}${a}${c}`;
|
|
950
959
|
}
|
|
951
960
|
}
|
|
952
|
-
const
|
|
961
|
+
const Ee = (r, e, t, s) => ({
|
|
953
962
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
954
963
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
955
964
|
});
|
|
@@ -958,25 +967,25 @@ class Xe {
|
|
|
958
967
|
o(this, "path");
|
|
959
968
|
o(this, "midpoint");
|
|
960
969
|
this.params = e;
|
|
961
|
-
const t = this.params.hasSourceArrow ?
|
|
970
|
+
const t = this.params.hasSourceArrow ? y(
|
|
962
971
|
{ x: this.params.arrowLength, y: w.y },
|
|
963
972
|
this.params.sourceDirection,
|
|
964
973
|
w
|
|
965
|
-
) : w, s = this.params.hasTargetArrow ?
|
|
974
|
+
) : w, s = this.params.hasTargetArrow ? y(
|
|
966
975
|
{
|
|
967
976
|
x: this.params.to.x - this.params.arrowLength,
|
|
968
977
|
y: this.params.to.y
|
|
969
978
|
},
|
|
970
979
|
this.params.targetDirection,
|
|
971
980
|
this.params.to
|
|
972
|
-
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c =
|
|
981
|
+
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = y(
|
|
973
982
|
{ x: i, y: w.y },
|
|
974
983
|
this.params.sourceDirection,
|
|
975
984
|
w
|
|
976
985
|
), l = {
|
|
977
986
|
x: c.x + a,
|
|
978
987
|
y: c.y + d
|
|
979
|
-
}, g =
|
|
988
|
+
}, g = y(
|
|
980
989
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
981
990
|
this.params.targetDirection,
|
|
982
991
|
this.params.to
|
|
@@ -986,10 +995,10 @@ class Xe {
|
|
|
986
995
|
}, f = {
|
|
987
996
|
x: (l.x + p.x) / 2,
|
|
988
997
|
y: (l.y + p.y) / 2
|
|
989
|
-
},
|
|
998
|
+
}, m = {
|
|
990
999
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
991
1000
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
992
|
-
},
|
|
1001
|
+
}, v = {
|
|
993
1002
|
x: g.x - this.params.curvature * this.params.targetDirection.x,
|
|
994
1003
|
y: g.y - this.params.curvature * this.params.targetDirection.y
|
|
995
1004
|
}, E = {
|
|
@@ -1002,26 +1011,26 @@ class Xe {
|
|
|
1002
1011
|
this.path = [
|
|
1003
1012
|
`M ${t.x} ${t.y}`,
|
|
1004
1013
|
`L ${c.x} ${c.y}`,
|
|
1005
|
-
`C ${
|
|
1006
|
-
`C ${x.x} ${x.y} ${
|
|
1014
|
+
`C ${m.x} ${m.y} ${E.x} ${E.y} ${f.x} ${f.y}`,
|
|
1015
|
+
`C ${x.x} ${x.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
|
|
1007
1016
|
`L ${s.x} ${s.y}`
|
|
1008
|
-
].join(" "), this.midpoint =
|
|
1017
|
+
].join(" "), this.midpoint = Ee(f, e.flipX, e.flipY, e.to);
|
|
1009
1018
|
}
|
|
1010
1019
|
}
|
|
1011
|
-
const
|
|
1020
|
+
const V = (r, e) => {
|
|
1012
1021
|
const t = [];
|
|
1013
1022
|
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) {
|
|
1014
1023
|
const s = r.length - 1;
|
|
1015
1024
|
let i = 0, n = 0, h = 0;
|
|
1016
1025
|
r.forEach((a, d) => {
|
|
1017
1026
|
let c = 0, l = 0, g = 0;
|
|
1018
|
-
const p = d > 0, f = d < s,
|
|
1027
|
+
const p = d > 0, f = d < s, m = p && f;
|
|
1019
1028
|
if (p && (c = -i, l = -n, g = h), f) {
|
|
1020
|
-
const
|
|
1021
|
-
i =
|
|
1029
|
+
const C = r[d + 1];
|
|
1030
|
+
i = C.x - a.x, n = C.y - a.y, h = Math.sqrt(i * i + n * n);
|
|
1022
1031
|
}
|
|
1023
|
-
const E = h !== 0 ? Math.min((
|
|
1024
|
-
d > 0 && t.push(`L ${N.x} ${N.y}`),
|
|
1032
|
+
const E = h !== 0 ? Math.min((m ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = m ? { x: a.x + i * E, y: a.y + n * E } : a, T = g !== 0 ? Math.min((m ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, N = m ? { x: a.x + c * T, y: a.y + l * T } : a;
|
|
1033
|
+
d > 0 && t.push(`L ${N.x} ${N.y}`), m && t.push(
|
|
1025
1034
|
`C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
|
|
1026
1035
|
);
|
|
1027
1036
|
});
|
|
@@ -1035,22 +1044,22 @@ class Ye {
|
|
|
1035
1044
|
this.params = e;
|
|
1036
1045
|
const t = this.params.to;
|
|
1037
1046
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1038
|
-
const s = this.params.hasSourceArrow ?
|
|
1047
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1039
1048
|
{ x: this.params.arrowLength, y: w.y },
|
|
1040
1049
|
this.params.sourceDirection,
|
|
1041
1050
|
w
|
|
1042
|
-
) : w, i = this.params.hasTargetArrow ?
|
|
1051
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1043
1052
|
{
|
|
1044
1053
|
x: this.params.to.x - this.params.arrowLength,
|
|
1045
1054
|
y: this.params.to.y
|
|
1046
1055
|
},
|
|
1047
1056
|
this.params.targetDirection,
|
|
1048
1057
|
this.params.to
|
|
1049
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a =
|
|
1058
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
|
|
1050
1059
|
{ x: h, y: w.y },
|
|
1051
1060
|
this.params.sourceDirection,
|
|
1052
1061
|
w
|
|
1053
|
-
), d =
|
|
1062
|
+
), d = y(
|
|
1054
1063
|
{ x: this.params.to.x - h, y: this.params.to.y },
|
|
1055
1064
|
this.params.targetDirection,
|
|
1056
1065
|
this.params.to
|
|
@@ -1060,97 +1069,97 @@ class Ye {
|
|
|
1060
1069
|
}, p = { x: g.x, y: l }, f = {
|
|
1061
1070
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1062
1071
|
y: d.y
|
|
1063
|
-
},
|
|
1064
|
-
this.path =
|
|
1065
|
-
[s, a, g, p,
|
|
1072
|
+
}, m = { x: f.x, y: l };
|
|
1073
|
+
this.path = V(
|
|
1074
|
+
[s, a, g, p, m, f, d, i],
|
|
1066
1075
|
this.params.roundness
|
|
1067
1076
|
);
|
|
1068
1077
|
}
|
|
1069
1078
|
}
|
|
1070
|
-
class
|
|
1079
|
+
class j {
|
|
1071
1080
|
constructor(e) {
|
|
1072
1081
|
o(this, "path");
|
|
1073
1082
|
o(this, "midpoint");
|
|
1074
1083
|
this.params = e;
|
|
1075
|
-
const t = this.params.hasSourceArrow ?
|
|
1084
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1076
1085
|
{ x: this.params.arrowLength, y: w.y },
|
|
1077
1086
|
this.params.sourceDirection,
|
|
1078
1087
|
w
|
|
1079
|
-
) : w, s = this.params.hasTargetArrow ?
|
|
1088
|
+
) : w, s = this.params.hasTargetArrow ? y(
|
|
1080
1089
|
{
|
|
1081
1090
|
x: this.params.to.x - this.params.arrowLength,
|
|
1082
1091
|
y: this.params.to.y
|
|
1083
1092
|
},
|
|
1084
1093
|
this.params.targetDirection,
|
|
1085
1094
|
this.params.to
|
|
1086
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1095
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1087
1096
|
{ x: i, y: w.y },
|
|
1088
1097
|
this.params.sourceDirection,
|
|
1089
1098
|
w
|
|
1090
|
-
), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g =
|
|
1099
|
+
), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g = y(
|
|
1091
1100
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1092
1101
|
this.params.targetDirection,
|
|
1093
1102
|
this.params.to
|
|
1094
1103
|
), p = { x: g.x + d, y: g.y + c }, f = { x: (l.x + p.x) / 2, y: (l.y + p.y) / 2 };
|
|
1095
|
-
this.midpoint =
|
|
1104
|
+
this.midpoint = Ee(f, e.flipX, e.flipY, e.to), this.path = V(
|
|
1096
1105
|
[t, n, l, p, g, s],
|
|
1097
1106
|
this.params.roundness
|
|
1098
1107
|
);
|
|
1099
1108
|
}
|
|
1100
1109
|
}
|
|
1101
|
-
class
|
|
1110
|
+
class je {
|
|
1102
1111
|
constructor(e) {
|
|
1103
1112
|
o(this, "path");
|
|
1104
1113
|
o(this, "midpoint");
|
|
1105
1114
|
this.params = e;
|
|
1106
1115
|
const t = this.params.to;
|
|
1107
1116
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1108
|
-
const s = this.params.hasSourceArrow ?
|
|
1117
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1109
1118
|
{ x: this.params.arrowLength, y: w.y },
|
|
1110
1119
|
this.params.sourceDirection,
|
|
1111
1120
|
w
|
|
1112
|
-
) : w, i = this.params.hasTargetArrow ?
|
|
1121
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1113
1122
|
{
|
|
1114
1123
|
x: this.params.to.x - this.params.arrowLength,
|
|
1115
1124
|
y: this.params.to.y
|
|
1116
1125
|
},
|
|
1117
1126
|
this.params.targetDirection,
|
|
1118
1127
|
this.params.to
|
|
1119
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h =
|
|
1128
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = y(
|
|
1120
1129
|
{ x: n, y: w.y },
|
|
1121
1130
|
this.params.sourceDirection,
|
|
1122
1131
|
w
|
|
1123
|
-
), a =
|
|
1132
|
+
), a = y(
|
|
1124
1133
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1125
1134
|
this.params.targetDirection,
|
|
1126
1135
|
this.params.to
|
|
1127
1136
|
);
|
|
1128
|
-
this.path =
|
|
1137
|
+
this.path = V([s, h, a, i], this.params.roundness);
|
|
1129
1138
|
}
|
|
1130
1139
|
}
|
|
1131
|
-
class
|
|
1140
|
+
class Ge {
|
|
1132
1141
|
constructor(e) {
|
|
1133
1142
|
o(this, "path");
|
|
1134
1143
|
o(this, "midpoint");
|
|
1135
1144
|
this.params = e;
|
|
1136
1145
|
const t = this.params.to;
|
|
1137
1146
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1138
|
-
const s = this.params.hasSourceArrow ?
|
|
1147
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1139
1148
|
{ x: this.params.arrowLength, y: w.y },
|
|
1140
1149
|
this.params.sourceDirection,
|
|
1141
1150
|
w
|
|
1142
|
-
) : w, i = this.params.hasTargetArrow ?
|
|
1151
|
+
) : w, i = this.params.hasTargetArrow ? y(
|
|
1143
1152
|
{
|
|
1144
1153
|
x: this.params.to.x - this.params.arrowLength,
|
|
1145
1154
|
y: this.params.to.y
|
|
1146
1155
|
},
|
|
1147
1156
|
this.params.targetDirection,
|
|
1148
1157
|
this.params.to
|
|
1149
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a =
|
|
1158
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
|
|
1150
1159
|
{ x: h, y: w.y },
|
|
1151
1160
|
this.params.sourceDirection,
|
|
1152
1161
|
w
|
|
1153
|
-
), d =
|
|
1162
|
+
), d = y(
|
|
1154
1163
|
{ x: this.params.to.x - h, y: this.params.to.y },
|
|
1155
1164
|
this.params.targetDirection,
|
|
1156
1165
|
this.params.to
|
|
@@ -1160,14 +1169,14 @@ class je {
|
|
|
1160
1169
|
}, p = { x: l, y: g.y }, f = {
|
|
1161
1170
|
x: d.x,
|
|
1162
1171
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1163
|
-
},
|
|
1164
|
-
this.path =
|
|
1165
|
-
[s, a, g, p,
|
|
1172
|
+
}, m = { x: l, y: f.y };
|
|
1173
|
+
this.path = V(
|
|
1174
|
+
[s, a, g, p, m, f, d, i],
|
|
1166
1175
|
this.params.roundness
|
|
1167
1176
|
);
|
|
1168
1177
|
}
|
|
1169
1178
|
}
|
|
1170
|
-
class
|
|
1179
|
+
class G {
|
|
1171
1180
|
constructor(e) {
|
|
1172
1181
|
o(this, "path");
|
|
1173
1182
|
o(this, "midpoint");
|
|
@@ -1182,12 +1191,12 @@ class j {
|
|
|
1182
1191
|
{ x: i, y: w.y },
|
|
1183
1192
|
{ x: this.params.arrowLength, y: w.y }
|
|
1184
1193
|
].map(
|
|
1185
|
-
(c) =>
|
|
1194
|
+
(c) => y(c, this.params.sourceDirection, w)
|
|
1186
1195
|
), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
|
|
1187
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1196
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${V(a, this.params.roundness)}`, this.midpoint = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
|
|
1188
1197
|
}
|
|
1189
1198
|
}
|
|
1190
|
-
class
|
|
1199
|
+
class Ke {
|
|
1191
1200
|
constructor(e) {
|
|
1192
1201
|
o(this, "path");
|
|
1193
1202
|
o(this, "midpoint");
|
|
@@ -1198,7 +1207,7 @@ class Ge {
|
|
|
1198
1207
|
{ x: c, y: -n },
|
|
1199
1208
|
{ x: d, y: 0 }
|
|
1200
1209
|
].map(
|
|
1201
|
-
(
|
|
1210
|
+
(m) => y(m, this.params.sourceDirection, w)
|
|
1202
1211
|
), p = [
|
|
1203
1212
|
`M ${g[0].x} ${g[0].y}`,
|
|
1204
1213
|
`A ${t} ${t} 0 0 1 ${g[1].x} ${g[1].y}`,
|
|
@@ -1208,7 +1217,7 @@ class Ge {
|
|
|
1208
1217
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.midpoint = g[3];
|
|
1209
1218
|
}
|
|
1210
1219
|
}
|
|
1211
|
-
class
|
|
1220
|
+
class Ze {
|
|
1212
1221
|
constructor(e) {
|
|
1213
1222
|
o(this, "path");
|
|
1214
1223
|
o(this, "midpoint");
|
|
@@ -1244,22 +1253,22 @@ class Ke {
|
|
|
1244
1253
|
};
|
|
1245
1254
|
}
|
|
1246
1255
|
}
|
|
1247
|
-
const
|
|
1256
|
+
const Ae = (r, e) => {
|
|
1248
1257
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
1249
|
-
},
|
|
1258
|
+
}, K = Object.freeze({
|
|
1250
1259
|
edgeColor: "--edge-color"
|
|
1251
|
-
}),
|
|
1260
|
+
}), xe = (r) => {
|
|
1252
1261
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1253
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
1254
|
-
},
|
|
1262
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(K.edgeColor, r), e;
|
|
1263
|
+
}, W = () => {
|
|
1255
1264
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1256
|
-
return r.setAttribute("fill", `var(${
|
|
1257
|
-
},
|
|
1265
|
+
return r.setAttribute("fill", `var(${K.edgeColor})`), r;
|
|
1266
|
+
}, Se = () => {
|
|
1258
1267
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1259
1268
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1260
|
-
},
|
|
1269
|
+
}, Pe = (r) => {
|
|
1261
1270
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1262
|
-
return e.setAttribute("stroke", `var(${
|
|
1271
|
+
return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1263
1272
|
}, be = (r, e) => {
|
|
1264
1273
|
const t = {
|
|
1265
1274
|
x: r.x + r.width / 2,
|
|
@@ -1276,12 +1285,12 @@ const Ee = (r, e) => {
|
|
|
1276
1285
|
flipX: d,
|
|
1277
1286
|
flipY: c
|
|
1278
1287
|
};
|
|
1279
|
-
},
|
|
1288
|
+
}, z = (r, e, t, s) => {
|
|
1280
1289
|
const n = [
|
|
1281
1290
|
w,
|
|
1282
1291
|
{ x: t, y: s },
|
|
1283
1292
|
{ x: t, y: -s }
|
|
1284
|
-
].map((c) =>
|
|
1293
|
+
].map((c) => y(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
|
|
1285
1294
|
return `${h} ${a} ${d} Z`;
|
|
1286
1295
|
}, u = Object.freeze({
|
|
1287
1296
|
color: "#777777",
|
|
@@ -1301,29 +1310,29 @@ const Ee = (r, e) => {
|
|
|
1301
1310
|
curvature: 90,
|
|
1302
1311
|
interactiveWidth: 10,
|
|
1303
1312
|
preOffset: 0
|
|
1304
|
-
}),
|
|
1305
|
-
class
|
|
1313
|
+
}), he = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1314
|
+
class $ {
|
|
1306
1315
|
constructor(e) {
|
|
1307
1316
|
o(this, "svg");
|
|
1308
|
-
o(this, "group",
|
|
1317
|
+
o(this, "group", Se());
|
|
1309
1318
|
o(this, "line");
|
|
1310
1319
|
o(this, "sourceArrow", null);
|
|
1311
1320
|
o(this, "targetArrow", null);
|
|
1312
1321
|
o(this, "onAfterRender");
|
|
1313
1322
|
o(this, "afterRenderEmitter");
|
|
1314
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = A(), this.svg =
|
|
1323
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = A(), this.svg = xe(e.color), this.svg.appendChild(this.group), this.line = Pe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1315
1324
|
}
|
|
1316
1325
|
render(e) {
|
|
1317
1326
|
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = be(
|
|
1318
1327
|
e.from,
|
|
1319
1328
|
e.to
|
|
1320
1329
|
);
|
|
1321
|
-
|
|
1322
|
-
const d =
|
|
1330
|
+
Ae(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
1331
|
+
const d = he(
|
|
1323
1332
|
e.from.direction,
|
|
1324
1333
|
h,
|
|
1325
1334
|
a
|
|
1326
|
-
), c =
|
|
1335
|
+
), c = he(
|
|
1327
1336
|
e.to.direction,
|
|
1328
1337
|
h,
|
|
1329
1338
|
a
|
|
@@ -1332,36 +1341,36 @@ class W {
|
|
|
1332
1341
|
y: n
|
|
1333
1342
|
};
|
|
1334
1343
|
let g = c, p = -this.params.arrowLength, f;
|
|
1335
|
-
e.
|
|
1336
|
-
const
|
|
1344
|
+
e.category === L.PortCycle ? (f = this.params.createCyclePath, g = d, p = this.params.arrowLength) : e.category === L.NodeCycle ? f = this.params.createDetourPath : f = this.params.createLinePath;
|
|
1345
|
+
const m = f(
|
|
1337
1346
|
d,
|
|
1338
1347
|
c,
|
|
1339
1348
|
l,
|
|
1340
1349
|
h,
|
|
1341
1350
|
a
|
|
1342
1351
|
);
|
|
1343
|
-
this.line.setAttribute("d",
|
|
1344
|
-
let
|
|
1345
|
-
this.sourceArrow && (
|
|
1352
|
+
this.line.setAttribute("d", m.path);
|
|
1353
|
+
let v = null;
|
|
1354
|
+
this.sourceArrow && (v = z(
|
|
1346
1355
|
d,
|
|
1347
1356
|
w,
|
|
1348
1357
|
this.params.arrowLength,
|
|
1349
1358
|
this.params.arrowWidth
|
|
1350
|
-
), this.sourceArrow.setAttribute("d",
|
|
1359
|
+
), this.sourceArrow.setAttribute("d", v));
|
|
1351
1360
|
let E = null;
|
|
1352
|
-
this.targetArrow && (E =
|
|
1361
|
+
this.targetArrow && (E = z(
|
|
1353
1362
|
g,
|
|
1354
1363
|
l,
|
|
1355
1364
|
p,
|
|
1356
1365
|
this.params.arrowWidth
|
|
1357
1366
|
), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
|
|
1358
|
-
edgePath:
|
|
1359
|
-
sourceArrowPath:
|
|
1367
|
+
edgePath: m,
|
|
1368
|
+
sourceArrowPath: v,
|
|
1360
1369
|
targetArrowPath: E
|
|
1361
1370
|
});
|
|
1362
1371
|
}
|
|
1363
1372
|
}
|
|
1364
|
-
class
|
|
1373
|
+
class Je {
|
|
1365
1374
|
constructor(e) {
|
|
1366
1375
|
o(this, "svg");
|
|
1367
1376
|
o(this, "group");
|
|
@@ -1379,7 +1388,7 @@ class Ze {
|
|
|
1379
1388
|
o(this, "hasSourceArrow");
|
|
1380
1389
|
o(this, "hasTargetArrow");
|
|
1381
1390
|
o(this, "pathShape");
|
|
1382
|
-
o(this, "createCyclePath", (e) => new
|
|
1391
|
+
o(this, "createCyclePath", (e) => new Ke({
|
|
1383
1392
|
sourceDirection: e,
|
|
1384
1393
|
radius: this.portCycleRadius,
|
|
1385
1394
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1400,7 +1409,7 @@ class Ze {
|
|
|
1400
1409
|
hasSourceArrow: this.hasSourceArrow,
|
|
1401
1410
|
hasTargetArrow: this.hasTargetArrow
|
|
1402
1411
|
}));
|
|
1403
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
1412
|
+
o(this, "createLinePath", (e, t, s) => new He({
|
|
1404
1413
|
to: s,
|
|
1405
1414
|
sourceDirection: e,
|
|
1406
1415
|
targetDirection: t,
|
|
@@ -1409,7 +1418,7 @@ class Ze {
|
|
|
1409
1418
|
hasSourceArrow: this.hasSourceArrow,
|
|
1410
1419
|
hasTargetArrow: this.hasTargetArrow
|
|
1411
1420
|
}));
|
|
1412
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
1421
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new $({
|
|
1413
1422
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
1414
1423
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
1415
1424
|
arrowLength: this.arrowLength,
|
|
@@ -1425,7 +1434,7 @@ class Ze {
|
|
|
1425
1434
|
this.pathShape.render(e);
|
|
1426
1435
|
}
|
|
1427
1436
|
}
|
|
1428
|
-
class
|
|
1437
|
+
class Qe {
|
|
1429
1438
|
constructor(e) {
|
|
1430
1439
|
o(this, "svg");
|
|
1431
1440
|
o(this, "group");
|
|
@@ -1443,7 +1452,7 @@ class Je {
|
|
|
1443
1452
|
o(this, "hasSourceArrow");
|
|
1444
1453
|
o(this, "hasTargetArrow");
|
|
1445
1454
|
o(this, "pathShape");
|
|
1446
|
-
o(this, "createCyclePath", (e) => new
|
|
1455
|
+
o(this, "createCyclePath", (e) => new G({
|
|
1447
1456
|
sourceDirection: e,
|
|
1448
1457
|
arrowLength: this.arrowLength,
|
|
1449
1458
|
side: this.cycleSquareSide,
|
|
@@ -1452,7 +1461,7 @@ class Je {
|
|
|
1452
1461
|
hasSourceArrow: this.hasSourceArrow,
|
|
1453
1462
|
hasTargetArrow: this.hasTargetArrow
|
|
1454
1463
|
}));
|
|
1455
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1464
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
1456
1465
|
to: s,
|
|
1457
1466
|
sourceDirection: e,
|
|
1458
1467
|
targetDirection: t,
|
|
@@ -1483,7 +1492,7 @@ class Je {
|
|
|
1483
1492
|
t,
|
|
1484
1493
|
this.arrowOffset,
|
|
1485
1494
|
this.cycleSquareSide / 2
|
|
1486
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
1495
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new $({
|
|
1487
1496
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
1488
1497
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
1489
1498
|
arrowLength: this.arrowLength,
|
|
@@ -1499,7 +1508,7 @@ class Je {
|
|
|
1499
1508
|
this.pathShape.render(e);
|
|
1500
1509
|
}
|
|
1501
1510
|
}
|
|
1502
|
-
class
|
|
1511
|
+
class _e {
|
|
1503
1512
|
constructor(e) {
|
|
1504
1513
|
o(this, "svg");
|
|
1505
1514
|
o(this, "group");
|
|
@@ -1517,7 +1526,7 @@ class Qe {
|
|
|
1517
1526
|
o(this, "hasSourceArrow");
|
|
1518
1527
|
o(this, "hasTargetArrow");
|
|
1519
1528
|
o(this, "pathShape");
|
|
1520
|
-
o(this, "createCyclePath", (e) => new
|
|
1529
|
+
o(this, "createCyclePath", (e) => new G({
|
|
1521
1530
|
sourceDirection: e,
|
|
1522
1531
|
arrowLength: this.arrowLength,
|
|
1523
1532
|
side: this.cycleSquareSide,
|
|
@@ -1526,7 +1535,7 @@ class Qe {
|
|
|
1526
1535
|
hasSourceArrow: this.hasSourceArrow,
|
|
1527
1536
|
hasTargetArrow: this.hasTargetArrow
|
|
1528
1537
|
}));
|
|
1529
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1538
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
1530
1539
|
to: s,
|
|
1531
1540
|
sourceDirection: e,
|
|
1532
1541
|
targetDirection: t,
|
|
@@ -1540,7 +1549,7 @@ class Qe {
|
|
|
1540
1549
|
hasSourceArrow: this.hasSourceArrow,
|
|
1541
1550
|
hasTargetArrow: this.hasTargetArrow
|
|
1542
1551
|
}));
|
|
1543
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
1552
|
+
o(this, "createLinePath", (e, t, s) => new je({
|
|
1544
1553
|
to: s,
|
|
1545
1554
|
sourceDirection: e,
|
|
1546
1555
|
targetDirection: t,
|
|
@@ -1556,7 +1565,7 @@ class Qe {
|
|
|
1556
1565
|
t,
|
|
1557
1566
|
this.arrowOffset,
|
|
1558
1567
|
this.cycleSquareSide / 2
|
|
1559
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
1568
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new $({
|
|
1560
1569
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
1561
1570
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
1562
1571
|
arrowLength: this.arrowLength,
|
|
@@ -1572,7 +1581,7 @@ class Qe {
|
|
|
1572
1581
|
this.pathShape.render(e);
|
|
1573
1582
|
}
|
|
1574
1583
|
}
|
|
1575
|
-
class
|
|
1584
|
+
class qe {
|
|
1576
1585
|
constructor(e) {
|
|
1577
1586
|
o(this, "svg");
|
|
1578
1587
|
o(this, "group");
|
|
@@ -1590,7 +1599,7 @@ class _e {
|
|
|
1590
1599
|
o(this, "hasSourceArrow");
|
|
1591
1600
|
o(this, "hasTargetArrow");
|
|
1592
1601
|
o(this, "pathShape");
|
|
1593
|
-
o(this, "createCyclePath", (e) => new
|
|
1602
|
+
o(this, "createCyclePath", (e) => new G({
|
|
1594
1603
|
sourceDirection: e,
|
|
1595
1604
|
arrowLength: this.arrowLength,
|
|
1596
1605
|
side: this.cycleSquareSide,
|
|
@@ -1599,7 +1608,7 @@ class _e {
|
|
|
1599
1608
|
hasSourceArrow: this.hasSourceArrow,
|
|
1600
1609
|
hasTargetArrow: this.hasTargetArrow
|
|
1601
1610
|
}));
|
|
1602
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1611
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new j({
|
|
1603
1612
|
to: s,
|
|
1604
1613
|
sourceDirection: e,
|
|
1605
1614
|
targetDirection: t,
|
|
@@ -1613,7 +1622,7 @@ class _e {
|
|
|
1613
1622
|
hasSourceArrow: this.hasSourceArrow,
|
|
1614
1623
|
hasTargetArrow: this.hasTargetArrow
|
|
1615
1624
|
}));
|
|
1616
|
-
o(this, "createLinePath", (e, t, s, i, n) => new
|
|
1625
|
+
o(this, "createLinePath", (e, t, s, i, n) => new Ge({
|
|
1617
1626
|
to: s,
|
|
1618
1627
|
sourceDirection: e,
|
|
1619
1628
|
targetDirection: t,
|
|
@@ -1630,7 +1639,7 @@ class _e {
|
|
|
1630
1639
|
t,
|
|
1631
1640
|
this.arrowOffset,
|
|
1632
1641
|
this.cycleSquareSide / 2
|
|
1633
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
1642
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new $({
|
|
1634
1643
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
1635
1644
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
1636
1645
|
arrowLength: this.arrowLength,
|
|
@@ -1646,7 +1655,7 @@ class _e {
|
|
|
1646
1655
|
this.pathShape.render(e);
|
|
1647
1656
|
}
|
|
1648
1657
|
}
|
|
1649
|
-
const
|
|
1658
|
+
const ae = (r) => {
|
|
1650
1659
|
if (r.diagonalDistance === 0)
|
|
1651
1660
|
return "";
|
|
1652
1661
|
const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
|
|
@@ -1656,17 +1665,17 @@ const he = (r) => {
|
|
|
1656
1665
|
x: t / r.diagonalDistance,
|
|
1657
1666
|
y: s / r.diagonalDistance
|
|
1658
1667
|
};
|
|
1659
|
-
return
|
|
1668
|
+
return z(
|
|
1660
1669
|
n,
|
|
1661
1670
|
i,
|
|
1662
1671
|
r.arrowLength,
|
|
1663
1672
|
r.arrowWidth
|
|
1664
1673
|
);
|
|
1665
1674
|
};
|
|
1666
|
-
class
|
|
1675
|
+
class Te {
|
|
1667
1676
|
constructor(e) {
|
|
1668
1677
|
o(this, "svg");
|
|
1669
|
-
o(this, "group",
|
|
1678
|
+
o(this, "group", Se());
|
|
1670
1679
|
o(this, "line");
|
|
1671
1680
|
o(this, "sourceArrow", null);
|
|
1672
1681
|
o(this, "targetArrow", null);
|
|
@@ -1678,15 +1687,15 @@ class Pe {
|
|
|
1678
1687
|
o(this, "targetOffset");
|
|
1679
1688
|
o(this, "onAfterRender");
|
|
1680
1689
|
o(this, "afterRenderEmitter");
|
|
1681
|
-
[this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg =
|
|
1690
|
+
[this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = xe(this.color), this.svg.appendChild(this.group), this.line = Pe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1682
1691
|
}
|
|
1683
1692
|
render(e) {
|
|
1684
1693
|
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = be(
|
|
1685
1694
|
e.from,
|
|
1686
1695
|
e.to
|
|
1687
1696
|
);
|
|
1688
|
-
|
|
1689
|
-
const d = { x: i, y: n }, c = new
|
|
1697
|
+
Ae(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
1698
|
+
const d = { x: i, y: n }, c = new Ze({
|
|
1690
1699
|
to: d,
|
|
1691
1700
|
sourceOffset: this.sourceOffset,
|
|
1692
1701
|
targetOffset: this.targetOffset,
|
|
@@ -1696,7 +1705,7 @@ class Pe {
|
|
|
1696
1705
|
});
|
|
1697
1706
|
this.line.setAttribute("d", c.path);
|
|
1698
1707
|
let l = null;
|
|
1699
|
-
this.sourceArrow && (l =
|
|
1708
|
+
this.sourceArrow && (l = ae({
|
|
1700
1709
|
diagonalDistance: c.diagonalDistance,
|
|
1701
1710
|
to: d,
|
|
1702
1711
|
offset: this.sourceOffset,
|
|
@@ -1706,7 +1715,7 @@ class Pe {
|
|
|
1706
1715
|
arrowLength: this.arrowLength
|
|
1707
1716
|
}), this.sourceArrow.setAttribute("d", l));
|
|
1708
1717
|
let g = null;
|
|
1709
|
-
this.targetArrow && (g =
|
|
1718
|
+
this.targetArrow && (g = ae({
|
|
1710
1719
|
diagonalDistance: c.diagonalDistance,
|
|
1711
1720
|
to: d,
|
|
1712
1721
|
offset: this.targetOffset,
|
|
@@ -1721,40 +1730,40 @@ class Pe {
|
|
|
1721
1730
|
});
|
|
1722
1731
|
}
|
|
1723
1732
|
}
|
|
1724
|
-
const
|
|
1733
|
+
const et = () => {
|
|
1725
1734
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1726
1735
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1727
|
-
},
|
|
1736
|
+
}, tt = (r) => {
|
|
1728
1737
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1729
1738
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1730
|
-
},
|
|
1739
|
+
}, de = (r) => {
|
|
1731
1740
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1732
1741
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1733
1742
|
};
|
|
1734
|
-
class
|
|
1743
|
+
class rt extends Error {
|
|
1735
1744
|
constructor(e) {
|
|
1736
1745
|
super(e), this.name = "InteractiveEdgeError";
|
|
1737
1746
|
}
|
|
1738
1747
|
}
|
|
1739
|
-
class
|
|
1748
|
+
class De {
|
|
1740
1749
|
constructor(e, t) {
|
|
1741
1750
|
o(this, "svg");
|
|
1742
1751
|
o(this, "group");
|
|
1743
1752
|
o(this, "line");
|
|
1744
1753
|
o(this, "sourceArrow");
|
|
1745
1754
|
o(this, "targetArrow");
|
|
1746
|
-
o(this, "handle",
|
|
1755
|
+
o(this, "handle", et());
|
|
1747
1756
|
o(this, "onAfterRender");
|
|
1748
1757
|
o(this, "interactiveLine");
|
|
1749
1758
|
o(this, "interactiveSourceArrow", null);
|
|
1750
1759
|
o(this, "interactiveTargetArrow", null);
|
|
1751
|
-
if (this.baseEdge = e, e instanceof
|
|
1752
|
-
throw new
|
|
1760
|
+
if (this.baseEdge = e, e instanceof De)
|
|
1761
|
+
throw new rt(
|
|
1753
1762
|
"interactive edge can be configured only once"
|
|
1754
1763
|
);
|
|
1755
1764
|
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;
|
|
1756
1765
|
const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
|
|
1757
|
-
this.interactiveLine =
|
|
1766
|
+
this.interactiveLine = tt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = de(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = de(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1758
1767
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1759
1768
|
});
|
|
1760
1769
|
}
|
|
@@ -1762,7 +1771,7 @@ class Te {
|
|
|
1762
1771
|
this.baseEdge.render(e);
|
|
1763
1772
|
}
|
|
1764
1773
|
}
|
|
1765
|
-
class
|
|
1774
|
+
class bt {
|
|
1766
1775
|
constructor(e, t) {
|
|
1767
1776
|
o(this, "group");
|
|
1768
1777
|
o(this, "line");
|
|
@@ -1784,21 +1793,21 @@ class xt {
|
|
|
1784
1793
|
this.baseShape.render(e);
|
|
1785
1794
|
}
|
|
1786
1795
|
}
|
|
1787
|
-
const
|
|
1788
|
-
const t = new
|
|
1796
|
+
const Ne = (r, e) => {
|
|
1797
|
+
const t = new me(), s = new pe(t, e, r), i = {
|
|
1789
1798
|
nodes: {
|
|
1790
|
-
centerFn:
|
|
1799
|
+
centerFn: ve,
|
|
1791
1800
|
priorityFn: () => 0
|
|
1792
1801
|
},
|
|
1793
1802
|
edges: {
|
|
1794
|
-
shapeFactory: () => new
|
|
1803
|
+
shapeFactory: () => new Te(),
|
|
1795
1804
|
priorityFn: () => 0
|
|
1796
1805
|
},
|
|
1797
1806
|
ports: {
|
|
1798
1807
|
direction: 0
|
|
1799
1808
|
}
|
|
1800
1809
|
};
|
|
1801
|
-
return new
|
|
1810
|
+
return new fe(
|
|
1802
1811
|
r,
|
|
1803
1812
|
t,
|
|
1804
1813
|
e,
|
|
@@ -1806,11 +1815,117 @@ const De = (r, e) => {
|
|
|
1806
1815
|
i
|
|
1807
1816
|
);
|
|
1808
1817
|
};
|
|
1809
|
-
class
|
|
1818
|
+
class F {
|
|
1819
|
+
constructor(e, t, s, i) {
|
|
1820
|
+
o(this, "onAfterPortMarked", (e) => {
|
|
1821
|
+
const t = this.canvas.graph.getPort(e);
|
|
1822
|
+
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
1823
|
+
});
|
|
1824
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
1825
|
+
const t = this.canvas.graph.getPort(e);
|
|
1826
|
+
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
1827
|
+
});
|
|
1828
|
+
o(this, "onPortMouseDown", (e) => {
|
|
1829
|
+
if (!this.params.mouseDownEventVerifier(e))
|
|
1830
|
+
return;
|
|
1831
|
+
const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
|
|
1832
|
+
this.params.onPortPointerDown(s, {
|
|
1833
|
+
x: e.clientX,
|
|
1834
|
+
y: e.clientY
|
|
1835
|
+
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1836
|
+
passive: !0
|
|
1837
|
+
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1838
|
+
passive: !0
|
|
1839
|
+
}));
|
|
1840
|
+
});
|
|
1841
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
1842
|
+
if (!R(
|
|
1843
|
+
this.window,
|
|
1844
|
+
this.element,
|
|
1845
|
+
e.clientX,
|
|
1846
|
+
e.clientY
|
|
1847
|
+
)) {
|
|
1848
|
+
this.stopMouseDrag();
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1851
|
+
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
1852
|
+
});
|
|
1853
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
1854
|
+
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
1855
|
+
});
|
|
1856
|
+
o(this, "onPortTouchStart", (e) => {
|
|
1857
|
+
if (e.touches.length !== 1)
|
|
1858
|
+
return;
|
|
1859
|
+
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
|
|
1860
|
+
this.params.onPortPointerDown(i, {
|
|
1861
|
+
x: t.clientX,
|
|
1862
|
+
y: t.clientY
|
|
1863
|
+
}) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
1864
|
+
passive: !0
|
|
1865
|
+
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
1866
|
+
passive: !0
|
|
1867
|
+
}), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, {
|
|
1868
|
+
passive: !0
|
|
1869
|
+
}));
|
|
1870
|
+
});
|
|
1871
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
1872
|
+
const t = e.touches[0];
|
|
1873
|
+
if (!R(
|
|
1874
|
+
this.window,
|
|
1875
|
+
this.element,
|
|
1876
|
+
t.clientX,
|
|
1877
|
+
t.clientY
|
|
1878
|
+
)) {
|
|
1879
|
+
this.stopTouchDrag();
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
1883
|
+
});
|
|
1884
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
1885
|
+
const t = e.changedTouches[0];
|
|
1886
|
+
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
1887
|
+
});
|
|
1888
|
+
o(this, "onBeforeClear", () => {
|
|
1889
|
+
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
1890
|
+
const t = this.canvas.graph.getPort(e);
|
|
1891
|
+
this.unhookPortEvents(t.element);
|
|
1892
|
+
});
|
|
1893
|
+
});
|
|
1894
|
+
o(this, "onBeforeDestroy", () => {
|
|
1895
|
+
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
1896
|
+
});
|
|
1897
|
+
this.canvas = e, this.element = t, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1898
|
+
}
|
|
1899
|
+
static configure(e, t, s, i) {
|
|
1900
|
+
new F(e, t, s, i);
|
|
1901
|
+
}
|
|
1902
|
+
hookPortEvents(e) {
|
|
1903
|
+
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
1904
|
+
passive: !0
|
|
1905
|
+
}), e.addEventListener("touchstart", this.onPortTouchStart, {
|
|
1906
|
+
passive: !0
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
unhookPortEvents(e) {
|
|
1910
|
+
e.removeEventListener("mousedown", this.onPortMouseDown), e.removeEventListener("touchstart", this.onPortTouchStart);
|
|
1911
|
+
}
|
|
1912
|
+
stopMouseDrag() {
|
|
1913
|
+
this.params.onStopDrag(), this.removeWindowMouseListeners();
|
|
1914
|
+
}
|
|
1915
|
+
stopTouchDrag() {
|
|
1916
|
+
this.params.onStopDrag(), this.removeWindowTouchListeners();
|
|
1917
|
+
}
|
|
1918
|
+
removeWindowMouseListeners() {
|
|
1919
|
+
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
1920
|
+
}
|
|
1921
|
+
removeWindowTouchListeners() {
|
|
1922
|
+
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
class Z {
|
|
1810
1926
|
constructor(e, t, s, i) {
|
|
1811
|
-
o(this, "
|
|
1927
|
+
o(this, "grabbedNode", null);
|
|
1812
1928
|
o(this, "maxNodePriority", 0);
|
|
1813
|
-
o(this, "previousTouchCoordinates", null);
|
|
1814
1929
|
o(this, "graph");
|
|
1815
1930
|
o(this, "onAfterNodeAdded", (e) => {
|
|
1816
1931
|
this.updateMaxNodePriority(e);
|
|
@@ -1829,7 +1944,7 @@ class K {
|
|
|
1829
1944
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
1830
1945
|
});
|
|
1831
1946
|
o(this, "onBeforeDestroy", () => {
|
|
1832
|
-
this.
|
|
1947
|
+
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
1833
1948
|
});
|
|
1834
1949
|
o(this, "onBeforeClear", () => {
|
|
1835
1950
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
@@ -1838,43 +1953,61 @@ class K {
|
|
|
1838
1953
|
}), this.maxNodePriority = 0;
|
|
1839
1954
|
});
|
|
1840
1955
|
o(this, "onMouseDown", (e) => {
|
|
1841
|
-
if (!this.
|
|
1956
|
+
if (!this.params.mouseDownEventVerifier(e))
|
|
1842
1957
|
return;
|
|
1843
1958
|
const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
|
|
1844
|
-
this.
|
|
1959
|
+
if (!this.params.onBeforeNodeDrag({
|
|
1845
1960
|
nodeId: s,
|
|
1846
1961
|
element: i.element,
|
|
1847
1962
|
x: i.x,
|
|
1848
1963
|
y: i.y
|
|
1849
|
-
})
|
|
1964
|
+
}))
|
|
1965
|
+
return;
|
|
1966
|
+
e.stopPropagation();
|
|
1967
|
+
const h = this.calculateContentPoint({
|
|
1968
|
+
x: e.clientX,
|
|
1969
|
+
y: e.clientY
|
|
1970
|
+
});
|
|
1971
|
+
this.grabbedNode = {
|
|
1972
|
+
nodeId: s,
|
|
1973
|
+
dx: h.x - i.x,
|
|
1974
|
+
dy: h.y - i.y
|
|
1975
|
+
}, U(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1850
1976
|
passive: !0
|
|
1851
|
-
}), this.window.addEventListener("
|
|
1977
|
+
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1852
1978
|
passive: !0
|
|
1853
|
-
})
|
|
1979
|
+
});
|
|
1854
1980
|
});
|
|
1855
1981
|
o(this, "onTouchStart", (e) => {
|
|
1856
1982
|
if (e.touches.length !== 1)
|
|
1857
1983
|
return;
|
|
1858
|
-
e.
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1984
|
+
e.stopPropagation();
|
|
1985
|
+
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
|
|
1986
|
+
if (!this.params.onBeforeNodeDrag({
|
|
1987
|
+
nodeId: i,
|
|
1988
|
+
element: n.element,
|
|
1989
|
+
x: n.x,
|
|
1990
|
+
y: n.y
|
|
1991
|
+
}))
|
|
1992
|
+
return;
|
|
1993
|
+
const a = this.calculateContentPoint({
|
|
1994
|
+
x: t.clientX,
|
|
1995
|
+
y: t.clientY
|
|
1996
|
+
});
|
|
1997
|
+
this.grabbedNode = {
|
|
1998
|
+
nodeId: i,
|
|
1999
|
+
dx: a.x - n.x,
|
|
2000
|
+
dy: a.y - n.y
|
|
2001
|
+
}, this.moveNodeOnTop(i), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
1869
2002
|
passive: !0
|
|
1870
2003
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
1871
2004
|
passive: !0
|
|
1872
2005
|
}), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, {
|
|
1873
2006
|
passive: !0
|
|
1874
|
-
})
|
|
2007
|
+
});
|
|
1875
2008
|
});
|
|
1876
2009
|
o(this, "onWindowMouseMove", (e) => {
|
|
1877
|
-
if (!
|
|
2010
|
+
if (!R(
|
|
1878
2011
|
this.window,
|
|
1879
2012
|
this.element,
|
|
1880
2013
|
e.clientX,
|
|
@@ -1883,16 +2016,19 @@ class K {
|
|
|
1883
2016
|
this.cancelMouseDrag();
|
|
1884
2017
|
return;
|
|
1885
2018
|
}
|
|
1886
|
-
this.
|
|
2019
|
+
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
2020
|
+
x: e.clientX,
|
|
2021
|
+
y: e.clientY
|
|
2022
|
+
});
|
|
1887
2023
|
});
|
|
1888
2024
|
o(this, "onWindowMouseUp", (e) => {
|
|
1889
|
-
this.
|
|
2025
|
+
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
1890
2026
|
});
|
|
1891
2027
|
o(this, "onWindowTouchMove", (e) => {
|
|
1892
2028
|
if (e.touches.length !== 1)
|
|
1893
2029
|
return;
|
|
1894
2030
|
const t = e.touches[0];
|
|
1895
|
-
if (!
|
|
2031
|
+
if (!R(
|
|
1896
2032
|
this.window,
|
|
1897
2033
|
this.element,
|
|
1898
2034
|
t.clientX,
|
|
@@ -1901,43 +2037,40 @@ class K {
|
|
|
1901
2037
|
this.cancelTouchDrag();
|
|
1902
2038
|
return;
|
|
1903
2039
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
y: e.touches[0].clientY
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
2040
|
+
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
2041
|
+
x: t.clientX,
|
|
2042
|
+
y: t.clientY
|
|
2043
|
+
});
|
|
1911
2044
|
});
|
|
1912
2045
|
o(this, "onWindowTouchFinish", () => {
|
|
1913
|
-
this.
|
|
2046
|
+
this.cancelTouchDrag();
|
|
1914
2047
|
});
|
|
1915
|
-
this.canvas = e, this.element = t, this.window = s, this.
|
|
2048
|
+
this.canvas = e, this.element = t, this.window = s, this.params = i, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1916
2049
|
}
|
|
1917
2050
|
static configure(e, t, s, i) {
|
|
1918
|
-
new
|
|
2051
|
+
new Z(e, t, s, i);
|
|
1919
2052
|
}
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
if (
|
|
2053
|
+
moveNode(e, t) {
|
|
2054
|
+
const s = this.graph.getNode(e.nodeId);
|
|
2055
|
+
if (s === null)
|
|
1923
2056
|
return;
|
|
1924
|
-
const
|
|
1925
|
-
x: i.x,
|
|
1926
|
-
y: i.y
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
h
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
nodeId: e,
|
|
1933
|
-
element:
|
|
1934
|
-
x:
|
|
1935
|
-
y:
|
|
2057
|
+
const i = this.calculateContentPoint(t), n = {
|
|
2058
|
+
x: i.x - e.dx,
|
|
2059
|
+
y: i.y - e.dy
|
|
2060
|
+
}, h = this.adjustNodeCoords(n);
|
|
2061
|
+
this.canvas.updateNode(e.nodeId, {
|
|
2062
|
+
x: h.x,
|
|
2063
|
+
y: h.y
|
|
2064
|
+
}), this.params.onNodeDrag({
|
|
2065
|
+
nodeId: e.nodeId,
|
|
2066
|
+
element: s.element,
|
|
2067
|
+
x: h.x,
|
|
2068
|
+
y: h.y
|
|
1936
2069
|
});
|
|
1937
2070
|
}
|
|
1938
2071
|
moveNodeOnTop(e) {
|
|
1939
|
-
if (this.
|
|
1940
|
-
if (this.maxNodePriority++, this.
|
|
2072
|
+
if (this.params.moveOnTop) {
|
|
2073
|
+
if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
|
|
1941
2074
|
const t = this.maxNodePriority;
|
|
1942
2075
|
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
|
|
1943
2076
|
this.canvas.updateEdge(i, { priority: t });
|
|
@@ -1947,26 +2080,31 @@ class K {
|
|
|
1947
2080
|
}
|
|
1948
2081
|
}
|
|
1949
2082
|
cancelMouseDrag() {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2083
|
+
if (this.grabbedNode !== null) {
|
|
2084
|
+
const e = this.graph.getNode(this.grabbedNode.nodeId);
|
|
2085
|
+
e !== null && this.params.onNodeDragFinished({
|
|
2086
|
+
nodeId: this.grabbedNode.nodeId,
|
|
2087
|
+
element: e.element,
|
|
2088
|
+
x: e.x,
|
|
2089
|
+
y: e.y
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
|
|
1957
2093
|
}
|
|
1958
2094
|
removeMouseDragListeners() {
|
|
1959
2095
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
1960
2096
|
}
|
|
1961
2097
|
cancelTouchDrag() {
|
|
1962
|
-
this.
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
2098
|
+
if (this.grabbedNode !== null) {
|
|
2099
|
+
const e = this.graph.getNode(this.grabbedNode.nodeId);
|
|
2100
|
+
e !== null && this.params.onNodeDragFinished({
|
|
2101
|
+
nodeId: this.grabbedNode.nodeId,
|
|
2102
|
+
element: e.element,
|
|
2103
|
+
x: e.x,
|
|
2104
|
+
y: e.y
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
this.grabbedNode = null, this.removeTouchDragListeners();
|
|
1970
2108
|
}
|
|
1971
2109
|
removeTouchDragListeners() {
|
|
1972
2110
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
@@ -1975,12 +2113,30 @@ class K {
|
|
|
1975
2113
|
const t = this.graph.getNode(e).priority;
|
|
1976
2114
|
this.maxNodePriority = Math.max(this.maxNodePriority, t);
|
|
1977
2115
|
}
|
|
2116
|
+
calculateContentPoint(e) {
|
|
2117
|
+
const t = this.element.getBoundingClientRect(), s = {
|
|
2118
|
+
x: e.x - t.x,
|
|
2119
|
+
y: e.y - t.y
|
|
2120
|
+
}, i = this.canvas.viewport.getViewportMatrix();
|
|
2121
|
+
return D(i, s);
|
|
2122
|
+
}
|
|
2123
|
+
adjustNodeCoords(e) {
|
|
2124
|
+
const t = this.params.gridSize;
|
|
2125
|
+
if (t !== null) {
|
|
2126
|
+
const s = t / 2;
|
|
2127
|
+
return {
|
|
2128
|
+
x: Math.floor((e.x + s) / t) * t,
|
|
2129
|
+
y: Math.floor((e.y + s) / t) * t
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
return e;
|
|
2133
|
+
}
|
|
1978
2134
|
}
|
|
1979
|
-
const
|
|
2135
|
+
const ot = (r, e, t) => ({
|
|
1980
2136
|
scale: r.scale,
|
|
1981
2137
|
x: r.x + r.scale * e,
|
|
1982
2138
|
y: r.y + r.scale * t
|
|
1983
|
-
}),
|
|
2139
|
+
}), st = (r, e, t, s) => ({
|
|
1984
2140
|
scale: r.scale * e,
|
|
1985
2141
|
x: r.scale * (1 - e) * t + r.x,
|
|
1986
2142
|
y: r.scale * (1 - e) * s + r.y
|
|
@@ -2003,14 +2159,14 @@ const rt = (r, e, t) => ({
|
|
|
2003
2159
|
touches: e
|
|
2004
2160
|
};
|
|
2005
2161
|
};
|
|
2006
|
-
class
|
|
2162
|
+
class O {
|
|
2007
2163
|
constructor(e, t, s, i) {
|
|
2008
2164
|
o(this, "viewport");
|
|
2009
2165
|
o(this, "prevTouches", null);
|
|
2010
2166
|
o(this, "wheelFinishTimer", null);
|
|
2011
2167
|
o(this, "transformInProgress", !1);
|
|
2012
2168
|
o(this, "onBeforeDestroy", () => {
|
|
2013
|
-
this.removeMouseDragListeners(), this.removeTouchDragListeners()
|
|
2169
|
+
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2014
2170
|
});
|
|
2015
2171
|
o(this, "onMouseDown", (e) => {
|
|
2016
2172
|
this.element === null || !this.params.mouseDownEventVerifier(e) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -2020,7 +2176,7 @@ class $ {
|
|
|
2020
2176
|
}), this.startRegisteredTransform());
|
|
2021
2177
|
});
|
|
2022
2178
|
o(this, "onWindowMouseMove", (e) => {
|
|
2023
|
-
const t =
|
|
2179
|
+
const t = R(
|
|
2024
2180
|
this.window,
|
|
2025
2181
|
this.element,
|
|
2026
2182
|
e.clientX,
|
|
@@ -2060,7 +2216,7 @@ class $ {
|
|
|
2060
2216
|
o(this, "onWindowTouchMove", (e) => {
|
|
2061
2217
|
const t = I(e);
|
|
2062
2218
|
if (!t.touches.every(
|
|
2063
|
-
(i) =>
|
|
2219
|
+
(i) => R(this.window, this.element, i[0], i[1])
|
|
2064
2220
|
)) {
|
|
2065
2221
|
this.stopTouchDrag();
|
|
2066
2222
|
return;
|
|
@@ -2100,10 +2256,10 @@ class $ {
|
|
|
2100
2256
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2101
2257
|
}
|
|
2102
2258
|
static configure(e, t, s, i) {
|
|
2103
|
-
new
|
|
2259
|
+
new O(e, t, s, i);
|
|
2104
2260
|
}
|
|
2105
2261
|
moveViewport(e, t) {
|
|
2106
|
-
const s = this.viewport.getViewportMatrix(), i =
|
|
2262
|
+
const s = this.viewport.getViewportMatrix(), i = ot(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.params.transformPreprocessor({
|
|
2107
2263
|
prevTransform: s,
|
|
2108
2264
|
nextTransform: i,
|
|
2109
2265
|
canvasWidth: n,
|
|
@@ -2112,7 +2268,7 @@ class $ {
|
|
|
2112
2268
|
this.performTransform(a);
|
|
2113
2269
|
}
|
|
2114
2270
|
scaleViewport(e, t, s) {
|
|
2115
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2271
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = st(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2116
2272
|
prevTransform: i,
|
|
2117
2273
|
nextTransform: n,
|
|
2118
2274
|
canvasWidth: h,
|
|
@@ -2142,7 +2298,7 @@ class $ {
|
|
|
2142
2298
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2143
2299
|
}
|
|
2144
2300
|
}
|
|
2145
|
-
class
|
|
2301
|
+
class J {
|
|
2146
2302
|
constructor(e, t, s, i, n, h) {
|
|
2147
2303
|
o(this, "canvasResizeObserver");
|
|
2148
2304
|
o(this, "nodeHorizontal");
|
|
@@ -2165,16 +2321,11 @@ class Z {
|
|
|
2165
2321
|
yTo: e.y + e.height
|
|
2166
2322
|
};
|
|
2167
2323
|
});
|
|
2168
|
-
o(this, "onBeforeDestroy", () => {
|
|
2169
|
-
this.trigger.unsubscribe(this.updateLoadedArea), this.canvasResizeObserver.unobserve(this.element), this.canvas.viewport.onAfterUpdated.unsubscribe(
|
|
2170
|
-
this.onAfterViewportUpdated
|
|
2171
|
-
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
2172
|
-
});
|
|
2173
2324
|
o(this, "onAfterViewportUpdated", () => {
|
|
2174
2325
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
2175
2326
|
});
|
|
2176
2327
|
o(this, "userTransformInProgress", !1);
|
|
2177
|
-
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = h, this.nodeHorizontal = this.params.
|
|
2328
|
+
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = h, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
|
|
2178
2329
|
const c = d[0];
|
|
2179
2330
|
this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
2180
2331
|
}), this.viewport = e.viewport;
|
|
@@ -2198,15 +2349,15 @@ class Z {
|
|
|
2198
2349
|
this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
|
|
2199
2350
|
}
|
|
2200
2351
|
};
|
|
2201
|
-
|
|
2352
|
+
O.configure(
|
|
2202
2353
|
e,
|
|
2203
2354
|
this.element,
|
|
2204
2355
|
this.window,
|
|
2205
2356
|
a
|
|
2206
|
-
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated)
|
|
2357
|
+
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2207
2358
|
}
|
|
2208
2359
|
static configure(e, t, s, i, n, h) {
|
|
2209
|
-
new
|
|
2360
|
+
new J(
|
|
2210
2361
|
e,
|
|
2211
2362
|
t,
|
|
2212
2363
|
s,
|
|
@@ -2229,24 +2380,24 @@ class Z {
|
|
|
2229
2380
|
this.trigger.emit({ x: s, y: i, width: n, height: h });
|
|
2230
2381
|
}
|
|
2231
2382
|
}
|
|
2232
|
-
const
|
|
2383
|
+
const it = () => {
|
|
2233
2384
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2234
2385
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2235
|
-
},
|
|
2386
|
+
}, nt = () => {
|
|
2236
2387
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2237
2388
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2238
|
-
},
|
|
2389
|
+
}, ht = () => {
|
|
2239
2390
|
const r = document.createElementNS(
|
|
2240
2391
|
"http://www.w3.org/2000/svg",
|
|
2241
2392
|
"pattern"
|
|
2242
2393
|
);
|
|
2243
2394
|
return r.setAttribute("id", "pattern"), r;
|
|
2244
2395
|
};
|
|
2245
|
-
class
|
|
2396
|
+
class Q {
|
|
2246
2397
|
constructor(e, t, s) {
|
|
2247
|
-
o(this, "svg",
|
|
2248
|
-
o(this, "patternRenderingRectangle",
|
|
2249
|
-
o(this, "pattern",
|
|
2398
|
+
o(this, "svg", it());
|
|
2399
|
+
o(this, "patternRenderingRectangle", nt());
|
|
2400
|
+
o(this, "pattern", ht());
|
|
2250
2401
|
o(this, "patternContent");
|
|
2251
2402
|
o(this, "tileWidth");
|
|
2252
2403
|
o(this, "tileHeight");
|
|
@@ -2264,129 +2415,21 @@ class J {
|
|
|
2264
2415
|
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
|
|
2265
2416
|
this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
|
|
2266
2417
|
});
|
|
2267
|
-
|
|
2268
|
-
this.resizeObserver.unobserve(this.host), this.host.removeChild(this.svg), this.canvas.viewport.onAfterUpdated.unsubscribe(
|
|
2269
|
-
this.onAfterTransformUpdated
|
|
2270
|
-
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
2271
|
-
});
|
|
2272
|
-
this.canvas = e, this.host = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
|
|
2418
|
+
this.canvas = e, this.backgroundHost = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
|
|
2273
2419
|
const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2274
2420
|
this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
|
|
2275
2421
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2276
|
-
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.
|
|
2422
|
+
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2277
2423
|
}
|
|
2278
2424
|
static configure(e, t, s) {
|
|
2279
|
-
new
|
|
2425
|
+
new Q(e, t, s);
|
|
2280
2426
|
}
|
|
2281
2427
|
updateVisibility() {
|
|
2282
2428
|
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2283
|
-
t && this.visible ? (this.visible = !1, this.
|
|
2429
|
+
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2284
2430
|
}
|
|
2285
2431
|
}
|
|
2286
|
-
class
|
|
2287
|
-
constructor(e, t, s, i) {
|
|
2288
|
-
o(this, "onAfterPortMarked", (e) => {
|
|
2289
|
-
const t = this.canvas.graph.getPort(e);
|
|
2290
|
-
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
2291
|
-
});
|
|
2292
|
-
o(this, "onBeforePortUnmarked", (e) => {
|
|
2293
|
-
const t = this.canvas.graph.getPort(e);
|
|
2294
|
-
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
2295
|
-
});
|
|
2296
|
-
o(this, "onPortMouseDown", (e) => {
|
|
2297
|
-
if (!this.params.mouseDownEventVerifier(e))
|
|
2298
|
-
return;
|
|
2299
|
-
const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
|
|
2300
|
-
this.params.onPortPointerDown(s, {
|
|
2301
|
-
x: e.clientX,
|
|
2302
|
-
y: e.clientY
|
|
2303
|
-
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2304
|
-
passive: !0
|
|
2305
|
-
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2306
|
-
passive: !0
|
|
2307
|
-
}));
|
|
2308
|
-
});
|
|
2309
|
-
o(this, "onWindowMouseMove", (e) => {
|
|
2310
|
-
if (!L(
|
|
2311
|
-
this.window,
|
|
2312
|
-
this.element,
|
|
2313
|
-
e.clientX,
|
|
2314
|
-
e.clientY
|
|
2315
|
-
)) {
|
|
2316
|
-
this.stopMouseDrag();
|
|
2317
|
-
return;
|
|
2318
|
-
}
|
|
2319
|
-
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2320
|
-
});
|
|
2321
|
-
o(this, "onWindowMouseUp", (e) => {
|
|
2322
|
-
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2323
|
-
});
|
|
2324
|
-
o(this, "onPortTouchStart", (e) => {
|
|
2325
|
-
if (e.touches.length !== 1)
|
|
2326
|
-
return;
|
|
2327
|
-
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
|
|
2328
|
-
this.params.onPortPointerDown(i, {
|
|
2329
|
-
x: t.clientX,
|
|
2330
|
-
y: t.clientY
|
|
2331
|
-
}) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2332
|
-
passive: !0
|
|
2333
|
-
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2334
|
-
passive: !0
|
|
2335
|
-
}), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, {
|
|
2336
|
-
passive: !0
|
|
2337
|
-
}));
|
|
2338
|
-
});
|
|
2339
|
-
o(this, "onWindowTouchMove", (e) => {
|
|
2340
|
-
const t = e.touches[0];
|
|
2341
|
-
if (!L(
|
|
2342
|
-
this.window,
|
|
2343
|
-
this.element,
|
|
2344
|
-
t.clientX,
|
|
2345
|
-
t.clientY
|
|
2346
|
-
)) {
|
|
2347
|
-
this.stopTouchDrag();
|
|
2348
|
-
return;
|
|
2349
|
-
}
|
|
2350
|
-
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2351
|
-
});
|
|
2352
|
-
o(this, "onWindowTouchFinish", (e) => {
|
|
2353
|
-
const t = e.changedTouches[0];
|
|
2354
|
-
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2355
|
-
});
|
|
2356
|
-
o(this, "onBeforeClear", () => {
|
|
2357
|
-
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2358
|
-
const t = this.canvas.graph.getPort(e);
|
|
2359
|
-
this.unhookPortEvents(t.element);
|
|
2360
|
-
});
|
|
2361
|
-
});
|
|
2362
|
-
o(this, "onBeforeDestroy", () => {
|
|
2363
|
-
this.stopMouseDrag(), this.stopTouchDrag(), this.canvas.graph.onAfterPortMarked.unsubscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.unsubscribe(
|
|
2364
|
-
this.onBeforePortUnmarked
|
|
2365
|
-
), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
2366
|
-
});
|
|
2367
|
-
this.canvas = e, this.element = t, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2368
|
-
}
|
|
2369
|
-
static configure(e, t, s, i) {
|
|
2370
|
-
new F(e, t, s, i);
|
|
2371
|
-
}
|
|
2372
|
-
hookPortEvents(e) {
|
|
2373
|
-
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
2374
|
-
passive: !0
|
|
2375
|
-
}), e.addEventListener("touchstart", this.onPortTouchStart, {
|
|
2376
|
-
passive: !0
|
|
2377
|
-
});
|
|
2378
|
-
}
|
|
2379
|
-
unhookPortEvents(e) {
|
|
2380
|
-
e.removeEventListener("mousedown", this.onPortMouseDown), e.removeEventListener("touchstart", this.onPortTouchStart);
|
|
2381
|
-
}
|
|
2382
|
-
stopMouseDrag() {
|
|
2383
|
-
this.params.onStopDrag(), this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
2384
|
-
}
|
|
2385
|
-
stopTouchDrag() {
|
|
2386
|
-
this.params.onStopDrag(), this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
class Q {
|
|
2432
|
+
class _ {
|
|
2390
2433
|
constructor(e, t, s, i, n) {
|
|
2391
2434
|
o(this, "overlayCanvas");
|
|
2392
2435
|
o(this, "staticPortId", null);
|
|
@@ -2394,7 +2437,7 @@ class Q {
|
|
|
2394
2437
|
o(this, "onEdgeCreated", (e) => {
|
|
2395
2438
|
this.params.onAfterEdgeCreated(e);
|
|
2396
2439
|
});
|
|
2397
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas =
|
|
2440
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ne(
|
|
2398
2441
|
this.overlayLayer,
|
|
2399
2442
|
this.viewportStore
|
|
2400
2443
|
), F.configure(
|
|
@@ -2421,7 +2464,7 @@ class Q {
|
|
|
2421
2464
|
);
|
|
2422
2465
|
}
|
|
2423
2466
|
static configure(e, t, s, i, n) {
|
|
2424
|
-
new
|
|
2467
|
+
new _(
|
|
2425
2468
|
e,
|
|
2426
2469
|
t,
|
|
2427
2470
|
s,
|
|
@@ -2432,34 +2475,34 @@ class Q {
|
|
|
2432
2475
|
grabPort(e, t, s) {
|
|
2433
2476
|
const i = this.canvas.graph.getPort(e);
|
|
2434
2477
|
this.staticPortId = e;
|
|
2435
|
-
const n = i.element.getBoundingClientRect(), h = n.x + n.width / 2, a = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l =
|
|
2478
|
+
const n = i.element.getBoundingClientRect(), h = n.x + n.width / 2, a = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l = D(c, {
|
|
2436
2479
|
x: h - d.x,
|
|
2437
2480
|
y: a - d.y
|
|
2438
|
-
}), g =
|
|
2481
|
+
}), g = D(c, {
|
|
2439
2482
|
x: t.x - d.x,
|
|
2440
2483
|
y: t.y - d.y
|
|
2441
2484
|
}), p = {
|
|
2442
|
-
overlayId:
|
|
2485
|
+
overlayId: P.Static,
|
|
2443
2486
|
portCoords: l,
|
|
2444
2487
|
portDirection: i.direction
|
|
2445
2488
|
}, f = {
|
|
2446
|
-
overlayId:
|
|
2489
|
+
overlayId: P.Dragging,
|
|
2447
2490
|
portCoords: g,
|
|
2448
2491
|
portDirection: this.params.dragPortDirection
|
|
2449
2492
|
};
|
|
2450
2493
|
this.isTargetDragging = s === "direct";
|
|
2451
|
-
const [
|
|
2452
|
-
this.overlayCanvas.addNode(
|
|
2453
|
-
from:
|
|
2454
|
-
to:
|
|
2455
|
-
shape: this.params.edgeShapeFactory(
|
|
2494
|
+
const [m, v] = this.isTargetDragging ? [p, f] : [f, p];
|
|
2495
|
+
this.overlayCanvas.addNode(B(m)), this.overlayCanvas.addNode(B(v)), this.overlayCanvas.addEdge({
|
|
2496
|
+
from: m.overlayId,
|
|
2497
|
+
to: v.overlayId,
|
|
2498
|
+
shape: this.params.edgeShapeFactory(P.Edge)
|
|
2456
2499
|
});
|
|
2457
2500
|
}
|
|
2458
2501
|
resetDragState() {
|
|
2459
2502
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2460
2503
|
}
|
|
2461
2504
|
tryCreateConnection(e) {
|
|
2462
|
-
const t =
|
|
2505
|
+
const t = ye(this.canvas.graph, e);
|
|
2463
2506
|
if (t === null) {
|
|
2464
2507
|
this.params.onEdgeCreationInterrupted(
|
|
2465
2508
|
this.staticPortId,
|
|
@@ -2474,14 +2517,14 @@ class Q {
|
|
|
2474
2517
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2475
2518
|
x: e.x - t.x,
|
|
2476
2519
|
y: e.y - t.y
|
|
2477
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2478
|
-
this.overlayCanvas.updateNode(
|
|
2520
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2521
|
+
this.overlayCanvas.updateNode(P.Dragging, {
|
|
2479
2522
|
x: n.x,
|
|
2480
2523
|
y: n.y
|
|
2481
2524
|
});
|
|
2482
2525
|
}
|
|
2483
2526
|
}
|
|
2484
|
-
class
|
|
2527
|
+
class q {
|
|
2485
2528
|
constructor(e, t, s, i, n) {
|
|
2486
2529
|
o(this, "overlayCanvas");
|
|
2487
2530
|
o(this, "staticPortId", null);
|
|
@@ -2490,7 +2533,7 @@ class _ {
|
|
|
2490
2533
|
o(this, "onEdgeReattached", (e) => {
|
|
2491
2534
|
this.params.onAfterEdgeReattached(e);
|
|
2492
2535
|
});
|
|
2493
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas =
|
|
2536
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ne(
|
|
2494
2537
|
this.overlayLayer,
|
|
2495
2538
|
this.viewportStore
|
|
2496
2539
|
), F.configure(
|
|
@@ -2514,7 +2557,7 @@ class _ {
|
|
|
2514
2557
|
);
|
|
2515
2558
|
}
|
|
2516
2559
|
static configure(e, t, s, i, n) {
|
|
2517
|
-
new
|
|
2560
|
+
new q(
|
|
2518
2561
|
e,
|
|
2519
2562
|
t,
|
|
2520
2563
|
s,
|
|
@@ -2534,10 +2577,10 @@ class _ {
|
|
|
2534
2577
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(a), l = c.element.getBoundingClientRect(), g = {
|
|
2535
2578
|
x: l.x + l.width / 2,
|
|
2536
2579
|
y: l.y + l.height / 2
|
|
2537
|
-
}, p = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(),
|
|
2580
|
+
}, p = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), m = D(p, {
|
|
2538
2581
|
x: g.x - f.x,
|
|
2539
2582
|
y: g.y - f.y
|
|
2540
|
-
}),
|
|
2583
|
+
}), v = D(p, {
|
|
2541
2584
|
x: t.x - f.x,
|
|
2542
2585
|
y: t.y - f.y
|
|
2543
2586
|
});
|
|
@@ -2549,20 +2592,20 @@ class _ {
|
|
|
2549
2592
|
priority: i.priority
|
|
2550
2593
|
}, this.canvas.removeEdge(s);
|
|
2551
2594
|
const E = {
|
|
2552
|
-
overlayId:
|
|
2553
|
-
portCoords:
|
|
2595
|
+
overlayId: P.Static,
|
|
2596
|
+
portCoords: m,
|
|
2554
2597
|
portDirection: c.direction
|
|
2555
2598
|
}, x = {
|
|
2556
|
-
overlayId:
|
|
2557
|
-
portCoords:
|
|
2599
|
+
overlayId: P.Dragging,
|
|
2600
|
+
portCoords: v,
|
|
2558
2601
|
portDirection: d.direction
|
|
2559
|
-
}, [
|
|
2560
|
-
this.overlayCanvas.addNode(
|
|
2561
|
-
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(
|
|
2602
|
+
}, [b, T] = this.isTargetDragging ? [E, x] : [x, E];
|
|
2603
|
+
this.overlayCanvas.addNode(B(b)), this.overlayCanvas.addNode(B(T));
|
|
2604
|
+
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
|
|
2562
2605
|
return this.overlayCanvas.addEdge({
|
|
2563
|
-
id:
|
|
2564
|
-
from:
|
|
2565
|
-
to:
|
|
2606
|
+
id: P.Edge,
|
|
2607
|
+
from: b.overlayId,
|
|
2608
|
+
to: T.overlayId,
|
|
2566
2609
|
shape: N
|
|
2567
2610
|
}), !0;
|
|
2568
2611
|
}
|
|
@@ -2573,15 +2616,15 @@ class _ {
|
|
|
2573
2616
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2574
2617
|
x: e.x - t.x,
|
|
2575
2618
|
y: e.y - t.y
|
|
2576
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2577
|
-
this.overlayCanvas.updateNode(
|
|
2619
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2620
|
+
this.overlayCanvas.updateNode(P.Dragging, {
|
|
2578
2621
|
x: n.x,
|
|
2579
2622
|
y: n.y
|
|
2580
2623
|
});
|
|
2581
2624
|
}
|
|
2582
2625
|
tryCreateConnection(e) {
|
|
2583
|
-
const t =
|
|
2584
|
-
if (this.overlayCanvas.removeEdge(
|
|
2626
|
+
const t = ye(this.canvas.graph, e);
|
|
2627
|
+
if (this.overlayCanvas.removeEdge(P.Edge), t === null) {
|
|
2585
2628
|
const d = this.draggingEdgePayload;
|
|
2586
2629
|
this.params.onEdgeReattachInterrupted({
|
|
2587
2630
|
id: d.id,
|
|
@@ -2613,45 +2656,45 @@ class _ {
|
|
|
2613
2656
|
}
|
|
2614
2657
|
}
|
|
2615
2658
|
}
|
|
2616
|
-
const
|
|
2659
|
+
const at = () => {
|
|
2617
2660
|
const r = document.createElement("div");
|
|
2618
2661
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2619
|
-
},
|
|
2662
|
+
}, H = () => {
|
|
2620
2663
|
const r = document.createElement("div");
|
|
2621
2664
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2622
|
-
},
|
|
2623
|
-
const r =
|
|
2665
|
+
}, ce = () => {
|
|
2666
|
+
const r = H();
|
|
2624
2667
|
return r.style.pointerEvents = "none", r;
|
|
2625
2668
|
};
|
|
2626
|
-
class
|
|
2669
|
+
class dt {
|
|
2627
2670
|
constructor(e) {
|
|
2628
|
-
o(this, "background",
|
|
2629
|
-
o(this, "main",
|
|
2630
|
-
o(this, "overlayConnectablePorts",
|
|
2631
|
-
o(this, "overlayDraggableEdges",
|
|
2632
|
-
o(this, "host",
|
|
2671
|
+
o(this, "background", H());
|
|
2672
|
+
o(this, "main", H());
|
|
2673
|
+
o(this, "overlayConnectablePorts", ce());
|
|
2674
|
+
o(this, "overlayDraggableEdges", ce());
|
|
2675
|
+
o(this, "host", at());
|
|
2633
2676
|
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);
|
|
2634
2677
|
}
|
|
2635
2678
|
destroy() {
|
|
2636
2679
|
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);
|
|
2637
2680
|
}
|
|
2638
2681
|
}
|
|
2639
|
-
const X = (r) => () => r,
|
|
2682
|
+
const X = (r) => () => r, ge = X(0), ct = () => {
|
|
2640
2683
|
let r = 0;
|
|
2641
2684
|
return () => r++;
|
|
2642
|
-
},
|
|
2643
|
-
let t =
|
|
2644
|
-
const i =
|
|
2685
|
+
}, gt = (r, e) => {
|
|
2686
|
+
let t = ge, s = ge;
|
|
2687
|
+
const i = ct();
|
|
2645
2688
|
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = X(r)), typeof e == "number" && (s = X(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
2646
2689
|
nodesPriorityFn: t,
|
|
2647
2690
|
edgesPriorityFn: s
|
|
2648
2691
|
};
|
|
2649
|
-
},
|
|
2692
|
+
}, ee = (r) => {
|
|
2650
2693
|
if (typeof r == "function")
|
|
2651
2694
|
return r;
|
|
2652
2695
|
switch (r == null ? void 0 : r.type) {
|
|
2653
2696
|
case "straight":
|
|
2654
|
-
return () => new
|
|
2697
|
+
return () => new _e({
|
|
2655
2698
|
color: r.color,
|
|
2656
2699
|
width: r.width,
|
|
2657
2700
|
arrowLength: r.arrowLength,
|
|
@@ -2665,7 +2708,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2665
2708
|
detourDirection: r.detourDirection
|
|
2666
2709
|
});
|
|
2667
2710
|
case "horizontal":
|
|
2668
|
-
return () => new
|
|
2711
|
+
return () => new Qe({
|
|
2669
2712
|
color: r.color,
|
|
2670
2713
|
width: r.width,
|
|
2671
2714
|
arrowLength: r.arrowLength,
|
|
@@ -2679,7 +2722,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2679
2722
|
detourDirection: r.detourDirection
|
|
2680
2723
|
});
|
|
2681
2724
|
case "vertical":
|
|
2682
|
-
return () => new
|
|
2725
|
+
return () => new qe({
|
|
2683
2726
|
color: r.color,
|
|
2684
2727
|
width: r.width,
|
|
2685
2728
|
arrowLength: r.arrowLength,
|
|
@@ -2693,7 +2736,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2693
2736
|
detourDirection: r.detourDirection
|
|
2694
2737
|
});
|
|
2695
2738
|
case "direct":
|
|
2696
|
-
return () => new
|
|
2739
|
+
return () => new Te({
|
|
2697
2740
|
color: r.color,
|
|
2698
2741
|
width: r.width,
|
|
2699
2742
|
arrowLength: r.arrowLength,
|
|
@@ -2704,7 +2747,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2704
2747
|
targetOffset: r.targetOffset
|
|
2705
2748
|
});
|
|
2706
2749
|
default:
|
|
2707
|
-
return () => new
|
|
2750
|
+
return () => new Je({
|
|
2708
2751
|
color: r.color,
|
|
2709
2752
|
width: r.width,
|
|
2710
2753
|
arrowLength: r.arrowLength,
|
|
@@ -2718,41 +2761,42 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2718
2761
|
detourDirection: r.detourDirection
|
|
2719
2762
|
});
|
|
2720
2763
|
}
|
|
2721
|
-
},
|
|
2764
|
+
}, lt = (r) => {
|
|
2722
2765
|
var t, s, i, n, h;
|
|
2723
|
-
const e =
|
|
2766
|
+
const e = gt(
|
|
2724
2767
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
2725
2768
|
(s = r.edges) == null ? void 0 : s.priority
|
|
2726
2769
|
);
|
|
2727
2770
|
return {
|
|
2728
2771
|
nodes: {
|
|
2729
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
2772
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? ve,
|
|
2730
2773
|
priorityFn: e.nodesPriorityFn
|
|
2731
2774
|
},
|
|
2732
2775
|
ports: {
|
|
2733
2776
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2734
2777
|
},
|
|
2735
2778
|
edges: {
|
|
2736
|
-
shapeFactory:
|
|
2779
|
+
shapeFactory: ee(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
|
|
2737
2780
|
priorityFn: e.edgesPriorityFn
|
|
2738
2781
|
}
|
|
2739
2782
|
};
|
|
2740
|
-
},
|
|
2741
|
-
var p, f,
|
|
2742
|
-
const e = ((p = r
|
|
2743
|
-
}), t = ((f = r
|
|
2744
|
-
}), i =
|
|
2783
|
+
}, ut = (r) => {
|
|
2784
|
+
var p, f, m, v, E, x;
|
|
2785
|
+
const e = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
2786
|
+
}), t = ((f = r.events) == null ? void 0 : f.onBeforeNodeDrag) ?? (() => !0), s = ((m = r.events) == null ? void 0 : m.onNodeDragFinished) ?? (() => {
|
|
2787
|
+
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, h = (v = r.mouse) == null ? void 0 : v.dragCursor, a = h !== void 0 ? h : "grab", d = (E = r.mouse) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, l = (x = r.mouse) == null ? void 0 : x.mouseUpEventVerifier, g = l !== void 0 ? l : (b) => b.button === 0;
|
|
2745
2788
|
return {
|
|
2746
2789
|
moveOnTop: i,
|
|
2747
2790
|
moveEdgesOnTop: n,
|
|
2748
2791
|
dragCursor: a,
|
|
2792
|
+
gridSize: r.gridSize ?? null,
|
|
2749
2793
|
mouseDownEventVerifier: c,
|
|
2750
|
-
mouseUpEventVerifier:
|
|
2794
|
+
mouseUpEventVerifier: g,
|
|
2751
2795
|
onNodeDrag: e,
|
|
2752
2796
|
onBeforeNodeDrag: t,
|
|
2753
2797
|
onNodeDragFinished: s
|
|
2754
2798
|
};
|
|
2755
|
-
},
|
|
2799
|
+
}, pt = (r) => {
|
|
2756
2800
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
2757
2801
|
return (n) => {
|
|
2758
2802
|
let h = n.nextTransform.x, a = n.nextTransform.y;
|
|
@@ -2762,7 +2806,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2762
2806
|
const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
|
|
2763
2807
|
return a > g && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: h, y: a };
|
|
2764
2808
|
};
|
|
2765
|
-
},
|
|
2809
|
+
}, wt = (r) => {
|
|
2766
2810
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
2767
2811
|
return (n) => {
|
|
2768
2812
|
const h = n.prevTransform, a = n.nextTransform;
|
|
@@ -2783,7 +2827,7 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2783
2827
|
y: l
|
|
2784
2828
|
};
|
|
2785
2829
|
};
|
|
2786
|
-
},
|
|
2830
|
+
}, ft = (r) => (e) => r.reduce(
|
|
2787
2831
|
(t, s) => s({
|
|
2788
2832
|
prevTransform: e.prevTransform,
|
|
2789
2833
|
nextTransform: t,
|
|
@@ -2791,40 +2835,40 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2791
2835
|
canvasHeight: e.canvasHeight
|
|
2792
2836
|
}),
|
|
2793
2837
|
e.nextTransform
|
|
2794
|
-
),
|
|
2838
|
+
), le = (r) => {
|
|
2795
2839
|
if (typeof r == "function")
|
|
2796
2840
|
return r;
|
|
2797
2841
|
switch (r.type) {
|
|
2798
2842
|
case "scale-limit":
|
|
2799
|
-
return
|
|
2843
|
+
return wt({
|
|
2800
2844
|
minContentScale: r.minContentScale ?? 0,
|
|
2801
2845
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
2802
2846
|
});
|
|
2803
2847
|
case "shift-limit":
|
|
2804
|
-
return
|
|
2848
|
+
return pt({
|
|
2805
2849
|
minX: r.minX ?? -1 / 0,
|
|
2806
2850
|
maxX: r.maxX ?? 1 / 0,
|
|
2807
2851
|
minY: r.minY ?? -1 / 0,
|
|
2808
2852
|
maxY: r.maxY ?? 1 / 0
|
|
2809
2853
|
});
|
|
2810
2854
|
}
|
|
2811
|
-
},
|
|
2812
|
-
var
|
|
2813
|
-
const e = (
|
|
2855
|
+
}, ue = (r) => {
|
|
2856
|
+
var m, v, E, x, b, T, N, C, te, re, oe, se;
|
|
2857
|
+
const e = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
2814
2858
|
let i;
|
|
2815
|
-
s !== void 0 ? Array.isArray(s) ? i =
|
|
2859
|
+
s !== void 0 ? Array.isArray(s) ? i = ft(
|
|
2816
2860
|
s.map(
|
|
2817
|
-
(M) =>
|
|
2861
|
+
(M) => le(M)
|
|
2818
2862
|
)
|
|
2819
|
-
) : i =
|
|
2820
|
-
const n = ((
|
|
2863
|
+
) : i = le(s) : i = (M) => M.nextTransform;
|
|
2864
|
+
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
2821
2865
|
}), a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
2822
|
-
}), d = (
|
|
2866
|
+
}), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, l = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, g = l !== void 0 ? l : (M) => M.button === 0, p = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
|
|
2823
2867
|
return {
|
|
2824
2868
|
wheelSensitivity: t,
|
|
2825
|
-
onTransformStarted: ((
|
|
2869
|
+
onTransformStarted: ((C = r == null ? void 0 : r.events) == null ? void 0 : C.onTransformStarted) ?? (() => {
|
|
2826
2870
|
}),
|
|
2827
|
-
onTransformFinished: ((
|
|
2871
|
+
onTransformFinished: ((te = r == null ? void 0 : r.events) == null ? void 0 : te.onTransformFinished) ?? (() => {
|
|
2828
2872
|
}),
|
|
2829
2873
|
onBeforeTransformChange: h,
|
|
2830
2874
|
onTransformChange: a,
|
|
@@ -2833,30 +2877,30 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2833
2877
|
mouseDownEventVerifier: c,
|
|
2834
2878
|
mouseUpEventVerifier: g,
|
|
2835
2879
|
mouseWheelEventVerifier: f,
|
|
2836
|
-
scaleWheelFinishTimeout: ((
|
|
2837
|
-
onResizeTransformStarted: ((
|
|
2880
|
+
scaleWheelFinishTimeout: ((re = r == null ? void 0 : r.scale) == null ? void 0 : re.wheelFinishTimeout) ?? 500,
|
|
2881
|
+
onResizeTransformStarted: ((oe = r == null ? void 0 : r.events) == null ? void 0 : oe.onResizeTransformStarted) ?? (() => {
|
|
2838
2882
|
}),
|
|
2839
|
-
onResizeTransformFinished: ((
|
|
2883
|
+
onResizeTransformFinished: ((se = r == null ? void 0 : r.events) == null ? void 0 : se.onResizeTransformFinished) ?? (() => {
|
|
2840
2884
|
})
|
|
2841
2885
|
};
|
|
2842
|
-
},
|
|
2886
|
+
}, mt = (r, e) => {
|
|
2843
2887
|
const t = document.createElementNS(
|
|
2844
2888
|
"http://www.w3.org/2000/svg",
|
|
2845
2889
|
"circle"
|
|
2846
2890
|
);
|
|
2847
2891
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
2848
|
-
},
|
|
2892
|
+
}, yt = (r) => r instanceof SVGElement ? r : mt(
|
|
2849
2893
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
2850
2894
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
2851
|
-
),
|
|
2852
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i =
|
|
2895
|
+
), vt = (r) => {
|
|
2896
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = yt(r.renderer ?? {});
|
|
2853
2897
|
return {
|
|
2854
2898
|
tileWidth: t,
|
|
2855
2899
|
tileHeight: s,
|
|
2856
2900
|
renderer: i,
|
|
2857
2901
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
2858
2902
|
};
|
|
2859
|
-
},
|
|
2903
|
+
}, Et = (r, e, t) => {
|
|
2860
2904
|
var c, l, g;
|
|
2861
2905
|
const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, h = () => {
|
|
2862
2906
|
}, a = () => {
|
|
@@ -2871,9 +2915,9 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2871
2915
|
onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
|
|
2872
2916
|
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? a,
|
|
2873
2917
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
2874
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
2918
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ee(r.edgeShape) : e
|
|
2875
2919
|
};
|
|
2876
|
-
},
|
|
2920
|
+
}, At = (r, e) => {
|
|
2877
2921
|
var c, l, g;
|
|
2878
2922
|
const t = (p) => p, s = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
|
|
2879
2923
|
const f = e.getPortAdjacentEdgeIds(p);
|
|
@@ -2887,13 +2931,24 @@ const X = (r) => () => r, ce = X(0), dt = () => {
|
|
|
2887
2931
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
2888
2932
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
2889
2933
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
2890
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
2934
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ee(r.draggingEdgeShape) : null,
|
|
2891
2935
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? h,
|
|
2892
2936
|
onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
|
|
2893
2937
|
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? a
|
|
2894
2938
|
};
|
|
2939
|
+
}, xt = (r) => ({
|
|
2940
|
+
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
2941
|
+
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
2942
|
+
}), St = (r) => {
|
|
2943
|
+
var e, t;
|
|
2944
|
+
return {
|
|
2945
|
+
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
2946
|
+
}),
|
|
2947
|
+
onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? (() => {
|
|
2948
|
+
})
|
|
2949
|
+
};
|
|
2895
2950
|
};
|
|
2896
|
-
class
|
|
2951
|
+
class Tt {
|
|
2897
2952
|
constructor(e) {
|
|
2898
2953
|
o(this, "element", null);
|
|
2899
2954
|
o(this, "canvasDefaults", {});
|
|
@@ -2945,6 +3000,8 @@ class St {
|
|
|
2945
3000
|
return this.hasResizeReactiveNodes = !0, this;
|
|
2946
3001
|
}
|
|
2947
3002
|
/**
|
|
3003
|
+
* @deprecated
|
|
3004
|
+
* do not use
|
|
2948
3005
|
* sets emitter for rendering graph inside bounded area
|
|
2949
3006
|
*/
|
|
2950
3007
|
enableBoxAreaRendering(e) {
|
|
@@ -2981,37 +3038,42 @@ class St {
|
|
|
2981
3038
|
"unable to build canvas when no attach element specified"
|
|
2982
3039
|
);
|
|
2983
3040
|
let e = this.boxRenderingTrigger;
|
|
2984
|
-
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new
|
|
2985
|
-
const t = new
|
|
2986
|
-
let n = new
|
|
3041
|
+
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new we());
|
|
3042
|
+
const t = new me(), s = new Fe(), i = new dt(this.element);
|
|
3043
|
+
let n = new pe(
|
|
2987
3044
|
t,
|
|
2988
3045
|
s,
|
|
2989
3046
|
i.main
|
|
2990
3047
|
);
|
|
2991
|
-
e !== void 0 && (n = new Ue(
|
|
2992
|
-
|
|
3048
|
+
e !== void 0 && (n = new Ue(
|
|
3049
|
+
n,
|
|
3050
|
+
t,
|
|
3051
|
+
e,
|
|
3052
|
+
St(this.virtualScrollConfig)
|
|
3053
|
+
));
|
|
3054
|
+
const h = lt(this.canvasDefaults), a = new fe(
|
|
2993
3055
|
this.element,
|
|
2994
3056
|
t,
|
|
2995
3057
|
s,
|
|
2996
3058
|
n,
|
|
2997
3059
|
h
|
|
2998
3060
|
);
|
|
2999
|
-
if (this.hasBackground &&
|
|
3061
|
+
if (this.hasBackground && Q.configure(
|
|
3000
3062
|
a,
|
|
3001
|
-
|
|
3063
|
+
vt(this.backgroundConfig),
|
|
3002
3064
|
i.background
|
|
3003
|
-
), this.hasResizeReactiveNodes && Y.configure(a), this.hasDraggableNode &&
|
|
3065
|
+
), this.hasResizeReactiveNodes && Y.configure(a), this.hasDraggableNode && Z.configure(
|
|
3004
3066
|
a,
|
|
3005
3067
|
i.main,
|
|
3006
3068
|
this.window,
|
|
3007
|
-
|
|
3069
|
+
ut(this.dragConfig)
|
|
3008
3070
|
), this.hasUserConnectablePorts) {
|
|
3009
|
-
const c =
|
|
3071
|
+
const c = Et(
|
|
3010
3072
|
this.connectablePortsConfig,
|
|
3011
3073
|
h.edges.shapeFactory,
|
|
3012
3074
|
h.ports.direction
|
|
3013
3075
|
);
|
|
3014
|
-
|
|
3076
|
+
_.configure(
|
|
3015
3077
|
a,
|
|
3016
3078
|
i.overlayConnectablePorts,
|
|
3017
3079
|
s,
|
|
@@ -3020,11 +3082,11 @@ class St {
|
|
|
3020
3082
|
);
|
|
3021
3083
|
}
|
|
3022
3084
|
if (this.hasUserDraggableEdges) {
|
|
3023
|
-
const c =
|
|
3085
|
+
const c = At(
|
|
3024
3086
|
this.draggableEdgesConfig,
|
|
3025
3087
|
a.graph
|
|
3026
3088
|
);
|
|
3027
|
-
|
|
3089
|
+
q.configure(
|
|
3028
3090
|
a,
|
|
3029
3091
|
i.overlayDraggableEdges,
|
|
3030
3092
|
s,
|
|
@@ -3032,18 +3094,18 @@ class St {
|
|
|
3032
3094
|
c
|
|
3033
3095
|
);
|
|
3034
3096
|
}
|
|
3035
|
-
this.virtualScrollConfig !== void 0 ?
|
|
3097
|
+
this.virtualScrollConfig !== void 0 ? J.configure(
|
|
3036
3098
|
a,
|
|
3037
3099
|
i.main,
|
|
3038
3100
|
this.window,
|
|
3039
|
-
|
|
3101
|
+
ue(this.transformConfig),
|
|
3040
3102
|
e,
|
|
3041
|
-
this.virtualScrollConfig
|
|
3042
|
-
) : this.hasTransformableViewport &&
|
|
3103
|
+
xt(this.virtualScrollConfig)
|
|
3104
|
+
) : this.hasTransformableViewport && O.configure(
|
|
3043
3105
|
a,
|
|
3044
3106
|
i.main,
|
|
3045
3107
|
this.window,
|
|
3046
|
-
|
|
3108
|
+
ue(this.transformConfig)
|
|
3047
3109
|
), this.reset();
|
|
3048
3110
|
const d = () => {
|
|
3049
3111
|
i.destroy(), a.onBeforeDestroy.unsubscribe(d);
|
|
@@ -3059,17 +3121,17 @@ class St {
|
|
|
3059
3121
|
}
|
|
3060
3122
|
}
|
|
3061
3123
|
export {
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3124
|
+
Je as BezierEdgeShape,
|
|
3125
|
+
Tt as CanvasBuilder,
|
|
3126
|
+
Te as DirectEdgeShape,
|
|
3127
|
+
we as EventSubject,
|
|
3128
|
+
Qe as HorizontalEdgeShape,
|
|
3067
3129
|
S as HtmlGraphError,
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3130
|
+
rt as InteractiveEdgeError,
|
|
3131
|
+
De as InteractiveEdgeShape,
|
|
3132
|
+
$ as LineEdgeShape,
|
|
3133
|
+
bt as MedianEdgeShape,
|
|
3134
|
+
bt as MidpointEdgeShape,
|
|
3135
|
+
_e as StraightEdgeShape,
|
|
3136
|
+
qe as VerticalEdgeShape
|
|
3075
3137
|
};
|