优化DataZoom开启时的新增动画表现

This commit is contained in:
monitor1394
2023-08-24 08:13:42 +08:00
parent 6d04cac38b
commit 267cb7472c
2 changed files with 13 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ namespace XCharts.Runtime
public float sizeProgress; public float sizeProgress;
public int currPointIndex; public int currPointIndex;
public int destPointIndex; public int destPointIndex;
public Vector3 currPoint;
public Vector3 destPoint;
public Dictionary<int, float> dataCurrProgress = new Dictionary<int, float>(); public Dictionary<int, float> dataCurrProgress = new Dictionary<int, float>();
public Dictionary<int, float> dataDestProgress = new Dictionary<int, float>(); public Dictionary<int, float> dataDestProgress = new Dictionary<int, float>();
} }

View File

@@ -284,7 +284,11 @@ namespace XCharts.Runtime
{ {
if (paths.Count < 1) return; if (paths.Count < 1) return;
var anim = activedAnimation; var anim = activedAnimation;
if (anim == null) return; if (anim == null)
{
m_Addition.context.currPointIndex = paths.Count - 1;
return;
}
var isAddedAnim = anim is AnimationAddition; var isAddedAnim = anim is AnimationAddition;
var startIndex = 0; var startIndex = 0;
if (isAddedAnim) if (isAddedAnim)
@@ -300,6 +304,12 @@ namespace XCharts.Runtime
} }
var sp = paths[startIndex]; var sp = paths[startIndex];
var ep = paths[paths.Count - 1]; 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 currDetailProgress = isY ? sp.y : sp.x;
var totalDetailProgress = isY ? ep.y : ep.x; var totalDetailProgress = isY ? ep.y : ep.x;
if (context.type == AnimationType.AlongPath) if (context.type == AnimationType.AlongPath)