@canmingir/link 1.2.17 → 1.2.18
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/package.json
CHANGED
|
@@ -18,6 +18,7 @@ const DynamicConnector = ({
|
|
|
18
18
|
animationSpeed = 1,
|
|
19
19
|
gradient = null,
|
|
20
20
|
curvature = 0.5,
|
|
21
|
+
connectorType = "curved",
|
|
21
22
|
}) => {
|
|
22
23
|
const uniqueId = useId();
|
|
23
24
|
const [dims, setDims] = useState(null);
|
|
@@ -91,6 +92,19 @@ const DynamicConnector = ({
|
|
|
91
92
|
);
|
|
92
93
|
|
|
93
94
|
const getPath = (from, to) => {
|
|
95
|
+
const isCornered =
|
|
96
|
+
connectorType === "cornered" || connectorType === "normal";
|
|
97
|
+
|
|
98
|
+
if (isCornered) {
|
|
99
|
+
if (isHorizontal) {
|
|
100
|
+
const midX = from.x + (to.x - from.x) / 2;
|
|
101
|
+
return `M ${from.x} ${from.y} L ${midX} ${from.y} L ${midX} ${to.y} L ${to.x} ${to.y}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const midY = from.y + (to.y - from.y) / 2;
|
|
105
|
+
return `M ${from.x} ${from.y} L ${from.x} ${midY} L ${to.x} ${midY} L ${to.x} ${to.y}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
94
108
|
const dx = Math.abs(to.x - from.x);
|
|
95
109
|
const dy = Math.abs(to.y - from.y);
|
|
96
110
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -56,6 +56,7 @@ const FlowNodeView = ({
|
|
|
56
56
|
animationSpeed = baseStyle.animationSpeed ?? 1,
|
|
57
57
|
gradient = baseStyle.gradient ?? null,
|
|
58
58
|
curvature = baseStyle.curvature ?? 0.5,
|
|
59
|
+
connectorType = baseStyle.connectorType ?? "curved",
|
|
59
60
|
selectionColor = baseStyle.selectionColor ?? "#64748b",
|
|
60
61
|
} = nodeStyle;
|
|
61
62
|
|
|
@@ -170,6 +171,7 @@ const FlowNodeView = ({
|
|
|
170
171
|
animationSpeed={animationSpeed}
|
|
171
172
|
gradient={gradient}
|
|
172
173
|
curvature={curvature}
|
|
174
|
+
connectorType={connectorType}
|
|
173
175
|
/>
|
|
174
176
|
|
|
175
177
|
<Box
|
package/src/lib/Flow/styles.js
CHANGED
|
@@ -25,6 +25,7 @@ export const getBaseStyleForVariant = (v) => {
|
|
|
25
25
|
animationSpeed: 1,
|
|
26
26
|
gradient: null,
|
|
27
27
|
curvature: 0.5,
|
|
28
|
+
connectorType: "curved",
|
|
28
29
|
};
|
|
29
30
|
case "pill":
|
|
30
31
|
return {
|
|
@@ -44,6 +45,7 @@ export const getBaseStyleForVariant = (v) => {
|
|
|
44
45
|
animationSpeed: 1,
|
|
45
46
|
gradient: null,
|
|
46
47
|
curvature: 0.4,
|
|
48
|
+
connectorType: "curved",
|
|
47
49
|
};
|
|
48
50
|
case "n8n":
|
|
49
51
|
return {
|
|
@@ -63,6 +65,7 @@ export const getBaseStyleForVariant = (v) => {
|
|
|
63
65
|
animationSpeed: 1,
|
|
64
66
|
gradient: null,
|
|
65
67
|
curvature: 0.5,
|
|
68
|
+
connectorType: "curved",
|
|
66
69
|
};
|
|
67
70
|
case "simple":
|
|
68
71
|
default:
|
|
@@ -83,6 +86,7 @@ export const getBaseStyleForVariant = (v) => {
|
|
|
83
86
|
animationSpeed: 1,
|
|
84
87
|
gradient: null,
|
|
85
88
|
curvature: 0.5,
|
|
89
|
+
connectorType: "curved",
|
|
86
90
|
};
|
|
87
91
|
}
|
|
88
92
|
};
|