Skip to content

Commit

Permalink
chore:adjust behaviors demos
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Feb 10, 2021
1 parent 7347d5a commit 6c2aa98
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 80 deletions.
1 change: 0 additions & 1 deletion packages/graphin/docs/behaviros/canvas.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ group:
title: 交互行为
order: 3
nav:
title: Graphin
path: /graphin
order: 1
---
Expand Down
15 changes: 8 additions & 7 deletions packages/graphin/docs/behaviros/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import React from 'react';
import Graphin, { Utils, Behaviors } from '@antv/graphin';
import Graphin, { Utils, Behaviors, GraphinContext } from '@antv/graphin';

const data = Utils.mock(10)
.circle()
.graphin();
const data = Utils.mock(100).random().graphin();
const layout = {
type: 'concentric',
type: 'graphin-force',
preset: {
type: 'concentric',
},
};

const { DragCanvas, ZoomCanvas, DragNode, ActivateRelations } = Behaviors;

export default () => {
return (
<div>
<Graphin data={data} layout={layout}>
<DragCanvas direction="x" />
<ZoomCanvas enableOptimize />
<DragNode />
<ActivateRelations />
<ActivateRelations trigger="click" />
</Graphin>
</div>
);
Expand Down
18 changes: 18 additions & 0 deletions packages/graphin/docs/behaviros/demos/custom.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import Graphin, { Utils, Behaviors } from '@antv/graphin';

const data = Utils.mock(5).circle().graphin();
const layout = {
type: 'concentric',
};

const { ZoomCanvas } = Behaviors;
export default () => {
return (
<div>
<Graphin data={data} layout={layout}>
<ZoomCanvas enableOptimize />
</Graphin>
</div>
);
};
Empty file.
24 changes: 20 additions & 4 deletions packages/graphin/docs/behaviros/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ group:
title: 交互行为
order: 3
nav:
title: Graphin
path: /graphin
order: 1
---
Expand All @@ -21,12 +20,29 @@ Graphin 中的交互行为都是可组合的,例如内置了 DragCavans,ZoomCa

![](https://gw.alipayobjects.com/mdn/rms_402c1a/afts/img/A*xpoaRpOGme4AAAAAAAAAAAAAARQnAQ)

## 在线示例
## 内置交互行为

### 通过组件的 Props,修改原先的交互设置
> Graphin 内置了 9 个交互行为,这些交互行为,我们认为是图分析产品基本的交互需求,因此选择内置
```jsx | pure
<>
{/* 拖拽画布 */}<DragCanvas />
{/* 缩放画布 */}<ZoomCanvas />
{/* 拖拽节点 */}<DragNode />
{/* 点击节点 */}<DragCombo />
{/* 点击节点 */}<ClickSelect />
{/* 圈选节点 */}<BrushSelect />
{/** resize 画布 */}<ResizeCanvas graphDOM={this.graphDOM as HTMLDivElement} />
{/** 节点悬停 **/}<Hoverable bindType="node" />
</>
```

<code src='./demo.tsx'>

## 可选交互行为

> Graphin 还提供了
### 通过 disabled 来禁用该交互行为

<code src='../render/data/Network.tsx'>
<!-- <code src='../render/data/Network.tsx'> -->
1 change: 0 additions & 1 deletion packages/graphin/docs/behaviros/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ group:
title: 交互行为
order: 3
nav:
title: Graphin
path: /graphin
order: 1
---
Expand Down
16 changes: 0 additions & 16 deletions packages/graphin/docs/events/index.md

This file was deleted.

37 changes: 0 additions & 37 deletions packages/graphin/docs/events/select/Select.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions packages/graphin/docs/events/select/index.md

This file was deleted.

0 comments on commit 6c2aa98

Please sign in to comment.