You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2021/08/26 18:38:32 UTC

[echarts] 01/01: fix: add null condition.

This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 00437988c88e35afb07826dd0524e319f3438be7
Author: sushuang <su...@gmail.com>
AuthorDate: Thu Aug 26 12:41:10 2021 +0800

    fix: add null condition.
---
 src/animation/morphTransitionHelper.ts | 2 +-
 src/animation/universalTransition.ts   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/animation/morphTransitionHelper.ts b/src/animation/morphTransitionHelper.ts
index 1b6aad2..6caafe3 100644
--- a/src/animation/morphTransitionHelper.ts
+++ b/src/animation/morphTransitionHelper.ts
@@ -126,7 +126,7 @@ export function applyMorphAnimation(
     }
 
     const updateAnimationCfg = getAnimationConfig('update', seriesModel, dataIndex);
-    if (!(updateAnimationCfg.duration > 0)) {
+    if (!(updateAnimationCfg && updateAnimationCfg.duration > 0)) {
         return;
     }
     const animationDelay = (seriesModel.getModel('universalTransition') as Model<UniversalTransitionOption>)
diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts
index 9dc27e2..8678cfc 100644
--- a/src/animation/universalTransition.ts
+++ b/src/animation/universalTransition.ts
@@ -129,7 +129,7 @@ function stopAnimation(el: Element) {
 }
 function animateElementStyles(el: Element, dataIndex: number, seriesModel: SeriesModel) {
     const animationConfig = getAnimationConfig('update', seriesModel, dataIndex);
-    el.traverse(child => {
+    animationConfig && el.traverse(child => {
         if (child instanceof Displayable) {
             const oldStyle = getOldStyle(child);
             if (oldStyle) {
@@ -412,7 +412,7 @@ function transitionBetween(
             const seriesModel = data.hostModel as SeriesModel;
             const view = seriesModel && api.getViewOfSeriesModel(seriesModel as SeriesModel);
             const animationCfg = getAnimationConfig('update', seriesModel, 0);  // use 0 index.
-            if (view && seriesModel.isAnimationEnabled() && animationCfg.duration > 0) {
+            if (view && seriesModel.isAnimationEnabled() && animationCfg && animationCfg.duration > 0) {
                 view.group.traverse(el => {
                     if (el instanceof Path && !el.animators.length) {
                         // We can't accept there still exists element that has no animation

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org