-
Notifications
You must be signed in to change notification settings - Fork 1.5k
docs: 改造自定义交互的文档 #7033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: 改造自定义交互的文档 #7033
Conversation
TZZack
commented
Apr 15, 2025
- Fixed: [Docs]: 改造文档「交互 - 自定义交互」 #6914
6ab8070
to
be034d3
Compare
@@ -5,57 +5,119 @@ order: 3 | |||
|
|||
## 概述 | |||
|
|||
交互的执行逻辑通常为:1. 监听用户交互事件 2. 根据事件更新画布或执行其他操作。例如 `DragCanvas` 交互监听指针拖拽事件,根据拖拽的距离更新相机的位置。 | |||
自定义交互允许用户基于 G6 提供的完善的事件机制,把一个或多个相关的交互行为定义为一个完整的交互,以此实现符合业务场景的交互逻辑。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加一个跳转链接吧 [事件机制](/api/event)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
- 但基于可视化的概念区分,交互通常用于处理用户交互事件,而插件通常用于处理画布的渲染逻辑、额外组件渲染等 | ||
|
||
:::info{title=提示} | ||
因概念上的区分,交互实例不可获取,插件实例可获取( [getPluginInstance](/api/) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里也链到 /api/plugin#graphgetplugininstancekey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed(漏了,自检时没看到哈)
|
||
- `目的`:当用户在实现符合业务场景的交互逻辑时,我们通常需要配合 G6 的事件系统,对相关事件作出响应,执行需要的交互逻辑。 | ||
- `不使用自定义交互`:如果不使用自定义交互,用户需要在创建 Graph 实例后,通过 `graph.on` 进行一系列的事件监听和响应处理,代码逻辑处理和编排会显得异常艰难。 | ||
- `交互的优势`:每个交互行为都是独立的代码模块,交互系统的存在方便用户解耦业务逻辑、避免代码臃肿以及方便用户后续维护等。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里最好再加一个自定义交互的情况附带示例教程,当内置交互无法完全满足业务需求时,用户可以通过继承内置交互并进行调整和修改来自定义,比如说 #7032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be034d3
to
5f11568
Compare