mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
fix: workflow edge curvature (#3488)
This commit is contained in:
parent
d965b91b08
commit
58cbda2950
|
@ -2,19 +2,20 @@ import { memo } from 'react'
|
||||||
import type { ConnectionLineComponentProps } from 'reactflow'
|
import type { ConnectionLineComponentProps } from 'reactflow'
|
||||||
import {
|
import {
|
||||||
Position,
|
Position,
|
||||||
getSimpleBezierPath,
|
getBezierPath,
|
||||||
} from 'reactflow'
|
} from 'reactflow'
|
||||||
|
|
||||||
const CustomConnectionLine = ({ fromX, fromY, toX, toY }: ConnectionLineComponentProps) => {
|
const CustomConnectionLine = ({ fromX, fromY, toX, toY }: ConnectionLineComponentProps) => {
|
||||||
const [
|
const [
|
||||||
edgePath,
|
edgePath,
|
||||||
] = getSimpleBezierPath({
|
] = getBezierPath({
|
||||||
sourceX: fromX,
|
sourceX: fromX,
|
||||||
sourceY: fromY,
|
sourceY: fromY,
|
||||||
sourcePosition: Position.Right,
|
sourcePosition: Position.Right,
|
||||||
targetX: toX,
|
targetX: toX,
|
||||||
targetY: toY,
|
targetY: toY,
|
||||||
targetPosition: Position.Left,
|
targetPosition: Position.Left,
|
||||||
|
curvature: 0.16,
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
BaseEdge,
|
BaseEdge,
|
||||||
EdgeLabelRenderer,
|
EdgeLabelRenderer,
|
||||||
Position,
|
Position,
|
||||||
getSimpleBezierPath,
|
getBezierPath,
|
||||||
} from 'reactflow'
|
} from 'reactflow'
|
||||||
import {
|
import {
|
||||||
useNodesExtraData,
|
useNodesExtraData,
|
||||||
|
@ -38,13 +38,14 @@ const CustomEdge = ({
|
||||||
edgePath,
|
edgePath,
|
||||||
labelX,
|
labelX,
|
||||||
labelY,
|
labelY,
|
||||||
] = getSimpleBezierPath({
|
] = getBezierPath({
|
||||||
sourceX: sourceX - 8,
|
sourceX: sourceX - 8,
|
||||||
sourceY,
|
sourceY,
|
||||||
sourcePosition: Position.Right,
|
sourcePosition: Position.Right,
|
||||||
targetX: targetX + 8,
|
targetX: targetX + 8,
|
||||||
targetY,
|
targetY,
|
||||||
targetPosition: Position.Left,
|
targetPosition: Position.Left,
|
||||||
|
curvature: 0.16,
|
||||||
})
|
})
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const { handleNodeAdd } = useNodesInteractions()
|
const { handleNodeAdd } = useNodesInteractions()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user