Skip to content
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

[4.0] event 问题 #249

Closed
hustcc opened this issue Oct 31, 2019 · 0 comments
Closed

[4.0] event 问题 #249

hustcc opened this issue Oct 31, 2019 · 0 comments
Assignees

Comments

@hustcc
Copy link
Member

hustcc commented Oct 31, 2019

问题

https://github.com/antvis/g/blob/859da22e08b54b338f8fefbc66254ce3a42e2c6f/packages/g-base/src/event/event-contoller.ts#L94

这个根据 name:event 创建新的事件名称后,这个名称没有存储到 Event 实例中。G2 封装事件的时候。

this.backgoundGroup.on('*', (e: Event) => {
  const { type } = e; // 这里的 type 丢失信息了
});

解法

  1. 上层不要用 * 通配符,进行事件 name:event 遍历,感觉不太合理
  2. 上层拿到 e 之后,根据 shape.get('name') + type 再做一遍生成事件名
  3. G.Event 中修改 type,或者增加一个额外的 type 存储
@antvis antvis deleted a comment from antv-bot Oct 31, 2019
dengfuping added a commit that referenced this issue Nov 13, 2019
@hustcc hustcc closed this as completed Nov 15, 2019
openwayne pushed a commit to openwayne/g that referenced this issue Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants