You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "linghaoSu (via GitHub)" <gi...@apache.org> on 2023/06/25 15:58:52 UTC

[GitHub] [echarts] linghaoSu commented on a diff in pull request #18491: fix(tree): fix tree update error with animation and without animation

linghaoSu commented on code in PR #18491:
URL: https://github.com/apache/echarts/pull/18491#discussion_r1241227139


##########
src/chart/tree/TreeView.ts:
##########
@@ -603,28 +603,46 @@ function removeNodeEdge(
     data: SeriesData,
     group: graphic.Group,
     seriesModel: TreeSeriesModel,
-    removeAnimationOpt: AnimationOption
+    removeAnimationOpt: AnimationOption,
+    currentSymbol?: TreeSymbol,
+    sourceSymbol?: TreeSymbol
 ) {
     const virtualRoot = data.tree.root;
     const { source, sourceLayout } = getSourceNode(virtualRoot, node);
 
-    const symbolEl: TreeSymbol = data.getItemGraphicEl(node.dataIndex) as TreeSymbol;
+    // use the current symbol when the node is delete immediately
+    const symbolEl: TreeSymbol = data.getItemGraphicEl(node.dataIndex) as TreeSymbol ?? currentSymbol;
 
     if (!symbolEl) {
         return;
     }
 
-    const sourceSymbolEl = data.getItemGraphicEl(source.dataIndex) as TreeSymbol;
-    const sourceEdge = sourceSymbolEl.__edge;
+    // use the source symbol when the node is delete immediately
+    const sourceSymbolEl = data.getItemGraphicEl(source.dataIndex) as TreeSymbol ?? sourceSymbol;
+    const sourceEdge = sourceSymbolEl?.__edge;
+
+
+    const symbolChildren = source.children.map(
+        item => data.getItemGraphicEl(item.dataIndex)
+    ).filter(item => !!item);
+    const notLeaveChildren = symbolChildren.filter(
+        item => !item?.animators?.length || item?.animators?.find(animator => animator.scope !== 'leave')

Review Comment:
   fixed, use animationModel to check animation state



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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