diff --git a/examples/feature-examples/src/pages/graph/index.tsx b/examples/feature-examples/src/pages/graph/index.tsx index 0bcf09562..6473d7f34 100644 --- a/examples/feature-examples/src/pages/graph/index.tsx +++ b/examples/feature-examples/src/pages/graph/index.tsx @@ -324,7 +324,19 @@ export default function BasicNode() { ;(window as any).lf = lf } }, []) - + const handleRandomEdgeOffset = () => { + if (lfRef.current) { + const { edges } = lfRef.current.getGraphData() as GraphData + forEach(edges, (edge) => { + if (edge.type !== 'polyline') return + const offset = Math.random() * 100 + console.log('handleRandomEdgeOffset offset', offset) + lfRef.current?.setProperties(edge.id, { + offset, + }) + }) + } + } const setArrow = (arrowName: string) => { const lf = lfRef.current if (lf) { @@ -337,7 +349,19 @@ export default function BasicNode() { }) } } - + const handleRandomEdgeRadius = () => { + if (lfRef.current) { + const { edges } = lfRef.current.getGraphData() as GraphData + forEach(edges, (edge) => { + if (edge.type !== 'polyline') return + const radius = Math.random() * 100 + console.log('handleRandomEdgeRadius radius', radius) + lfRef.current?.setProperties(edge.id, { + radius, + }) + }) + } + } const focusOn = () => { lfRef?.current?.focusOn({ id: 'custom-node-1', @@ -713,6 +737,20 @@ export default function BasicNode() { > 开启边动画 + +