8000 fix: fix animation of liquid group by xile611 · Pull Request #4023 · VisActor/VChart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: fix animation of liquid group #4023

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

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions packages/vchart/src/animation/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export interface CommonAnimationConfigItem {
options?: GraphicFunctionValueType<any>;
/** 动画执行相关控制配置项 */
controlOptions?: IAnimationControlOptions;
/** 该动画是否需要忽略子图元 */
selfOnly?: boolean;
}

export interface TypeAnimationConfig extends CommonAnimationConfigItem {
Expand Down
37 changes: 24 additions & 13 deletions packages/vchart/src/mark/base/base-mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,36 @@ export class BaseMark<T extends ICommonSpec> extends GrammarItem implements IMar
return this._animationConfig;
}
setAnimationConfig(config: Partial<MarkAnimationSpec>) {
// group mark 动画默认只挂到自己
const defaultPrams = this.type === 'group' ? { selfOnly: true } : {};

// 封装options,批量添加一些默认参数
const animationConfig = { ...config };
Object.keys(animationConfig).forEach(key => {
const value = (animationConfig as any)[key];
const animationConfig: Partial<MarkAnimationSpec> = {};

Object.keys(config).forEach(key => {
const value = (config as any)[key];
if (isArray(value)) {
value.forEach(item => {
(animationConfig as any)[key] = value.map(item => {
const options = item!.options ?? {};
item.options = (...args: any[]) => {
const _options = typeof options === 'function' ? options(...args) : options;
return {
..._options,
layoutRect: (this.model as any).getLayoutRect?.()
};

return {
...defaultPrams,
...item,
options: (...args: any[]) => {
const _options = typeof options === 'function' ? options(...args) : options;
return {
..._options,
layoutRect: (this.model as any).getLayoutRect?.()
};
}
};
});
} else {
(animationConfig as any)[key] = {
...defaultPrams,
...(config as any)[key]
};
}
// if (isNil(animationConfig[key])) {
// animationConfig[key] = {};
// }
});
this._animationConfig = animationConfig;
}
Expand Down
Loading
0