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

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

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

Loading…
Cancel
Save