diff --git a/src/animation/customGraphicTransition.ts b/src/animation/customGraphicTransition.ts index a2bf490c51..d1a1946097 100644 --- a/src/animation/customGraphicTransition.ts +++ b/src/animation/customGraphicTransition.ts @@ -149,8 +149,25 @@ export function applyUpdateTransition( const propsToSet = {} as ElementProps; prepareTransformAllPropsFinal(el, elOption, propsToSet); - prepareShapeOrExtraAllPropsFinal('shape', elOption, propsToSet); - prepareShapeOrExtraAllPropsFinal('extra', elOption, propsToSet); + + if (el.type === 'compound') { + /** + * We cannot directly clone shape for compoundPath, + * because it makes the path to be an object instead of a Path instance, + * and thus missing `buildPath` method. + */ + const paths: Path[] = (el as Path).shape.paths; + const optionPaths = elOption.shape.paths as TransitionElementOption['shape']['paths']; + for (let i = 0; i < optionPaths.length; i++) { + const path = optionPaths[i]; + prepareShapeOrExtraAllPropsFinal('shape', path, paths[i]); + prepareShapeOrExtraAllPropsFinal('extra', path, paths[i]); + } + } + else { + prepareShapeOrExtraAllPropsFinal('shape', elOption, propsToSet); + prepareShapeOrExtraAllPropsFinal('extra', elOption, propsToSet); + } if (!isInit && hasAnimation) { prepareTransformTransitionFrom(el, elOption, transFromProps); diff --git a/src/chart/custom/CustomView.ts b/src/chart/custom/CustomView.ts index 2f02ddb328..792b153510 100644 --- a/src/chart/custom/CustomView.ts +++ b/src/chart/custom/CustomView.ts @@ -364,8 +364,14 @@ function createEl(elOption: CustomElementOption): Element { throwError(errMsg); } const paths = map(shape.paths as Path[], function (path) { + if (path.type === 'path') { + return createEl(path as unknown as CustomPathOption); + } const Clz = graphicUtil.getShapeClass(path.type); if (!Clz) { + if (typeof path.buildPath === 'function') { + return path; + } let errMsg = ''; if (__DEV__) { errMsg = 'graphic type "' + graphicType + '" can not be found.';