diff --git a/packages/vstory-core/src/character/chart/character-chart.ts b/packages/vstory-core/src/character/chart/character-chart.ts index 0c2d9d0e..a14296ee 100644 --- a/packages/vstory-core/src/character/chart/character-chart.ts +++ b/packages/vstory-core/src/character/chart/character-chart.ts @@ -225,6 +225,7 @@ export class CharacterChart ticker: this._ticker, zIndex: this._config.zIndex ?? 0, vchartBoundsMode: this._config.options.initOption?.vchartBoundsMode ?? 'clip', + updateSpecMorphConfig: this._config.options.initOption?.updateSpecMorphConfig ?? {}, chartInitOptions: mergeChartOption( { performanceHook: { diff --git a/packages/vstory-core/src/character/chart/graphic/vchart-graphic.ts b/packages/vstory-core/src/character/chart/graphic/vchart-graphic.ts index 89a8316c..f1d89dff 100644 --- a/packages/vstory-core/src/character/chart/graphic/vchart-graphic.ts +++ b/packages/vstory-core/src/character/chart/graphic/vchart-graphic.ts @@ -6,6 +6,7 @@ import type { IAABBBounds, IBoundsLike } from '@visactor/vutils'; import { Bounds, pointInAABB, transformBoundsWithMatrix } from '@visactor/vutils'; import { mergeChartOption } from '../../../utils/chart'; import { isBoundsLikeEqual } from '../../../utils/equal'; +import type { IMorphConfig } from '@visactor/vchart-types/types/animation/spec'; export interface IChartGraphicAttribute { renderCanvas: HTMLCanvasElement; @@ -33,6 +34,7 @@ export interface IChartGraphicAttribute { zIndex?: number; panel?: Partial; vchartBoundsMode?: 'clip' | 'auto'; + updateSpecMorphConfig?: IMorphConfig; } export const CHART_NUMBER_TYPE = genNumberType(); @@ -189,7 +191,12 @@ export class VChartGraphic extends Rect { this.updateVChartGraphicViewBox(attrs.viewBox); } if (attrs.spec) { - this._vchart.updateSpecSync(attrs.spec, false, {}, { reMake: true, change: true }); + this._vchart.updateSpecSync( + attrs.spec, + false, + { ...(this.attribute.updateSpecMorphConfig ?? {}) }, + { reMake: true, change: true } + ); } } diff --git a/packages/vstory-core/src/interface/dsl/chart.ts b/packages/vstory-core/src/interface/dsl/chart.ts index 4e43675a..1206dc8c 100644 --- a/packages/vstory-core/src/interface/dsl/chart.ts +++ b/packages/vstory-core/src/interface/dsl/chart.ts @@ -2,6 +2,7 @@ import type { ITextGraphicAttribute } from '@visactor/vrender-core'; import type { ChartSpecMap, IInitOption, IMarkAreaSpec, IMarkLineSpec, IMarkPointSpec, ISpec } from '@visactor/vchart'; import type { ICharacterConfigBase } from './dsl'; import type { IFormatConfig } from './common'; +import type { IMorphConfig } from '@visactor/vchart-types/types/animation/spec'; export const StroyAllDataGroup = '_STORY_ALL_DATA_GROUP'; @@ -43,6 +44,10 @@ export interface IChartCharacterInitOption { vchartBoundsMode?: 'clip' | 'auto'; } +export interface IUpdateSpecMorphConfig { + updateSpecMorphConfig?: IMorphConfig; +} + // 模块选择器 // number => model.getSpecIndex(); 模块的 specIndex // * => chart.getAllModelInType(); 所有模块 @@ -80,7 +85,7 @@ export interface IChartCharacterConfig extends ICharacterConfigBase { /** * 初始化参数 */ - initOption?: IInitOption & IChartCharacterInitOption; + initOption?: IInitOption & IChartCharacterInitOption & IUpdateSpecMorphConfig; /** * 边距 */