|
|
|
|
@ -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, // 设置圆角半径
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 从数据中获取悬停状态
|
|
|
|
|
|