From 58cbda29504eda3ec69724f20cd5297c87d8566e Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Mon, 15 Apr 2024 15:49:40 +0800 Subject: [PATCH] fix: workflow edge curvature (#3488) --- web/app/components/workflow/custom-connection-line.tsx | 5 +++-- web/app/components/workflow/custom-edge.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/custom-connection-line.tsx b/web/app/components/workflow/custom-connection-line.tsx index a411370b05f3fc..c187f16fe1899d 100644 --- a/web/app/components/workflow/custom-connection-line.tsx +++ b/web/app/components/workflow/custom-connection-line.tsx @@ -2,19 +2,20 @@ import { memo } from 'react' import type { ConnectionLineComponentProps } from 'reactflow' import { Position, - getSimpleBezierPath, + getBezierPath, } from 'reactflow' const CustomConnectionLine = ({ fromX, fromY, toX, toY }: ConnectionLineComponentProps) => { const [ edgePath, - ] = getSimpleBezierPath({ + ] = getBezierPath({ sourceX: fromX, sourceY: fromY, sourcePosition: Position.Right, targetX: toX, targetY: toY, targetPosition: Position.Left, + curvature: 0.16, }) return ( diff --git a/web/app/components/workflow/custom-edge.tsx b/web/app/components/workflow/custom-edge.tsx index 3575389c8e1c6f..072aad8d542570 100644 --- a/web/app/components/workflow/custom-edge.tsx +++ b/web/app/components/workflow/custom-edge.tsx @@ -9,7 +9,7 @@ import { BaseEdge, EdgeLabelRenderer, Position, - getSimpleBezierPath, + getBezierPath, } from 'reactflow' import { useNodesExtraData, @@ -38,13 +38,14 @@ const CustomEdge = ({ edgePath, labelX, labelY, - ] = getSimpleBezierPath({ + ] = getBezierPath({ sourceX: sourceX - 8, sourceY, sourcePosition: Position.Right, targetX: targetX + 8, targetY, targetPosition: Position.Left, + curvature: 0.16, }) const [open, setOpen] = useState(false) const { handleNodeAdd } = useNodesInteractions()