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

fix(annotation): fix regionFilter not work on sub view #2531

Merged
merged 4 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(annotation): use getRootView
  • Loading branch information
lessmost committed Jun 2, 2020
commit f352ab5085c95a42f16b1607fe434c282235426c
4 changes: 2 additions & 2 deletions src/chart/controller/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class Annotation extends Controller<BaseOption[]> {

if (component.get('type') === 'regionFilter') {
// regionFilter 依赖绘制后的 Geometry Shapes
(this.ancestorView || this.view).once(VIEW_LIFE_CIRCLE.AFTER_RENDER, () => {
this.view.getRootView().once(VIEW_LIFE_CIRCLE.AFTER_RENDER, () => {
updateComponentFn(co);
});
} else {
Expand All @@ -94,7 +94,7 @@ export default class Annotation extends Controller<BaseOption[]> {
} else {
each(this.option, (option: BaseOption) => {
if (option.type === 'regionFilter') {
(this.ancestorView || this.view).once(VIEW_LIFE_CIRCLE.AFTER_RENDER, () => {
this.view.getRootView().once(VIEW_LIFE_CIRCLE.AFTER_RENDER, () => {
// regionFilter 依赖绘制后的 Geometry Shapes
createComponentFn(option);
});
Expand Down
8 changes: 0 additions & 8 deletions src/chart/controller/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@ export abstract class Controller<O = unknown> {
/** 是否可见 */
public visible: boolean = true;
protected view: View;
/** 如果是子 view,保存其根 view */
protected ancestorView: View;
/** option 配置,不同组件有自己不同的配置结构 */
protected option: O;
/** 所有的 component */
protected components: ComponentOption[] = [];

constructor(view: View) {
this.view = view;
if (view.parent) {
this.ancestorView = view.parent;
while (this.ancestorView.parent) {
this.ancestorView = this.ancestorView.parent;
}
}
}

public abstract get name(): string;
Expand Down