Skip to content

Commit

Permalink
docs: update focusItem API doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyan-Wang committed Jun 10, 2020
1 parent b17c4c5 commit 807b60a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions docs/api/Graph.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ graph.zoomTo(3, { x: 100, y: 100 });
graph.zoomTo(0.5);
```

### focusItem(item, animate)
### focusItem(item, animate, animateCfg)

Move the graph to center at the item. This operation can be used as easing animation after searching a node.

Expand All @@ -1233,8 +1233,8 @@ Move the graph to center at the item. This operation can be used as easing anima
| Name | Type | Required | Description |
| ---- | --------------- | -------- | ----------------------------------- |
| item | string / Object | true | The id or the instance of the item. |
| animate | boolean | false | Whether move the graph with animation. |
| animateCfg | Object | false | The animation's configuraiton. Its configurations can be found in [Basic Animation Docs](/en/docs/manual/advanced/animation#animatecfg) |
| animate | boolean | false | Whether move the graph with animation. If it is not assigned, animates following the graph's `animate`. |
| animateCfg | Object | false | The animation's configuraiton. Its configurations can be found in [Basic Animation Docs](/en/docs/manual/advanced/animation#animatecfg). If it is not assigned, animates following the graph's `animateCfg`. |

**Usage**

Expand All @@ -1243,6 +1243,12 @@ graph.focusItem(item);

// focus with animation
graph.focusItem(item, true);

// focus with animation and animation's configuration
graph.focusItem(item, true, {
easing: 'easeCubic',
duration: 400
});
```

### changeSize(width, height)
Expand Down
12 changes: 9 additions & 3 deletions docs/api/Graph.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ graph.zoomTo(3, { x: 100, y: 100 });
graph.zoomTo(0.5);
```

### focusItem(item)
### focusItem(item, animate, animateCfg)

移动图,使得 item 对齐到视口中心,该方法可用于做搜索后的缓动动画。

Expand All @@ -1220,8 +1220,8 @@ graph.zoomTo(0.5);
| 名称 | 类型 | 是否必选 | 描述 |
| ---- | --------------- | -------- | ------------------ |
| item | string / Object | true | 元素 ID 或元素实例 |
| animate | boolean | false | 是否带有动画 |
| animateCfg | Object | false | 若带有动画,可配置动画,参见[基础动画教程](/zh/docs/manual/advanced/animation#animatecfg) |
| animate | boolean | false | 是否带有动画。若未配置,则跟随 graph 的 `animate` 参数 |
| animateCfg | Object | false | 若带有动画,可配置动画,参见[基础动画教程](/zh/docs/manual/advanced/animation#animatecfg)。若未配置,则跟随 graph 的 `animateCfg` 参数 |

**用法**

Expand All @@ -1230,6 +1230,12 @@ graph.focusItem(item);

// 动画地移动
graph.focusItem(item, true);

// 动画地移动,并配置动画
graph.focusItem(item, true, {
easing: 'easeCubic',
duration: 400
});
```

### changeSize(width, height)
Expand Down

0 comments on commit 807b60a

Please sign in to comment.