feat(edgeUpdate): add onEdgeUpdateStart handler closes #1120

This commit is contained in:
moklick
2021-04-30 16:09:46 +02:00
parent b2213bd9b5
commit 3232a33e9e
6 changed files with 21 additions and 2 deletions
+9 -1
View File
@@ -49,6 +49,7 @@ const initialElements: Elements = [
];
const onLoad = (reactFlowInstance: OnLoadParams) => reactFlowInstance.fitView();
const onEdgeUpdateStart = (_: React.MouseEvent, edge: Edge) => console.log('start update', edge);
const UpdatableEdge = () => {
const [elements, setElements] = useState<Elements>(initialElements);
@@ -57,7 +58,14 @@ const UpdatableEdge = () => {
const onConnect = (params: Connection | Edge) => setElements((els) => addEdge(params, els));
return (
<ReactFlow elements={elements} onLoad={onLoad} snapToGrid={true} onEdgeUpdate={onEdgeUpdate} onConnect={onConnect}>
<ReactFlow
elements={elements}
onLoad={onLoad}
snapToGrid={true}
onEdgeUpdate={onEdgeUpdate}
onConnect={onConnect}
onEdgeUpdateStart={onEdgeUpdateStart}
>
<Controls />
</ReactFlow>
);