-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0893f59
commit 5f9eabf
Showing
7 changed files
with
88 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useEffect } from 'react'; | ||
import Graphin, { Utils, Behaviors, GraphinContext } from '@antv/graphin'; | ||
|
||
const { ZoomCanvas } = Behaviors; | ||
|
||
const EventCenter = () => { | ||
const { graph } = React.useContext(GraphinContext); | ||
useEffect(() => { | ||
graph.on('node:mouseenter', evt => { | ||
graph.setItemState(evt.item, 'hover', true); | ||
}); | ||
|
||
graph.on('node:mouseleave', evt => { | ||
graph.setItemState(evt.item, 'hover', false); | ||
}); | ||
|
||
graph.on('edge:mouseenter', evt => { | ||
graph.setItemState(evt.item, 'selected', true); | ||
}); | ||
|
||
graph.on('edge:mouseleave', evt => { | ||
graph.setItemState(evt.item, 'selected', false); | ||
}); | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
const data = Utils.mock(10) | ||
.circle() | ||
.graphin(); | ||
const layout = { | ||
type: 'circular', | ||
}; | ||
|
||
const defaultEdge = { | ||
style: { | ||
stroke: '#000', | ||
}, | ||
status: { | ||
selected: { | ||
stroke: 'red', | ||
animation: { | ||
repeat: true, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default () => { | ||
return ( | ||
<div> | ||
<Graphin data={data} layout={layout} defaultEdge={defaultEdge}> | ||
<ZoomCanvas /> | ||
<EventCenter /> | ||
</Graphin> | ||
</div> | ||
); | ||
}; |
121 changes: 0 additions & 121 deletions
121
packages/graphin/docs/render/element/demos/graphin-circle.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: 内置边 | ||
group: | ||
path: /render | ||
nav: | ||
title: Graphin | ||
path: /graphin | ||
order: 1 | ||
--- | ||
|
||
## 基本介绍 | ||
|
||
<code src='./demos/edge.tsx'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: 节点元素 | ||
group: | ||
path: /render | ||
nav: | ||
title: Graphin | ||
path: /graphin | ||
order: 1 | ||
--- | ||
|
||
## 基本介绍 | ||
|
||
<code src='./demos/node.tsx'> |