-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: fix empty div container for annotation #3112
Conversation
😭 Deploy PR Preview d803fc1 failed. Build logs 🤖 By surge-preview |
Pull Request Test Coverage Report for Build 422209224
💛 - Coveralls |
所有的 annotation 应该要放到一个 div 里面吧,不然和 g2-tooltip 平级的会有很多 annotation 的 div 吧~ |
这个看你用了几个 html annotation,只有用到了才会渲染 |
比如有 4 个 annotation,应该层级也是 annotation 的容器中有 4 个子 div 吧,包括如果 html label,也是要放到一个统一的容器吧~不然太乱了。 |
This pull request fixes 1 alert when merging 12603d4 into 82a206f - view on LGTM.com fixed alerts:
|
可不可以保留部分之前的逻辑,但是在实际调用 html-annotation 的时候 再创建 div container,如果已有 直接放 annotation 进去,如果没有就直接创建;clear 的时候 也同步将这个容器删除 |
感觉没必要,维护这个层次只让代码复杂一点,本身好处是什么? |
ok,好像确实是增加代码复杂度了。还需要销毁,创建容器。 |
src/chart/controller/annotation.ts
Outdated
@@ -147,7 +144,7 @@ export default class Annotation extends Controller<BaseOption[]> { | |||
|
|||
this.foregroundContainer.remove(true); | |||
this.backgroundContainer.remove(true); | |||
this.clearHTMLContainer(true); | |||
// this.clearHTMLContainer(true); |
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.
这个注释可以删除了
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.
已删除~
This pull request fixes 1 alert when merging d803fc1 into 82a206f - view on LGTM.com fixed alerts:
|
Checklist
npm test
passesDescription of change
修复问题:#3108
之前添加一个 html container 是为了修复 html annotation 没有清除掉,这里可以像其他 controller 一样,clear 的时候直接清除创建的组件就可以。