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/15 14:47:18 UTC

[echarts] 02/02: feat(ut): bake transform before old element is removed.

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

commit 1800eb252111d175e088a0b618373c293ddedfc1
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Jun 15 22:44:15 2021 +0800

    feat(ut): bake transform before old element is removed.
---
 src/animation/universalTransition.ts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts
index f1acaa9..686569a 100644
--- a/src/animation/universalTransition.ts
+++ b/src/animation/universalTransition.ts
@@ -40,6 +40,10 @@ function transitionBetweenData(
         return;
     }
 
+    // const oldSeriesModel = oldData.hostModel;
+    // const isTransitionSameSeries = oldSeriesModel === seriesModel;
+
+
     function stopAnimation(pathList: Path[] | Path[][]) {
         if (isArray(pathList[0])) {
             for (let i = 0; i < pathList.length; i++) {
@@ -83,7 +87,13 @@ function transitionBetweenData(
     }
 
     function removeEl(el: Element) {
-        el.parent && el.parent.remove(el);
+        if (el.parent) {
+            // Bake parent transform to element.
+            // So it can still have proper transform to transition after it's removed.
+            const computedTransform = el.getComputedTransform();
+            el.setLocalTransform(computedTransform);
+            el.parent.remove(el);
+        }
     }
 
     // TODO share it to other modules. or put it in the List

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