修复笛卡尔坐标系开启动画时绘制异常的问题

This commit is contained in:
monitor1394
2019-09-02 09:46:44 +08:00
parent e5ce16e076
commit 8049d1141b
2 changed files with 16 additions and 22 deletions

View File

@@ -87,6 +87,7 @@ namespace XCharts
{
if (m_IsEnd) return;
m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay;
m_CurrDataProgress = m_DestDataProgress + 1;
m_IsEnd = true;
}
@@ -108,7 +109,7 @@ namespace XCharts
public void SetDataFinish(int dataIndex)
{
if (dataIndex < dataState.Count && !dataState[dataIndex])
if (!m_IsEnd && dataIndex < dataState.Count && !dataState[dataIndex])
{
dataState[dataIndex] = true;
m_CurrDataProgress = dataIndex + 1;
@@ -120,14 +121,7 @@ namespace XCharts
#if UNITY_EDITOR
if (!Application.isPlaying) return true;
#endif
return !enable || (m_CurrDataProgress>m_DestDataProgress && m_CurrDetailProgress > m_DestDetailProgress);
}
public bool IsFinishData(int dataIndex)
{
if (!m_Enable) return true;
if (dataIndex < dataState.Count) return dataState[dataIndex];
return true;
return !enable || (m_CurrDataProgress > m_DestDataProgress && m_CurrDetailProgress > m_DestDetailProgress);
}
public bool IsInDelay()

View File

@@ -392,7 +392,7 @@ namespace XCharts
bool isStart = false;
for (int i = 1; i < segment; i++)
{
var cp = lp + dist * i / segment * dir1;
var cp = lp + dir1 *(dist * i / segment);
if (serie.animation.CheckDetailBreak(cp, isYAxis)) isBreak = true;
var tp1 = cp - dir1v * serie.lineStyle.width;
var tp2 = cp + dir1v * serie.lineStyle.width;
@@ -402,7 +402,7 @@ namespace XCharts
{
if (!isStart)
{
if ((isYAxis && tp1.y > lastDnPos.y) || (!isYAxis && tp1.x > lastDnPos.x) || dataIndex == 1)
if ((isYAxis && tp1.y > lastDnPos.y) || (!isYAxis && tp1.x > lastDnPos.x) || dataIndex == 1 || IsValue())
{
isStart = true;
ChartHelper.DrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor);
@@ -421,7 +421,7 @@ namespace XCharts
}
else
{
if ((isYAxis && tp2.y < dnPos.y) || (!isYAxis && tp2.x < dnPos.x))
if ((isYAxis && tp2.y < dnPos.y) || (!isYAxis && tp2.x < dnPos.x) || IsValue())
{
ChartHelper.DrawLine(vh, start, cp, serie.lineStyle.width, lineColor);
}
@@ -437,13 +437,13 @@ namespace XCharts
if (isYAxis)
{
if (tp1.y > lastDnPos.y || dataIndex == 1) smoothPoints.Add(tp1);
if (tp2.y < dnPos.y) smoothDownPoints.Add(tp2);
if (tp1.y > lastDnPos.y || dataIndex == 1 || IsValue()) smoothPoints.Add(tp1);
if (tp2.y < dnPos.y|| IsValue()) smoothDownPoints.Add(tp2);
}
else
{
if (tp1.x > lastDnPos.x || dataIndex == 1) smoothPoints.Add(tp1);
if (tp2.x < dnPos.x || dataIndex == 1) smoothDownPoints.Add(tp2);
if (tp1.x > lastDnPos.x || dataIndex == 1|| IsValue()) smoothPoints.Add(tp1);
if (tp2.x < dnPos.x || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2);
}
}
else
@@ -452,7 +452,7 @@ namespace XCharts
{
if (!isStart)
{
if ((isYAxis && tp2.y > lastDnPos.y) || (!isYAxis && tp2.x > lastDnPos.x) || dataIndex == 1)
if ((isYAxis && tp2.y > lastDnPos.y) || (!isYAxis && tp2.x > lastDnPos.x) || dataIndex == 1|| IsValue())
{
isStart = true;
ChartHelper.DrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor);
@@ -471,7 +471,7 @@ namespace XCharts
}
else
{
if ((isYAxis && tp1.y < dnPos.y) || (!isYAxis && tp1.x < dnPos.x))
if ((isYAxis && tp1.y < dnPos.y) || (!isYAxis && tp1.x < dnPos.x)|| IsValue())
ChartHelper.DrawLine(vh, start, cp, serie.lineStyle.width, lineColor);
else
{
@@ -485,13 +485,13 @@ namespace XCharts
if (isYAxis)
{
if (tp1.y < dnPos.y) smoothPoints.Add(tp1);
if (tp2.y > lastDnPos.y || dataIndex == 1) smoothDownPoints.Add(tp2);
if (tp1.y < dnPos.y|| IsValue()) smoothPoints.Add(tp1);
if (tp2.y > lastDnPos.y || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2);
}
else
{
if (tp1.x < dnPos.x) smoothPoints.Add(tp1);
if (tp2.x > lastDnPos.x || dataIndex == 1) smoothDownPoints.Add(tp2);
if (tp1.x < dnPos.x|| IsValue()) smoothPoints.Add(tp1);
if (tp2.x > lastDnPos.x || dataIndex == 1|| IsValue()) smoothDownPoints.Add(tp2);
}
}
start = cp;