Merging dev into main #49
@@ -11,16 +11,28 @@ import {
|
|||||||
useNodesState,
|
useNodesState,
|
||||||
useEdgesState,
|
useEdgesState,
|
||||||
reconnectEdge,
|
reconnectEdge,
|
||||||
addEdge, type Edge, type Connection,
|
addEdge,
|
||||||
|
MarkerType,
|
||||||
|
type Edge,
|
||||||
|
type Connection,
|
||||||
} from '@xyflow/react';
|
} from '@xyflow/react';
|
||||||
import '@xyflow/react/dist/style.css';
|
import '@xyflow/react/dist/style.css';
|
||||||
|
|
||||||
|
|
||||||
const initialNodes = [
|
const initialNodes = [
|
||||||
{id: 'n1', position: {x: 0, y: 0}, data: {label: 'Node 1'}},
|
{id: 'n1', position: {x: 0, y: 0}, data: {label: 'Start'}},
|
||||||
{id: 'n2', position: {x: 0, y: 100}, data: {label: 'Node 2'}},
|
{id: 'n2', position: {x: 0, y: 100}, data: {label: 'End'}},
|
||||||
];
|
];
|
||||||
const initialEdges = [{id: 'n1-n2', source: 'n1', target: 'n2'}];
|
const initialEdges = [{id: 'n1-n2', source: 'n1', target: 'n2'}];
|
||||||
|
|
||||||
|
const defaultEdgeOptions = {
|
||||||
|
type: 'floating',
|
||||||
|
markerEnd: {
|
||||||
|
type: MarkerType.ArrowClosed,
|
||||||
|
color: '#505050',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const VisualProgrammingUI = ()=> {
|
const VisualProgrammingUI = ()=> {
|
||||||
const edgeReconnectSuccessful = useRef(true);
|
const edgeReconnectSuccessful = useRef(true);
|
||||||
const [nodes, , onNodesChange] = useNodesState(initialNodes);
|
const [nodes, , onNodesChange] = useNodesState(initialNodes);
|
||||||
@@ -51,10 +63,11 @@ const VisualProgrammingUI = ()=> {
|
|||||||
}, [setEdges]);
|
}, [setEdges]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '90vw', height: '90vh' }}>
|
<div style={{outlineStyle: 'solid', borderRadius: '10pt' ,marginInline: 'auto',width: '60vw', height: '60vh' }}>
|
||||||
<ReactFlow
|
<ReactFlow
|
||||||
nodes={nodes}
|
nodes={nodes}
|
||||||
edges={edges}
|
edges={edges}
|
||||||
|
defaultEdgeOptions={defaultEdgeOptions}
|
||||||
onNodesChange={onNodesChange}
|
onNodesChange={onNodesChange}
|
||||||
onEdgesChange={onEdgesChange}
|
onEdgesChange={onEdgesChange}
|
||||||
snapToGrid
|
snapToGrid
|
||||||
@@ -63,7 +76,7 @@ const VisualProgrammingUI = ()=> {
|
|||||||
onReconnectEnd={onReconnectEnd}
|
onReconnectEnd={onReconnectEnd}
|
||||||
onConnect={onConnect}
|
onConnect={onConnect}
|
||||||
fitView
|
fitView
|
||||||
attributionPosition="top-right"
|
proOptions={{hideAttribution: true }}
|
||||||
>
|
>
|
||||||
<Controls />
|
<Controls />
|
||||||
<Background />
|
<Background />
|
||||||
|
|||||||
Reference in New Issue
Block a user