@html-graph/html-graph 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +1 -0
- package/dist/html-graph.js +235 -204
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
2
|
var Oe = (r, e, t) => e in r ? Fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var o = (r, e, t) => Oe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
const
|
|
4
|
+
const N = (r, e) => ({
|
|
5
5
|
x: r.scale * e.x + r.x,
|
|
6
6
|
y: r.scale * e.y + r.y
|
|
7
7
|
});
|
|
@@ -15,7 +15,7 @@ const We = () => {
|
|
|
15
15
|
}, ze = (r) => {
|
|
16
16
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
18
|
+
class ye {
|
|
19
19
|
constructor(e, t, s) {
|
|
20
20
|
o(this, "host", We());
|
|
21
21
|
o(this, "container", ke());
|
|
@@ -90,7 +90,7 @@ class me {
|
|
|
90
90
|
const n = {
|
|
91
91
|
x: t.left - s.left,
|
|
92
92
|
y: t.top - s.top
|
|
93
|
-
}, a =
|
|
93
|
+
}, a = N(i, n);
|
|
94
94
|
return {
|
|
95
95
|
x: a.x,
|
|
96
96
|
y: a.y,
|
|
@@ -846,27 +846,54 @@ const Ke = (r, e, t) => {
|
|
|
846
846
|
]
|
|
847
847
|
};
|
|
848
848
|
}, Je = (r, e) => {
|
|
849
|
-
let t = e
|
|
850
|
-
for (; t !== null
|
|
849
|
+
let t = e;
|
|
850
|
+
for (; t !== null; ) {
|
|
851
|
+
const s = r.getElementPortIds(t)[0] ?? null;
|
|
852
|
+
if (s !== null)
|
|
853
|
+
return {
|
|
854
|
+
status: "portFound",
|
|
855
|
+
portId: s
|
|
856
|
+
};
|
|
857
|
+
if (r.getElementNodeId(t) !== null)
|
|
858
|
+
return {
|
|
859
|
+
status: "nodeEncountered"
|
|
860
|
+
};
|
|
851
861
|
t = t.parentElement;
|
|
852
|
-
|
|
853
|
-
|
|
862
|
+
}
|
|
863
|
+
return {
|
|
864
|
+
status: "notFound"
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
function* Ae(r, e) {
|
|
868
|
+
const t = r.elementsFromPoint(e.x, e.y);
|
|
869
|
+
for (const s of t) {
|
|
870
|
+
if (s.shadowRoot !== null) {
|
|
871
|
+
const i = Ae(s.shadowRoot, e);
|
|
872
|
+
for (const n of i)
|
|
873
|
+
yield n;
|
|
874
|
+
}
|
|
875
|
+
yield s;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const xe = (r, e) => {
|
|
854
879
|
const t = Ae(document, e);
|
|
855
880
|
for (const s of t) {
|
|
856
881
|
const i = Je(r, s);
|
|
857
|
-
if (i
|
|
858
|
-
return i;
|
|
882
|
+
if (i.status === "portFound")
|
|
883
|
+
return i.portId;
|
|
884
|
+
if (i.status === "nodeEncountered")
|
|
885
|
+
return null;
|
|
859
886
|
}
|
|
860
887
|
return null;
|
|
861
888
|
};
|
|
862
|
-
var
|
|
889
|
+
var T = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(T || {});
|
|
863
890
|
const Se = (r, e) => ({
|
|
864
891
|
x: r / 2,
|
|
865
892
|
y: e / 2
|
|
866
|
-
}),
|
|
893
|
+
}), u = {
|
|
867
894
|
x: 0,
|
|
868
895
|
y: 0
|
|
869
|
-
},
|
|
896
|
+
}, y = (r, e, t) => ({
|
|
870
897
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
871
898
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
872
899
|
}), Pe = (r, e) => {
|
|
@@ -896,11 +923,11 @@ class Qe {
|
|
|
896
923
|
this.params = e;
|
|
897
924
|
const t = this.params.to;
|
|
898
925
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
899
|
-
const s =
|
|
900
|
-
{ x: this.params.arrowLength, y:
|
|
926
|
+
const s = y(
|
|
927
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
901
928
|
this.params.sourceDirection,
|
|
902
|
-
|
|
903
|
-
), i =
|
|
929
|
+
u
|
|
930
|
+
), i = y(
|
|
904
931
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
905
932
|
this.params.targetDirection,
|
|
906
933
|
this.params.to
|
|
@@ -910,7 +937,7 @@ class Qe {
|
|
|
910
937
|
}, a = {
|
|
911
938
|
x: i.x - this.params.targetDirection.x * this.params.curvature,
|
|
912
939
|
y: i.y - this.params.targetDirection.y * this.params.curvature
|
|
913
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${
|
|
940
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${u.x} ${u.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
914
941
|
this.path = `${d}${h}${c}`;
|
|
915
942
|
}
|
|
916
943
|
}
|
|
@@ -919,35 +946,35 @@ class qe {
|
|
|
919
946
|
o(this, "path");
|
|
920
947
|
o(this, "midpoint");
|
|
921
948
|
this.params = e;
|
|
922
|
-
const t = this.params.hasSourceArrow ?
|
|
923
|
-
{ x: this.params.arrowLength, y:
|
|
949
|
+
const t = this.params.hasSourceArrow ? y(
|
|
950
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
924
951
|
this.params.sourceDirection,
|
|
925
|
-
|
|
926
|
-
) :
|
|
952
|
+
u
|
|
953
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
927
954
|
{
|
|
928
955
|
x: this.params.to.x - this.params.arrowLength,
|
|
929
956
|
y: this.params.to.y
|
|
930
957
|
},
|
|
931
958
|
this.params.targetDirection,
|
|
932
959
|
this.params.to
|
|
933
|
-
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c =
|
|
934
|
-
{ x: i, y:
|
|
960
|
+
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = y(
|
|
961
|
+
{ x: i, y: u.y },
|
|
935
962
|
this.params.sourceDirection,
|
|
936
|
-
|
|
963
|
+
u
|
|
937
964
|
), g = {
|
|
938
965
|
x: c.x + h,
|
|
939
966
|
y: c.y + d
|
|
940
|
-
}, l =
|
|
967
|
+
}, l = y(
|
|
941
968
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
942
969
|
this.params.targetDirection,
|
|
943
970
|
this.params.to
|
|
944
|
-
),
|
|
971
|
+
), p = {
|
|
945
972
|
x: l.x + h,
|
|
946
973
|
y: l.y + d
|
|
947
974
|
}, w = {
|
|
948
|
-
x: (g.x +
|
|
949
|
-
y: (g.y +
|
|
950
|
-
},
|
|
975
|
+
x: (g.x + p.x) / 2,
|
|
976
|
+
y: (g.y + p.y) / 2
|
|
977
|
+
}, m = {
|
|
951
978
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
952
979
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
953
980
|
}, v = {
|
|
@@ -963,7 +990,7 @@ class qe {
|
|
|
963
990
|
this.path = [
|
|
964
991
|
`M ${t.x} ${t.y}`,
|
|
965
992
|
`L ${c.x} ${c.y}`,
|
|
966
|
-
`C ${
|
|
993
|
+
`C ${m.x} ${m.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
|
|
967
994
|
`C ${A.x} ${A.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
968
995
|
`L ${s.x} ${s.y}`
|
|
969
996
|
].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
|
|
@@ -985,20 +1012,20 @@ const Z = Object.freeze({
|
|
|
985
1012
|
return r.style.transformOrigin = "50% 50%", r;
|
|
986
1013
|
}, Ne = (r, e) => {
|
|
987
1014
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
988
|
-
},
|
|
1015
|
+
}, R = (r, e) => {
|
|
989
1016
|
const t = [];
|
|
990
1017
|
if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
991
1018
|
const s = r.length - 1;
|
|
992
1019
|
let i = 0, n = 0, a = 0;
|
|
993
1020
|
r.forEach((h, d) => {
|
|
994
1021
|
let c = 0, g = 0, l = 0;
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
1022
|
+
const p = d > 0, w = d < s, m = p && w;
|
|
1023
|
+
if (p && (c = -i, g = -n, l = a), w) {
|
|
997
1024
|
const $ = r[d + 1];
|
|
998
1025
|
i = $.x - h.x, n = $.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
999
1026
|
}
|
|
1000
|
-
const E = a !== 0 ? Math.min((
|
|
1001
|
-
d > 0 && t.push(`L ${
|
|
1027
|
+
const E = a !== 0 ? Math.min((m ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = m ? { x: h.x + i * E, y: h.y + n * E } : h, b = l !== 0 ? Math.min((m ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = m ? { x: h.x + c * b, y: h.y + g * b } : h;
|
|
1028
|
+
d > 0 && t.push(`L ${M.x} ${M.y}`), m && t.push(
|
|
1002
1029
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
|
|
1003
1030
|
);
|
|
1004
1031
|
});
|
|
@@ -1012,34 +1039,34 @@ class _e {
|
|
|
1012
1039
|
this.params = e;
|
|
1013
1040
|
const t = this.params.to;
|
|
1014
1041
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1015
|
-
const s = this.params.hasSourceArrow ?
|
|
1016
|
-
{ x: this.params.arrowLength, y:
|
|
1042
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1043
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1017
1044
|
this.params.sourceDirection,
|
|
1018
|
-
|
|
1019
|
-
) :
|
|
1045
|
+
u
|
|
1046
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1020
1047
|
{
|
|
1021
1048
|
x: this.params.to.x - this.params.arrowLength,
|
|
1022
1049
|
y: this.params.to.y
|
|
1023
1050
|
},
|
|
1024
1051
|
this.params.targetDirection,
|
|
1025
1052
|
this.params.to
|
|
1026
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1027
|
-
{ x: a, y:
|
|
1053
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1054
|
+
{ x: a, y: u.y },
|
|
1028
1055
|
this.params.sourceDirection,
|
|
1029
|
-
|
|
1030
|
-
), d =
|
|
1056
|
+
u
|
|
1057
|
+
), d = y(
|
|
1031
1058
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1032
1059
|
this.params.targetDirection,
|
|
1033
1060
|
this.params.to
|
|
1034
1061
|
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1035
1062
|
x: this.params.flipX > 0 ? c : -n,
|
|
1036
1063
|
y: h.y
|
|
1037
|
-
},
|
|
1064
|
+
}, p = { x: l.x, y: g }, w = {
|
|
1038
1065
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1039
1066
|
y: d.y
|
|
1040
|
-
},
|
|
1041
|
-
this.path =
|
|
1042
|
-
[s, h, l,
|
|
1067
|
+
}, m = { x: w.x, y: g };
|
|
1068
|
+
this.path = R(
|
|
1069
|
+
[s, h, l, p, m, w, d, i],
|
|
1043
1070
|
this.params.roundness
|
|
1044
1071
|
);
|
|
1045
1072
|
}
|
|
@@ -1049,28 +1076,28 @@ class et {
|
|
|
1049
1076
|
o(this, "path");
|
|
1050
1077
|
o(this, "midpoint");
|
|
1051
1078
|
this.params = e;
|
|
1052
|
-
const t = this.params.hasSourceArrow ?
|
|
1053
|
-
{ x: this.params.arrowLength, y:
|
|
1079
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1080
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1054
1081
|
this.params.sourceDirection,
|
|
1055
|
-
|
|
1056
|
-
) :
|
|
1082
|
+
u
|
|
1083
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1057
1084
|
{
|
|
1058
1085
|
x: this.params.to.x - this.params.arrowLength,
|
|
1059
1086
|
y: this.params.to.y
|
|
1060
1087
|
},
|
|
1061
1088
|
this.params.targetDirection,
|
|
1062
1089
|
this.params.to
|
|
1063
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1064
|
-
{ x: i, y:
|
|
1090
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1091
|
+
{ x: i, y: u.y },
|
|
1065
1092
|
this.params.sourceDirection,
|
|
1066
|
-
|
|
1067
|
-
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l =
|
|
1093
|
+
u
|
|
1094
|
+
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
|
|
1068
1095
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1069
1096
|
this.params.targetDirection,
|
|
1070
1097
|
this.params.to
|
|
1071
|
-
),
|
|
1072
|
-
this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path =
|
|
1073
|
-
[t, n, g,
|
|
1098
|
+
), p = { x: l.x + d, y: l.y + c }, w = { x: (g.x + p.x) / 2, y: (g.y + p.y) / 2 };
|
|
1099
|
+
this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = R(
|
|
1100
|
+
[t, n, g, p, l, s],
|
|
1074
1101
|
this.params.roundness
|
|
1075
1102
|
);
|
|
1076
1103
|
}
|
|
@@ -1082,27 +1109,27 @@ class tt {
|
|
|
1082
1109
|
this.params = e;
|
|
1083
1110
|
const t = this.params.to;
|
|
1084
1111
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1085
|
-
const s = this.params.hasSourceArrow ?
|
|
1086
|
-
{ x: this.params.arrowLength, y:
|
|
1112
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1113
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1087
1114
|
this.params.sourceDirection,
|
|
1088
|
-
|
|
1089
|
-
) :
|
|
1115
|
+
u
|
|
1116
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1090
1117
|
{
|
|
1091
1118
|
x: this.params.to.x - this.params.arrowLength,
|
|
1092
1119
|
y: this.params.to.y
|
|
1093
1120
|
},
|
|
1094
1121
|
this.params.targetDirection,
|
|
1095
1122
|
this.params.to
|
|
1096
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a =
|
|
1097
|
-
{ x: n, y:
|
|
1123
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
|
|
1124
|
+
{ x: n, y: u.y },
|
|
1098
1125
|
this.params.sourceDirection,
|
|
1099
|
-
|
|
1100
|
-
), h =
|
|
1126
|
+
u
|
|
1127
|
+
), h = y(
|
|
1101
1128
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1102
1129
|
this.params.targetDirection,
|
|
1103
1130
|
this.params.to
|
|
1104
1131
|
);
|
|
1105
|
-
this.path =
|
|
1132
|
+
this.path = R([s, a, h, i], this.params.roundness);
|
|
1106
1133
|
}
|
|
1107
1134
|
}
|
|
1108
1135
|
class rt {
|
|
@@ -1112,34 +1139,34 @@ class rt {
|
|
|
1112
1139
|
this.params = e;
|
|
1113
1140
|
const t = this.params.to;
|
|
1114
1141
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1115
|
-
const s = this.params.hasSourceArrow ?
|
|
1116
|
-
{ x: this.params.arrowLength, y:
|
|
1142
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1143
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1117
1144
|
this.params.sourceDirection,
|
|
1118
|
-
|
|
1119
|
-
) :
|
|
1145
|
+
u
|
|
1146
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1120
1147
|
{
|
|
1121
1148
|
x: this.params.to.x - this.params.arrowLength,
|
|
1122
1149
|
y: this.params.to.y
|
|
1123
1150
|
},
|
|
1124
1151
|
this.params.targetDirection,
|
|
1125
1152
|
this.params.to
|
|
1126
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1127
|
-
{ x: a, y:
|
|
1153
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1154
|
+
{ x: a, y: u.y },
|
|
1128
1155
|
this.params.sourceDirection,
|
|
1129
|
-
|
|
1130
|
-
), d =
|
|
1156
|
+
u
|
|
1157
|
+
), d = y(
|
|
1131
1158
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1132
1159
|
this.params.targetDirection,
|
|
1133
1160
|
this.params.to
|
|
1134
1161
|
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1135
1162
|
x: h.x,
|
|
1136
1163
|
y: this.params.flipY > 0 ? c : -n
|
|
1137
|
-
},
|
|
1164
|
+
}, p = { x: g, y: l.y }, w = {
|
|
1138
1165
|
x: d.x,
|
|
1139
1166
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1140
|
-
},
|
|
1141
|
-
this.path =
|
|
1142
|
-
[s, h, l,
|
|
1167
|
+
}, m = { x: g, y: w.y };
|
|
1168
|
+
this.path = R(
|
|
1169
|
+
[s, h, l, p, m, w, d, i],
|
|
1143
1170
|
this.params.roundness
|
|
1144
1171
|
);
|
|
1145
1172
|
}
|
|
@@ -1150,18 +1177,18 @@ class J {
|
|
|
1150
1177
|
o(this, "midpoint");
|
|
1151
1178
|
this.params = e;
|
|
1152
1179
|
const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
|
|
1153
|
-
{ x: this.params.arrowLength, y:
|
|
1154
|
-
{ x: i, y:
|
|
1180
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1181
|
+
{ x: i, y: u.y },
|
|
1155
1182
|
{ x: i, y: this.params.side },
|
|
1156
1183
|
{ x: n, y: this.params.side },
|
|
1157
1184
|
{ x: n, y: -this.params.side },
|
|
1158
1185
|
{ x: i, y: -this.params.side },
|
|
1159
|
-
{ x: i, y:
|
|
1160
|
-
{ x: this.params.arrowLength, y:
|
|
1186
|
+
{ x: i, y: u.y },
|
|
1187
|
+
{ x: this.params.arrowLength, y: u.y }
|
|
1161
1188
|
].map(
|
|
1162
|
-
(c) =>
|
|
1163
|
-
), d = `M ${
|
|
1164
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1189
|
+
(c) => y(c, this.params.sourceDirection, u)
|
|
1190
|
+
), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
|
|
1191
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1165
1192
|
}
|
|
1166
1193
|
}
|
|
1167
1194
|
class st {
|
|
@@ -1170,19 +1197,19 @@ class st {
|
|
|
1170
1197
|
o(this, "midpoint");
|
|
1171
1198
|
this.params = e;
|
|
1172
1199
|
const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1173
|
-
{ x: this.params.arrowLength, y:
|
|
1200
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1174
1201
|
{ x: c, y: n },
|
|
1175
1202
|
{ x: c, y: -n },
|
|
1176
1203
|
{ x: d, y: 0 }
|
|
1177
1204
|
].map(
|
|
1178
|
-
(
|
|
1179
|
-
),
|
|
1205
|
+
(m) => y(m, this.params.sourceDirection, u)
|
|
1206
|
+
), p = [
|
|
1180
1207
|
`M ${l[0].x} ${l[0].y}`,
|
|
1181
1208
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1182
1209
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1183
1210
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1184
1211
|
].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1185
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${
|
|
1212
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${p}`, this.midpoint = l[3];
|
|
1186
1213
|
}
|
|
1187
1214
|
}
|
|
1188
1215
|
class ot {
|
|
@@ -1204,7 +1231,7 @@ class ot {
|
|
|
1204
1231
|
offset: this.params.sourceOffset,
|
|
1205
1232
|
hasArrow: this.params.hasSourceArrow,
|
|
1206
1233
|
flip: 1,
|
|
1207
|
-
shift:
|
|
1234
|
+
shift: u
|
|
1208
1235
|
}), n = this.createDirectLinePoint({
|
|
1209
1236
|
offset: this.params.targetOffset,
|
|
1210
1237
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1226,22 +1253,22 @@ class it {
|
|
|
1226
1253
|
o(this, "path");
|
|
1227
1254
|
o(this, "midpoint");
|
|
1228
1255
|
this.params = e;
|
|
1229
|
-
const t = this.params.hasSourceArrow ?
|
|
1230
|
-
{ x: this.params.arrowLength, y:
|
|
1256
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1257
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1231
1258
|
this.params.sourceDirection,
|
|
1232
|
-
|
|
1233
|
-
) :
|
|
1259
|
+
u
|
|
1260
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1234
1261
|
{
|
|
1235
1262
|
x: this.params.to.x - this.params.arrowLength,
|
|
1236
1263
|
y: this.params.to.y
|
|
1237
1264
|
},
|
|
1238
1265
|
this.params.targetDirection,
|
|
1239
1266
|
this.params.to
|
|
1240
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1241
|
-
{ x: i, y:
|
|
1267
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1268
|
+
{ x: i, y: u.y },
|
|
1242
1269
|
this.params.sourceDirection,
|
|
1243
|
-
|
|
1244
|
-
), a =
|
|
1270
|
+
u
|
|
1271
|
+
), a = y(
|
|
1245
1272
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1246
1273
|
this.params.targetDirection,
|
|
1247
1274
|
this.params.to
|
|
@@ -1249,7 +1276,7 @@ class it {
|
|
|
1249
1276
|
x: (n.x + a.x) / 2,
|
|
1250
1277
|
y: g
|
|
1251
1278
|
};
|
|
1252
|
-
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path =
|
|
1279
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = R(
|
|
1253
1280
|
[
|
|
1254
1281
|
t,
|
|
1255
1282
|
n,
|
|
@@ -1267,22 +1294,22 @@ class nt {
|
|
|
1267
1294
|
o(this, "path");
|
|
1268
1295
|
o(this, "midpoint");
|
|
1269
1296
|
this.params = e;
|
|
1270
|
-
const t = this.params.hasSourceArrow ?
|
|
1271
|
-
{ x: this.params.arrowLength, y:
|
|
1297
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1298
|
+
{ x: this.params.arrowLength, y: u.y },
|
|
1272
1299
|
this.params.sourceDirection,
|
|
1273
|
-
|
|
1274
|
-
) :
|
|
1300
|
+
u
|
|
1301
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1275
1302
|
{
|
|
1276
1303
|
x: this.params.to.x - this.params.arrowLength,
|
|
1277
1304
|
y: this.params.to.y
|
|
1278
1305
|
},
|
|
1279
1306
|
this.params.targetDirection,
|
|
1280
1307
|
this.params.to
|
|
1281
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1282
|
-
{ x: i, y:
|
|
1308
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1309
|
+
{ x: i, y: u.y },
|
|
1283
1310
|
this.params.sourceDirection,
|
|
1284
|
-
|
|
1285
|
-
), a =
|
|
1311
|
+
u
|
|
1312
|
+
), a = y(
|
|
1286
1313
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1287
1314
|
this.params.targetDirection,
|
|
1288
1315
|
this.params.to
|
|
@@ -1290,7 +1317,7 @@ class nt {
|
|
|
1290
1317
|
x: g,
|
|
1291
1318
|
y: (n.y + a.y) / 2
|
|
1292
1319
|
};
|
|
1293
|
-
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path =
|
|
1320
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = R(
|
|
1294
1321
|
[
|
|
1295
1322
|
t,
|
|
1296
1323
|
n,
|
|
@@ -1356,9 +1383,9 @@ class k {
|
|
|
1356
1383
|
x: i,
|
|
1357
1384
|
y: n
|
|
1358
1385
|
};
|
|
1359
|
-
let l = { x: -c.x, y: -c.y },
|
|
1360
|
-
e.category === C.PortCycle ? (
|
|
1361
|
-
const w =
|
|
1386
|
+
let l = { x: -c.x, y: -c.y }, p;
|
|
1387
|
+
e.category === C.PortCycle ? (p = this.params.createCyclePath, l = d) : e.category === C.NodeCycle ? p = this.params.createDetourPath : p = this.params.createLinePath;
|
|
1388
|
+
const w = p(
|
|
1362
1389
|
d,
|
|
1363
1390
|
c,
|
|
1364
1391
|
g,
|
|
@@ -1366,12 +1393,12 @@ class k {
|
|
|
1366
1393
|
h
|
|
1367
1394
|
);
|
|
1368
1395
|
this.line.setAttribute("d", w.path);
|
|
1369
|
-
let
|
|
1370
|
-
this.sourceArrow && (
|
|
1396
|
+
let m = null;
|
|
1397
|
+
this.sourceArrow && (m = this.arrowRenderer({
|
|
1371
1398
|
direction: d,
|
|
1372
|
-
shift:
|
|
1399
|
+
shift: u,
|
|
1373
1400
|
arrowLength: this.params.arrowLength
|
|
1374
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1401
|
+
}), this.sourceArrow.setAttribute("d", m));
|
|
1375
1402
|
let v = null;
|
|
1376
1403
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1377
1404
|
direction: l,
|
|
@@ -1379,33 +1406,33 @@ class k {
|
|
|
1379
1406
|
arrowLength: this.params.arrowLength
|
|
1380
1407
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1381
1408
|
edgePath: w,
|
|
1382
|
-
sourceArrowPath:
|
|
1409
|
+
sourceArrowPath: m,
|
|
1383
1410
|
targetArrowPath: v
|
|
1384
1411
|
});
|
|
1385
1412
|
}
|
|
1386
1413
|
}
|
|
1387
1414
|
const at = (r) => (e) => {
|
|
1388
1415
|
const s = [
|
|
1389
|
-
|
|
1416
|
+
u,
|
|
1390
1417
|
{ x: e.arrowLength, y: r.radius },
|
|
1391
1418
|
{ x: e.arrowLength, y: -r.radius }
|
|
1392
1419
|
].map(
|
|
1393
|
-
(h) =>
|
|
1420
|
+
(h) => y(h, e.direction, u)
|
|
1394
1421
|
).map((h) => ({
|
|
1395
1422
|
x: h.x + e.shift.x,
|
|
1396
1423
|
y: h.y + e.shift.y
|
|
1397
1424
|
})), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1398
1425
|
return `${i} ${n} ${a} Z`;
|
|
1399
1426
|
}, ht = (r) => (e) => {
|
|
1400
|
-
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [
|
|
1401
|
-
(
|
|
1402
|
-
).map((
|
|
1403
|
-
x:
|
|
1404
|
-
y:
|
|
1405
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`,
|
|
1406
|
-
return `${g} ${l} ${
|
|
1427
|
+
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [u, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1428
|
+
(m) => y(m, e.direction, u)
|
|
1429
|
+
).map((m) => ({
|
|
1430
|
+
x: m.x + e.shift.x,
|
|
1431
|
+
y: m.y + e.shift.y
|
|
1432
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, p = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1433
|
+
return `${g} ${l} ${p} ${w}`;
|
|
1407
1434
|
}, dt = (r) => (e) => {
|
|
1408
|
-
const t = r.smallRadius, s = r.radius, i =
|
|
1435
|
+
const t = r.smallRadius, s = r.radius, i = y(
|
|
1409
1436
|
{
|
|
1410
1437
|
x: e.arrowLength,
|
|
1411
1438
|
y: 0
|
|
@@ -1418,8 +1445,8 @@ const at = (r) => (e) => {
|
|
|
1418
1445
|
x: e.arrowLength + r.smallRadius,
|
|
1419
1446
|
y: 0
|
|
1420
1447
|
}
|
|
1421
|
-
), a = [
|
|
1422
|
-
(l) =>
|
|
1448
|
+
), a = [u, { x: i.x, y: -i.y }, i].map(
|
|
1449
|
+
(l) => y(l, e.direction, u)
|
|
1423
1450
|
).map((l) => ({
|
|
1424
1451
|
x: l.x + e.shift.x,
|
|
1425
1452
|
y: l.y + e.shift.y
|
|
@@ -1755,35 +1782,35 @@ class Me {
|
|
|
1755
1782
|
});
|
|
1756
1783
|
this.line.setAttribute("d", c.path);
|
|
1757
1784
|
let g = null, l = null;
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1785
|
+
const p = c.diagonalDistance;
|
|
1786
|
+
if (p === 0)
|
|
1760
1787
|
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1761
1788
|
else {
|
|
1762
1789
|
const w = {
|
|
1763
|
-
x: d.x /
|
|
1764
|
-
y: d.y /
|
|
1790
|
+
x: d.x / p,
|
|
1791
|
+
y: d.y / p
|
|
1765
1792
|
};
|
|
1766
1793
|
if (this.sourceArrow) {
|
|
1767
|
-
const
|
|
1794
|
+
const m = {
|
|
1768
1795
|
x: w.x * this.sourceOffset,
|
|
1769
1796
|
y: w.y * this.sourceOffset
|
|
1770
1797
|
};
|
|
1771
1798
|
g = this.arrowRenderer({
|
|
1772
1799
|
direction: w,
|
|
1773
|
-
shift:
|
|
1800
|
+
shift: m,
|
|
1774
1801
|
arrowLength: this.arrowLength
|
|
1775
1802
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1776
1803
|
}
|
|
1777
1804
|
if (this.targetArrow) {
|
|
1778
|
-
const
|
|
1805
|
+
const m = {
|
|
1779
1806
|
x: w.x * this.targetOffset,
|
|
1780
1807
|
y: w.y * this.targetOffset
|
|
1781
1808
|
};
|
|
1782
1809
|
l = this.arrowRenderer({
|
|
1783
1810
|
direction: { x: -w.x, y: -w.y },
|
|
1784
1811
|
shift: {
|
|
1785
|
-
x: d.x -
|
|
1786
|
-
y: d.y -
|
|
1812
|
+
x: d.x - m.x,
|
|
1813
|
+
y: d.y - m.y
|
|
1787
1814
|
},
|
|
1788
1815
|
arrowLength: this.arrowLength
|
|
1789
1816
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -1960,7 +1987,7 @@ class Ce {
|
|
|
1960
1987
|
}
|
|
1961
1988
|
}
|
|
1962
1989
|
const Ve = (r, e) => {
|
|
1963
|
-
const t = new Ee(), s = new Re(t), i = new Ce(e), n = new
|
|
1990
|
+
const t = new Ee(), s = new Re(t), i = new Ce(e), n = new ye(t, e, r), a = {
|
|
1964
1991
|
nodes: {
|
|
1965
1992
|
centerFn: Se,
|
|
1966
1993
|
priorityFn: () => 0
|
|
@@ -2125,7 +2152,7 @@ class Q {
|
|
|
2125
2152
|
const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
|
|
2126
2153
|
if (!this.params.nodeDragVerifier(s))
|
|
2127
2154
|
return;
|
|
2128
|
-
e.stopPropagation();
|
|
2155
|
+
this.params.onNodeDragStarted(s), e.stopPropagation();
|
|
2129
2156
|
const a = this.calculateContentPoint({
|
|
2130
2157
|
x: e.clientX,
|
|
2131
2158
|
y: e.clientY
|
|
@@ -2265,7 +2292,7 @@ class Q {
|
|
|
2265
2292
|
x: e.x - t.x,
|
|
2266
2293
|
y: e.y - t.y
|
|
2267
2294
|
}, i = this.canvas.viewport.getViewportMatrix();
|
|
2268
|
-
return
|
|
2295
|
+
return N(i, s);
|
|
2269
2296
|
}
|
|
2270
2297
|
adjustNodeCoords(e) {
|
|
2271
2298
|
const t = this.params.gridSize;
|
|
@@ -2279,11 +2306,11 @@ class Q {
|
|
|
2279
2306
|
return e;
|
|
2280
2307
|
}
|
|
2281
2308
|
}
|
|
2282
|
-
const
|
|
2309
|
+
const mt = (r, e, t) => ({
|
|
2283
2310
|
scale: r.scale,
|
|
2284
2311
|
x: r.x + r.scale * e,
|
|
2285
2312
|
y: r.y + r.scale * t
|
|
2286
|
-
}),
|
|
2313
|
+
}), yt = (r, e, t, s) => ({
|
|
2287
2314
|
scale: r.scale * e,
|
|
2288
2315
|
x: r.scale * (1 - e) * t + r.x,
|
|
2289
2316
|
y: r.scale * (1 - e) * s + r.y
|
|
@@ -2406,7 +2433,7 @@ class X {
|
|
|
2406
2433
|
new X(e, t, s, i);
|
|
2407
2434
|
}
|
|
2408
2435
|
moveViewport(e, t) {
|
|
2409
|
-
const s = this.viewport.getViewportMatrix(), i =
|
|
2436
|
+
const s = this.viewport.getViewportMatrix(), i = mt(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
|
|
2410
2437
|
prevTransform: s,
|
|
2411
2438
|
nextTransform: i,
|
|
2412
2439
|
canvasWidth: n,
|
|
@@ -2415,7 +2442,7 @@ class X {
|
|
|
2415
2442
|
this.performTransform(h);
|
|
2416
2443
|
}
|
|
2417
2444
|
scaleViewport(e, t, s) {
|
|
2418
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2445
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = yt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2419
2446
|
prevTransform: i,
|
|
2420
2447
|
nextTransform: n,
|
|
2421
2448
|
canvasWidth: a,
|
|
@@ -2622,27 +2649,27 @@ class ee {
|
|
|
2622
2649
|
grabPort(e, t, s) {
|
|
2623
2650
|
const i = this.canvas.graph.getPort(e);
|
|
2624
2651
|
this.staticPortId = e;
|
|
2625
|
-
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), g =
|
|
2652
|
+
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), g = N(c, {
|
|
2626
2653
|
x: a - d.x,
|
|
2627
2654
|
y: h - d.y
|
|
2628
|
-
}), l =
|
|
2655
|
+
}), l = N(c, {
|
|
2629
2656
|
x: t.x - d.x,
|
|
2630
2657
|
y: t.y - d.y
|
|
2631
|
-
}),
|
|
2632
|
-
overlayId:
|
|
2658
|
+
}), p = {
|
|
2659
|
+
overlayId: T.Static,
|
|
2633
2660
|
portCoords: g,
|
|
2634
2661
|
portDirection: i.direction
|
|
2635
2662
|
}, w = {
|
|
2636
|
-
overlayId:
|
|
2663
|
+
overlayId: T.Dragging,
|
|
2637
2664
|
portCoords: l,
|
|
2638
2665
|
portDirection: this.params.dragPortDirection
|
|
2639
2666
|
};
|
|
2640
2667
|
this.isTargetDragging = s === "direct";
|
|
2641
|
-
const [
|
|
2642
|
-
this.overlayCanvas.addNode(F(
|
|
2643
|
-
from:
|
|
2668
|
+
const [m, v] = this.isTargetDragging ? [p, w] : [w, p];
|
|
2669
|
+
this.overlayCanvas.addNode(F(m)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
|
|
2670
|
+
from: m.overlayId,
|
|
2644
2671
|
to: v.overlayId,
|
|
2645
|
-
shape: this.params.edgeShapeFactory(
|
|
2672
|
+
shape: this.params.edgeShapeFactory(T.Edge)
|
|
2646
2673
|
});
|
|
2647
2674
|
}
|
|
2648
2675
|
resetDragState() {
|
|
@@ -2664,8 +2691,8 @@ class ee {
|
|
|
2664
2691
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2665
2692
|
x: e.x - t.x,
|
|
2666
2693
|
y: e.y - t.y
|
|
2667
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2668
|
-
this.overlayCanvas.updateNode(
|
|
2694
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = N(i, s);
|
|
2695
|
+
this.overlayCanvas.updateNode(T.Dragging, {
|
|
2669
2696
|
x: n.x,
|
|
2670
2697
|
y: n.y
|
|
2671
2698
|
});
|
|
@@ -2724,10 +2751,10 @@ class te {
|
|
|
2724
2751
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2725
2752
|
x: g.x + g.width / 2,
|
|
2726
2753
|
y: g.y + g.height / 2
|
|
2727
|
-
},
|
|
2754
|
+
}, p = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), m = N(p, {
|
|
2728
2755
|
x: l.x - w.x,
|
|
2729
2756
|
y: l.y - w.y
|
|
2730
|
-
}), v =
|
|
2757
|
+
}), v = N(p, {
|
|
2731
2758
|
x: t.x - w.x,
|
|
2732
2759
|
y: t.y - w.y
|
|
2733
2760
|
});
|
|
@@ -2739,21 +2766,21 @@ class te {
|
|
|
2739
2766
|
priority: i.priority
|
|
2740
2767
|
}, this.canvas.removeEdge(s);
|
|
2741
2768
|
const E = {
|
|
2742
|
-
overlayId:
|
|
2743
|
-
portCoords:
|
|
2769
|
+
overlayId: T.Static,
|
|
2770
|
+
portCoords: m,
|
|
2744
2771
|
portDirection: c.direction
|
|
2745
2772
|
}, A = {
|
|
2746
|
-
overlayId:
|
|
2773
|
+
overlayId: T.Dragging,
|
|
2747
2774
|
portCoords: v,
|
|
2748
2775
|
portDirection: d.direction
|
|
2749
|
-
}, [
|
|
2750
|
-
this.overlayCanvas.addNode(F(
|
|
2751
|
-
const
|
|
2776
|
+
}, [D, b] = this.isTargetDragging ? [E, A] : [A, E];
|
|
2777
|
+
this.overlayCanvas.addNode(F(D)), this.overlayCanvas.addNode(F(b));
|
|
2778
|
+
const M = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.Edge) : i.shape;
|
|
2752
2779
|
return this.overlayCanvas.addEdge({
|
|
2753
|
-
id:
|
|
2754
|
-
from:
|
|
2755
|
-
to:
|
|
2756
|
-
shape:
|
|
2780
|
+
id: T.Edge,
|
|
2781
|
+
from: D.overlayId,
|
|
2782
|
+
to: b.overlayId,
|
|
2783
|
+
shape: M
|
|
2757
2784
|
}), !0;
|
|
2758
2785
|
}
|
|
2759
2786
|
resetDragState() {
|
|
@@ -2763,15 +2790,15 @@ class te {
|
|
|
2763
2790
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2764
2791
|
x: e.x - t.x,
|
|
2765
2792
|
y: e.y - t.y
|
|
2766
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2767
|
-
this.overlayCanvas.updateNode(
|
|
2793
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = N(i, s);
|
|
2794
|
+
this.overlayCanvas.updateNode(T.Dragging, {
|
|
2768
2795
|
x: n.x,
|
|
2769
2796
|
y: n.y
|
|
2770
2797
|
});
|
|
2771
2798
|
}
|
|
2772
2799
|
tryCreateConnection(e) {
|
|
2773
2800
|
const t = xe(this.canvas.graph, e);
|
|
2774
|
-
if (this.overlayCanvas.removeEdge(
|
|
2801
|
+
if (this.overlayCanvas.removeEdge(T.Edge), t === null) {
|
|
2775
2802
|
const d = this.draggingEdgePayload;
|
|
2776
2803
|
this.params.onEdgeReattachInterrupted({
|
|
2777
2804
|
id: d.id,
|
|
@@ -3028,20 +3055,22 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3028
3055
|
}
|
|
3029
3056
|
};
|
|
3030
3057
|
}, Mt = (r) => {
|
|
3031
|
-
var
|
|
3032
|
-
const e = ((
|
|
3033
|
-
}), t =
|
|
3034
|
-
}),
|
|
3058
|
+
var w, m, v, E, A, D;
|
|
3059
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3060
|
+
}), t = ((m = r.events) == null ? void 0 : m.onNodeDrag) ?? (() => {
|
|
3061
|
+
}), s = r.nodeDragVerifier ?? (() => !0), i = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3062
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (E = r.mouse) == null ? void 0 : E.dragCursor, d = h !== void 0 ? h : "grab", c = (A = r.mouse) == null ? void 0 : A.mouseDownEventVerifier, g = c !== void 0 ? c : (b) => b.button === 0, l = (D = r.mouse) == null ? void 0 : D.mouseUpEventVerifier, p = l !== void 0 ? l : (b) => b.button === 0;
|
|
3035
3063
|
return {
|
|
3036
|
-
moveOnTop:
|
|
3037
|
-
moveEdgesOnTop:
|
|
3038
|
-
dragCursor:
|
|
3064
|
+
moveOnTop: n,
|
|
3065
|
+
moveEdgesOnTop: a,
|
|
3066
|
+
dragCursor: d,
|
|
3039
3067
|
gridSize: r.gridSize ?? null,
|
|
3040
|
-
mouseDownEventVerifier:
|
|
3041
|
-
mouseUpEventVerifier:
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3068
|
+
mouseDownEventVerifier: g,
|
|
3069
|
+
mouseUpEventVerifier: p,
|
|
3070
|
+
onNodeDragStarted: e,
|
|
3071
|
+
onNodeDrag: t,
|
|
3072
|
+
nodeDragVerifier: s,
|
|
3073
|
+
onNodeDragFinished: i
|
|
3045
3074
|
};
|
|
3046
3075
|
}, Lt = (r) => {
|
|
3047
3076
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
@@ -3099,18 +3128,18 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3099
3128
|
maxY: r.maxY ?? 1 / 0
|
|
3100
3129
|
});
|
|
3101
3130
|
}
|
|
3102
|
-
},
|
|
3103
|
-
var
|
|
3104
|
-
const e = (
|
|
3131
|
+
}, me = (r) => {
|
|
3132
|
+
var m, v, E, A, D, b, M, $, ne, ae, he, de;
|
|
3133
|
+
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;
|
|
3105
3134
|
let i;
|
|
3106
3135
|
s !== void 0 ? Array.isArray(s) ? i = Ct(
|
|
3107
3136
|
s.map(
|
|
3108
|
-
(
|
|
3137
|
+
(L) => fe(L)
|
|
3109
3138
|
)
|
|
3110
|
-
) : i = fe(s) : i = (
|
|
3139
|
+
) : i = fe(s) : i = (L) => L.nextTransform;
|
|
3111
3140
|
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
3112
3141
|
}), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
3113
|
-
}), d = (
|
|
3142
|
+
}), d = (D = r == null ? void 0 : r.shift) == null ? void 0 : D.mouseDownEventVerifier, c = d !== void 0 ? d : (L) => L.button === 0, g = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, l = g !== void 0 ? g : (L) => L.button === 0, p = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, w = p !== void 0 ? p : () => !0;
|
|
3114
3143
|
return {
|
|
3115
3144
|
wheelSensitivity: t,
|
|
3116
3145
|
onTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onTransformStarted) ?? (() => {
|
|
@@ -3149,7 +3178,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3149
3178
|
};
|
|
3150
3179
|
}, Ut = (r, e, t) => {
|
|
3151
3180
|
var c, g, l;
|
|
3152
|
-
const s = () => "direct", i = (
|
|
3181
|
+
const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, a = () => {
|
|
3153
3182
|
}, h = () => {
|
|
3154
3183
|
}, d = () => {
|
|
3155
3184
|
};
|
|
@@ -3166,8 +3195,8 @@ const j = (r) => () => r, we = j(0), Tt = () => {
|
|
|
3166
3195
|
};
|
|
3167
3196
|
}, Bt = (r, e) => {
|
|
3168
3197
|
var c, g, l;
|
|
3169
|
-
const t = (
|
|
3170
|
-
const w = e.getPortAdjacentEdgeIds(
|
|
3198
|
+
const t = (p) => p, s = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
|
|
3199
|
+
const w = e.getPortAdjacentEdgeIds(p);
|
|
3171
3200
|
return w.length > 0 ? w[w.length - 1] : null;
|
|
3172
3201
|
}, a = () => {
|
|
3173
3202
|
}, h = () => {
|
|
@@ -3241,13 +3270,13 @@ class $e {
|
|
|
3241
3270
|
const c = s[d], g = i.getVector(h, c);
|
|
3242
3271
|
if (g.d > this.effectiveDistance)
|
|
3243
3272
|
continue;
|
|
3244
|
-
const l = this.k / g.d2,
|
|
3245
|
-
E.x -=
|
|
3273
|
+
const l = this.k / g.d2, p = l * g.ex, w = l * g.ey, m = p / 2, v = w / 2, E = t.get(h), A = t.get(c);
|
|
3274
|
+
E.x -= m, E.y -= v, A.x += m, A.y += v;
|
|
3246
3275
|
}
|
|
3247
3276
|
}
|
|
3248
3277
|
return this.graph.getAllEdgeIds().forEach((a) => {
|
|
3249
|
-
const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId),
|
|
3250
|
-
v.x += w, v.y +=
|
|
3278
|
+
const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), p = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * p, m = g.ey * p, v = t.get(d.nodeId), E = t.get(c.nodeId);
|
|
3279
|
+
v.x += w, v.y += m, E.x -= w, E.y -= m;
|
|
3251
3280
|
}), this.currentCoords.forEach((a, h) => {
|
|
3252
3281
|
const d = t.get(h), c = {
|
|
3253
3282
|
x: d.x / this.nodeMass * this.dtSec,
|
|
@@ -3382,7 +3411,9 @@ const Ue = (r) => {
|
|
|
3382
3411
|
applyOn: Ht(r == null ? void 0 : r.applyOn)
|
|
3383
3412
|
}), Kt = (r, e) => ({
|
|
3384
3413
|
...r,
|
|
3385
|
-
|
|
3414
|
+
onNodeDragStarted: (t) => {
|
|
3415
|
+
e.add(t), r.onNodeDragStarted(t);
|
|
3416
|
+
},
|
|
3386
3417
|
onNodeDragFinished: (t) => {
|
|
3387
3418
|
e.delete(t), r.onNodeDragFinished(t);
|
|
3388
3419
|
}
|
|
@@ -3403,8 +3434,8 @@ class qt {
|
|
|
3403
3434
|
o(this, "connectablePortsConfig", {});
|
|
3404
3435
|
o(this, "draggableEdgesConfig", {});
|
|
3405
3436
|
o(this, "virtualScrollConfig");
|
|
3406
|
-
o(this, "layoutConfig");
|
|
3407
|
-
o(this, "animatedLayoutConfig");
|
|
3437
|
+
o(this, "layoutConfig", {});
|
|
3438
|
+
o(this, "animatedLayoutConfig", {});
|
|
3408
3439
|
o(this, "hasDraggableNodes", !1);
|
|
3409
3440
|
o(this, "hasTransformableViewport", !1);
|
|
3410
3441
|
o(this, "hasNodeResizeReactiveEdges", !1);
|
|
@@ -3475,13 +3506,13 @@ class qt {
|
|
|
3475
3506
|
* enables nodes positioning with specified layout
|
|
3476
3507
|
*/
|
|
3477
3508
|
enableLayout(e) {
|
|
3478
|
-
return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
3509
|
+
return this.layoutConfig = e ?? {}, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
3479
3510
|
}
|
|
3480
3511
|
/**
|
|
3481
3512
|
* enables animated nodes positioning with specified layout
|
|
3482
3513
|
*/
|
|
3483
3514
|
enableAnimatedLayout(e) {
|
|
3484
|
-
return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
3515
|
+
return this.animatedLayoutConfig = e ?? {}, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
3485
3516
|
}
|
|
3486
3517
|
/**
|
|
3487
3518
|
* builds final canvas
|
|
@@ -3491,7 +3522,7 @@ class qt {
|
|
|
3491
3522
|
throw new Wt("CanvasBuilder is a single use object");
|
|
3492
3523
|
this.used = !0;
|
|
3493
3524
|
const e = new bt(this.element);
|
|
3494
|
-
let t = new
|
|
3525
|
+
let t = new ye(
|
|
3495
3526
|
this.graphStore,
|
|
3496
3527
|
this.viewportStore,
|
|
3497
3528
|
e.main
|
|
@@ -3557,14 +3588,14 @@ class qt {
|
|
|
3557
3588
|
i,
|
|
3558
3589
|
e.main,
|
|
3559
3590
|
this.window,
|
|
3560
|
-
|
|
3591
|
+
me(this.transformConfig),
|
|
3561
3592
|
this.boxRenderingTrigger,
|
|
3562
3593
|
Ft(this.virtualScrollConfig)
|
|
3563
3594
|
) : this.hasTransformableViewport && X.configure(
|
|
3564
3595
|
i,
|
|
3565
3596
|
e.main,
|
|
3566
3597
|
this.window,
|
|
3567
|
-
|
|
3598
|
+
me(this.transformConfig)
|
|
3568
3599
|
), this.hasLayout && xt.configure(
|
|
3569
3600
|
i,
|
|
3570
3601
|
Gt(this.layoutConfig)
|