You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/06/11 08:12:22 UTC

[echarts] branch enhance-morph updated: fix(ut): fix stopAnimation is aborted in group traverse

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

shenyi pushed a commit to branch enhance-morph
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/enhance-morph by this push:
     new 262a96c  fix(ut): fix stopAnimation is aborted in group traverse
262a96c is described below

commit 262a96c7b21ea25cbf44009173166e939a1d92af
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Jun 11 16:11:20 2021 +0800

    fix(ut): fix stopAnimation is aborted in group traverse
---
 src/animation/morphTransitionHelper.ts |  2 +-
 src/animation/universalTransition.ts   |  4 ++-
 src/chart/bar/PictorialBarView.ts      |  3 ++-
 test/universalTransition.html          | 47 +++++++++++++++++++---------------
 4 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/src/animation/morphTransitionHelper.ts b/src/animation/morphTransitionHelper.ts
index cdf657c..cebf550 100644
--- a/src/animation/morphTransitionHelper.ts
+++ b/src/animation/morphTransitionHelper.ts
@@ -205,7 +205,7 @@ export function getPathList(
     const pathList: DescendentPaths = [];
 
     elements.traverse(el => {
-        if ((el instanceof Path) && !(el as ECElement).disableMorphing) {
+        if ((el instanceof Path) && !(el as ECElement).disableMorphing && !el.invisible && !el.ignore) {
             pathList.push(el);
         }
     });
diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts
index 602c8a0..e3ea4d5 100644
--- a/src/animation/universalTransition.ts
+++ b/src/animation/universalTransition.ts
@@ -46,7 +46,9 @@ export function transitionBetweenSeries(
         // Force finish the leave animation.
         el.stopAnimation();
         if (el.isGroup) {
-            el.traverse(child => child.stopAnimation());
+            el.traverse(child => {
+                child.stopAnimation();
+            });
         }
     }
 
diff --git a/src/chart/bar/PictorialBarView.ts b/src/chart/bar/PictorialBarView.ts
index 57b8c79..79d4974 100644
--- a/src/chart/bar/PictorialBarView.ts
+++ b/src/chart/bar/PictorialBarView.ts
@@ -30,7 +30,7 @@ import ExtensionAPI from '../../core/ExtensionAPI';
 import List from '../../data/List';
 import GlobalModel from '../../model/Global';
 import Model from '../../model/Model';
-import { ColorString, AnimationOptionMixin } from '../../util/types';
+import { ColorString, AnimationOptionMixin, ECElement } from '../../util/types';
 import type Cartesian2D from '../../coord/cartesian/Cartesian2D';
 import type Displayable from 'zrender/src/graphic/Displayable';
 import type Axis2D from '../../coord/cartesian/Axis2D';
@@ -689,6 +689,7 @@ function createOrUpdateBarRect(
                 lineWidth: 0
             }
         });
+        (barRect as ECElement).disableMorphing = true;
 
         bar.add(barRect);
     }
diff --git a/test/universalTransition.html b/test/universalTransition.html
index 9478235..71611e6 100644
--- a/test/universalTransition.html
+++ b/test/universalTransition.html
@@ -88,7 +88,7 @@ under the License.
 
             var chart = testHelper.create(echarts, 'main0', {
                 title: [
-                    'Convert between pie, bar, scatter, line'
+                    'Convert between pie, bar, scatter, line, funnel'
                 ],
                 // height: 300,
                 buttons: [{
@@ -98,25 +98,8 @@ under the License.
                             title: {
                                 text: 'Bar'
                             },
-                            dataset: [{
-                                dimensions: ['name', 'age', 'profession', 'score', 'date'],
-                                source: [
-                                    ['Hannah Krause ', 41, 'Engineer', 314, '2011-02-12'],
-                                    ['Zhao Qian ', 20, 'Teacher', 351, '2011-03-01'],
-                                    ['Jasmin Krause ', 52, 'Musician', 287, '2011-02-14'],
-                                    ['Li Lei', 37, 'Teacher', 219, '2011-02-18'],
-                                    ['Karle Neumann ', 25, 'Engineer', 253, '2011-04-02'],
-                                    ['Adrian Groß', 19, 'Teacher', null, '2011-01-16'],
-                                    ['Mia Neumann', 71, 'Engineer', 165, '2011-03-19'],
-                                    ['Böhm Fuchs', 36, 'Musician', 318, '2011-02-24'],
-                                    ['Han Meimei ', 67, 'Engineer', 366, '2011-03-12'],
-                                ]
-                            }, {
-                                transform: {
-                                    type: 'sort',
-                                    config: { dimension: 'score', order: 'desc' }
-                                }
-                            }],
+                            xAxis: { show: false },
+                            yAxis: { show: false },
                             series: {
                                 id: 'main',
                                 type: 'pie',
@@ -133,6 +116,8 @@ under the License.
                     onclick: function () {
                         chart.setOption({
                             title: { text: 'Scatter' },
+                            xAxis: { show: true },
+                            yAxis: { show: true },
                             series: {
                                 id: 'main',
                                 type: 'scatter',
@@ -150,6 +135,8 @@ under the License.
                     onclick: function () {
                         chart.setOption({
                             title: { text: 'Bar' },
+                            xAxis: { show: true },
+                            yAxis: { show: true },
                             series: {
                                 type: 'bar',
                                 id: 'main',
@@ -161,6 +148,24 @@ under the License.
                             }
                         });
                     }
+                }, {
+                    text: 'Funnel',
+                    onclick: function () {
+                        chart.setOption({
+                            title: { text: 'Funnel' },
+                            xAxis: { show: false },
+                            yAxis: { show: false },
+                            series: {
+                                id: 'main',
+                                type: 'funnel',
+                                encode: { x: 'name', y: 'score', itemName: 'name' },
+                                datasetIndex: 1,
+                                universalAnimation: {
+                                    enabled: true
+                                }
+                            }
+                        });
+                    }
                 }],
                 option: option
             });
@@ -446,7 +451,7 @@ under the License.
                                 axisTick: {show: false},
                                 axisLine: {show: false}
                             },
-                            // animationDurationUpdate: 1000,
+                            // animationDurationUpdate: 10000,
                             series: [{
                                 name: '2015',
                                 id: 'bar1',

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