Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions examples/feature-examples/src/pages/graph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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',
Expand Down Expand Up @@ -713,6 +737,20 @@ export default function BasicNode() {
>
开启边动画
</Button>
<Button
key="randomEdgeOffset"
type="primary"
onClick={handleRandomEdgeOffset}
>
随机修改折线边offset
</Button>
<Button
key="randomEdgeRadius"
type="primary"
onClick={handleRandomEdgeRadius}
>
随机修改折线边radius
</Button>
<Button
key="closeEdgeAnimation"
type="primary"
Expand Down
2 changes: 1 addition & 1 deletion examples/feature-examples/src/pages/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default function SelectionSelectExample() {
</Form.Item>
<Form.Item label="网格颜色">
<ColorPicker
value={'#ababab'}
value={'#D7DEEB'}
onChange={(color) => {
lfRef.current?.graphModel.updateGridOptions({
config: { color: color.toHexString() },
Expand Down
Loading