重构消息通知弹窗
This commit is contained in:
parent
0c8d8f187c
commit
5e23c7b17f
@ -10,7 +10,8 @@ import {
|
|||||||
Connection,
|
Connection,
|
||||||
Edge,
|
Edge,
|
||||||
BackgroundVariant,
|
BackgroundVariant,
|
||||||
Panel
|
Panel,
|
||||||
|
reconnectEdge
|
||||||
} from '@xyflow/react';
|
} from '@xyflow/react';
|
||||||
import '@xyflow/react/dist/style.css';
|
import '@xyflow/react/dist/style.css';
|
||||||
|
|
||||||
@ -150,6 +151,11 @@ const FlowCanvas: React.FC<FlowCanvasProps> = ({
|
|||||||
});
|
});
|
||||||
}, [nodes, setEdges]);
|
}, [nodes, setEdges]);
|
||||||
|
|
||||||
|
// 处理边重连
|
||||||
|
const onReconnect = useCallback((oldEdge: Edge, newConnection: Connection) => {
|
||||||
|
setEdges((els) => reconnectEdge(oldEdge, newConnection, els));
|
||||||
|
}, [setEdges]);
|
||||||
|
|
||||||
// 处理连接
|
// 处理连接
|
||||||
const onConnect = useCallback(
|
const onConnect = useCallback(
|
||||||
(params: Connection | Edge) => {
|
(params: Connection | Edge) => {
|
||||||
@ -269,6 +275,7 @@ const FlowCanvas: React.FC<FlowCanvasProps> = ({
|
|||||||
onNodesChange={handleNodesChange}
|
onNodesChange={handleNodesChange}
|
||||||
onEdgesChange={handleEdgesChange}
|
onEdgesChange={handleEdgesChange}
|
||||||
onConnect={onConnect}
|
onConnect={onConnect}
|
||||||
|
onReconnect={onReconnect}
|
||||||
onNodeClick={onNodeClick}
|
onNodeClick={onNodeClick}
|
||||||
onEdgeClick={onEdgeClick}
|
onEdgeClick={onEdgeClick}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
@ -283,6 +290,8 @@ const FlowCanvas: React.FC<FlowCanvasProps> = ({
|
|||||||
style: { stroke: '#94a3b8', strokeWidth: 2 },
|
style: { stroke: '#94a3b8', strokeWidth: 2 },
|
||||||
markerEnd: { type: 'arrowclosed', color: '#94a3b8' },
|
markerEnd: { type: 'arrowclosed', color: '#94a3b8' },
|
||||||
}}
|
}}
|
||||||
|
edgesReconnectable={true}
|
||||||
|
reconnectRadius={20}
|
||||||
fitView
|
fitView
|
||||||
fitViewOptions={{
|
fitViewOptions={{
|
||||||
padding: 0.1,
|
padding: 0.1,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user