chore(examples): cleanup

This commit is contained in:
moklick
2022-01-28 13:26:23 +01:00
parent ee1a393dcb
commit 1e8d578bb1
+8 -7
View File
@@ -55,7 +55,7 @@ const initialNodes: Node[] = [
{ {
id: '4b2', id: '4b2',
data: { label: 'Node 4b2' }, data: { label: 'Node 4b2' },
position: { x: 100, y: 100 }, position: { x: 20, y: 100 },
className: 'light', className: 'light',
parentNode: '4b', parentNode: '4b',
}, },
@@ -113,15 +113,18 @@ const BasicFlow = () => {
const onConnect = useCallback((connection: Connection) => { const onConnect = useCallback((connection: Connection) => {
setEdges((eds) => addEdge(connection, eds)); setEdges((eds) => addEdge(connection, eds));
}, []); }, []);
const onInit = useCallback((reactFlowInstance: ReactFlowInstance) => setRfInstance(reactFlowInstance), []); const onInit = useCallback((reactFlowInstance: ReactFlowInstance) => setRfInstance(reactFlowInstance), []);
const updatePos = () => { const updatePos = () => {
setNodes((nds) => { setNodes((nds) => {
return nds.map((n) => { return nds.map((n) => {
n.position = { if (!n.parentNode) {
x: Math.random() * 400, n.position = {
y: Math.random() * 400, x: Math.random() * 400,
}; y: Math.random() * 400,
};
}
return n; return n;
}); });
@@ -149,8 +152,6 @@ const BasicFlow = () => {
}); });
}; };
console.log(nodes);
return ( return (
<ReactFlow <ReactFlow
nodes={nodes} nodes={nodes}