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

feat(event): label click event #6012

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Conversation

shield2018
Copy link
Contributor

@shield2018 shield2018 commented Jan 5, 2024

Checklist
  • npm test passes
  • benchmarks are included
  • commit message follows commit guidelines
  • documents are updated
Description of change

解决问题:

Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pearmini pearmini linked an issue Jan 5, 2024 that may be closed by this pull request
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前这样写没有问题,不过感觉下面的写法会更加清晰一点:

if (maybeElementRoot(target)) {
  //...
} else if (maybeComponentRoot(target)) {
  // ...
} else if (maybeLabelRoot(target)) {
  // ...
} else {
  emitter.emit(`${className}:${eventType}`, e1);
}

不用重复判断,或者增加一个元素需要多处修改。感兴趣可以下一个 PR 重构一下,如果觉得目前更好,也可以保持这样。

@pearmini pearmini merged commit fb0911c into antvis:v5 Jan 5, 2024
3 checks passed
@pearmini
Copy link
Member

pearmini commented Jan 5, 2024

感谢对 G2 对贡献,欢迎加入 G2 的开源先锋群:

1701856301808

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

Successfully merging this pull request may close these issues.

5.0 label无法监听事件
2 participants