Skip to content

Commit 0c4a3b3

Browse files
committed
feat: add afterWordcloudShapeDraw hook
1 parent baa6ad9 commit 0c4a3b3

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/vchart-extension/src/charts/image-cloud/series/image-cloud.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ export class ImageCloudSeries<T extends IImageCloudSeriesSpec> extends BaseSerie
192192
if (maskImage && (this._spec.layoutConfig as GridLayoutConfig)?.placement === 'masked') {
193193
this._rootMark.getProduct().setAttribute('background', maskImage);
194194
}
195-
}).bind(this)
195+
}).bind(this),
196+
onLayoutFinished: () =>
197+
this._option.globalInstance
198+
.getChart()
199+
.getOption()
200+
.performanceHook?.afterWordcloudShapeDraw?.(this._option.globalInstance)
196201
};
197202
}
198203

packages/vchart/src/series/word-cloud/base.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ export class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordC
383383
}
384384
: this._maskShape,
385385
onUpdateMaskCanvas: this.handleMaskCanvasUpdate,
386+
onLayoutFinished: () =>
387+
this._option.globalInstance
388+
.getChart()
389+
.getOption()
390+
.performanceHook?.afterWordcloudShapeDraw?.(this._option.globalInstance),
386391
dataIndexKey: DEFAULT_DATA_KEY,
387392
text: wordSpec.formatMethod
388393
? (datum: Datum) => {

packages/vchart/src/typings/spec/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ export interface IPerformanceHook {
702702
// VRender Draw 时间
703703
beforeVRenderDraw?: (vchart?: IVChart) => void;
704704
afterVRenderDraw?: (vchart?: IVChart) => void;
705+
706+
// 词云
707+
afterWordcloudShapeDraw?: (vchart?: IVChart) => void;
705708
}
706709

707710
export type IBuildinMarkSpec = {

0 commit comments

Comments
 (0)