Skip to content

Commit

Permalink
fix(example): 修复rect节点中radius属性在properties中使用方式错误
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyang authored and boyongjiong committed Aug 27, 2024
1 parent df03e54 commit 966f590
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions examples/feature-examples/src/pages/graph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ const data = {
properties: {
width: 80,
height: 120,
style: {
radius: 20,
},
radius: 20,
},
},
{
Expand Down Expand Up @@ -393,6 +391,21 @@ export default function BasicNode() {
lfRef?.current?.dnd.startDrag(node)
}

const changeNodeBorderColor = () => {
const lf = lfRef.current
if (lf) {
const { nodes } = lf.getSelectElements()
nodes.forEach(({ id, properties }) => {
console.log('properties', properties)
lf.setProperties(id, {
style: {
stroke: 'pink',
},
})
})
}
}

return (
<Card title="Graph">
<Flex wrap="wrap" gap="small">
Expand Down Expand Up @@ -445,6 +458,13 @@ export default function BasicNode() {
<Button key="changeEdgeId" type="primary" onClick={handleChangeColor}>
修改边 颜色
</Button>
<Button
key="changeNodeBorderColor"
type="primary"
onClick={changeNodeBorderColor}
>
修改选中节点边框颜色
</Button>
</Flex>
<Divider orientation="left" orientationMargin="5" plain></Divider>
<Flex wrap="wrap" gap="small">
Expand Down

0 comments on commit 966f590

Please sign in to comment.