refactor(flowEditor): 优化流程线的绘制方式

master
钟良源 5 months ago
parent 75a2327985
commit 1c977cb4c2

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { BaseEdge, EdgeLabelRenderer, EdgeProps, getBezierPath, useReactFlow } from '@xyflow/react'; import { BaseEdge, EdgeLabelRenderer, EdgeProps, getSmoothStepPath, useReactFlow } from '@xyflow/react';
import EdgeAddNodeButton from './edgeAddNodeButton'; import EdgeAddNodeButton from '@/pages/flowEditor/components/edgeAddNodeButton';
const CustomEdge: React.FC<EdgeProps> = ({ const CustomEdge: React.FC<EdgeProps> = ({
id, id,
@ -14,14 +14,15 @@ const CustomEdge: React.FC<EdgeProps> = ({
markerEnd, markerEnd,
selected, selected,
data data
}) => { }) => {
const [edgePath, labelX, labelY, offsetX, offsetY] = getBezierPath({ const [edgePath, labelX, labelY] = getSmoothStepPath({
sourceX, sourceX,
sourceY, sourceY,
sourcePosition, sourcePosition,
targetX, targetX,
targetY, targetY,
targetPosition targetPosition,
borderRadius: 8, // 设置圆角半径
}); });
// 从数据中获取悬停状态 // 从数据中获取悬停状态

Loading…
Cancel
Save