From 6a5026e90751bed9e9b70044e212c3f33422ca99 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sun, 15 Oct 2023 21:04:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`Line`=E8=AE=BE=E7=BD=AE`Anim?= =?UTF-8?q?ation`=E4=B8=BA`AlongPath`=E6=97=B6=E5=8A=A8=E7=94=BB=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98=20(#281)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Component/Animation/AnimationStyle.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 2523d168..6440c8a8 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -69,6 +69,7 @@ slug: /changelog ## master +* (2023.10.15) 修复`Line`设置`Animation`为`AlongPath`时动画异常的问题 (#281) * (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题 * (2023.10.11) 修复`Serie`的`showDataDimension`设置无效的问题 diff --git a/Runtime/Component/Animation/AnimationStyle.cs b/Runtime/Component/Animation/AnimationStyle.cs index efcb75f8..7f29b9d5 100644 --- a/Runtime/Component/Animation/AnimationStyle.cs +++ b/Runtime/Component/Animation/AnimationStyle.cs @@ -304,12 +304,6 @@ namespace XCharts.Runtime } var sp = paths[startIndex]; var ep = paths[paths.Count - 1]; - if (sp == anim.context.currPoint && ep == anim.context.destPoint) - { - return; - } - anim.context.currPoint = sp; - anim.context.destPoint = ep; var currDetailProgress = isY ? sp.y : sp.x; var totalDetailProgress = isY ? ep.y : ep.x; if (context.type == AnimationType.AlongPath) @@ -328,6 +322,12 @@ namespace XCharts.Runtime m_LinePathLastPos = sp; context.currentPathDistance = 0; } + if (sp == anim.context.currPoint && ep == anim.context.destPoint) + { + return; + } + anim.context.currPoint = sp; + anim.context.destPoint = ep; anim.Init(currDetailProgress, totalDetailProgress, paths.Count - 1); }