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); }