Skip to content

Commit

Permalink
fix: workflow edge curvature (#3488)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh authored Apr 15, 2024
1 parent d965b91 commit 58cbda2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions web/app/components/workflow/custom-connection-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 3 additions & 2 deletions web/app/components/workflow/custom-edge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
BaseEdge,
EdgeLabelRenderer,
Position,
getSimpleBezierPath,
getBezierPath,
} from 'reactflow'
import {
useNodesExtraData,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 58cbda2

Please sign in to comment.