mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 10:20:10 +00:00
修复Scatter散点图渐出动画异常的问题
This commit is contained in:
@@ -309,14 +309,20 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
internal float CheckItemProgress(int dataIndex, float destProgress, ref bool isEnd, float startProgress, bool m_UnscaledTime)
|
internal float CheckItemProgress(int dataIndex, float destProgress, ref bool isEnd, float startProgress, bool m_UnscaledTime)
|
||||||
{
|
{
|
||||||
|
if (m_Reverse)
|
||||||
|
{
|
||||||
|
var temp = startProgress;
|
||||||
|
startProgress = destProgress;
|
||||||
|
destProgress = temp;
|
||||||
|
}
|
||||||
var currHig = GetDataCurrProgress(dataIndex, startProgress, destProgress, ref isEnd);
|
var currHig = GetDataCurrProgress(dataIndex, startProgress, destProgress, ref isEnd);
|
||||||
if (IsFinish())
|
if (IsFinish())
|
||||||
{
|
{
|
||||||
return reverse ? startProgress : destProgress;
|
return destProgress;
|
||||||
}
|
}
|
||||||
else if (IsInDelay() || IsInIndexDelay(dataIndex))
|
else if (IsInDelay() || IsInIndexDelay(dataIndex))
|
||||||
{
|
{
|
||||||
return reverse ? destProgress : startProgress;
|
return startProgress;
|
||||||
}
|
}
|
||||||
else if (context.pause)
|
else if (context.pause)
|
||||||
{
|
{
|
||||||
@@ -326,7 +332,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
var duration = GetCurrAnimationDuration(dataIndex);
|
var duration = GetCurrAnimationDuration(dataIndex);
|
||||||
var delta = (destProgress - startProgress) / duration * (m_UnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime);
|
var delta = (destProgress - startProgress) / duration * (m_UnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime);
|
||||||
currHig = currHig + (reverse ? -delta : delta);
|
currHig += delta;
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
if ((destProgress > 0 && currHig <= 0) || (destProgress < 0 && currHig >= 0))
|
if ((destProgress > 0 && currHig <= 0) || (destProgress < 0 && currHig >= 0))
|
||||||
|
|||||||
@@ -350,13 +350,9 @@ namespace XCharts.Runtime
|
|||||||
#endif
|
#endif
|
||||||
if (!m_Enable)
|
if (!m_Enable)
|
||||||
return true;
|
return true;
|
||||||
foreach (var animation in animations)
|
var animation = activedAnimation;
|
||||||
{
|
if (animation != null && animation.context.end)
|
||||||
if (animation.context.start && animation.context.end)
|
return true;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (IsSerieAnimation())
|
if (IsSerieAnimation())
|
||||||
{
|
{
|
||||||
if (m_FadeOut.context.start) return m_FadeOut.context.currProgress <= m_FadeOut.context.destProgress;
|
if (m_FadeOut.context.start) return m_FadeOut.context.currProgress <= m_FadeOut.context.destProgress;
|
||||||
@@ -365,7 +361,8 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
else if (IsDataAnimation())
|
else if (IsDataAnimation())
|
||||||
{
|
{
|
||||||
return false;
|
if (animation == null) return true;
|
||||||
|
else return animation.context.end;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -462,7 +459,11 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
isEnd = false;
|
isEnd = false;
|
||||||
var anim = activedAnimation;
|
var anim = activedAnimation;
|
||||||
if (anim == null) return destProgress;
|
if (anim == null)
|
||||||
|
{
|
||||||
|
isEnd = true;
|
||||||
|
return destProgress;
|
||||||
|
}
|
||||||
return anim.CheckItemProgress(dataIndex, destProgress, ref isEnd, startProgress, m_UnscaledTime);
|
return anim.CheckItemProgress(dataIndex, destProgress, ref isEnd, startProgress, m_UnscaledTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ namespace XCharts.Runtime
|
|||||||
var rate = serie.animation.GetCurrRate();
|
var rate = serie.animation.GetCurrRate();
|
||||||
var dataChangeDuration = serie.animation.GetChangeDuration();
|
var dataChangeDuration = serie.animation.GetChangeDuration();
|
||||||
var interactDuration = serie.animation.GetInteractionDuration();
|
var interactDuration = serie.animation.GetInteractionDuration();
|
||||||
|
var isFadeOut = serie.animation.IsFadeOut();
|
||||||
var unscaledTime = serie.animation.unscaledTime;
|
var unscaledTime = serie.animation.unscaledTime;
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
var interacting = false;
|
var interacting = false;
|
||||||
@@ -157,8 +158,8 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
|
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
|
||||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, state);
|
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, state);
|
||||||
double xValue = serieData.GetCurrData(0, 0, dataChangeDuration, unscaledTime, xAxis.inverse);
|
double xValue = serieData.GetCurrData(0, 0, isFadeOut ? 0 : dataChangeDuration, unscaledTime, xAxis.inverse);
|
||||||
double yValue = serieData.GetCurrData(1, 0, dataChangeDuration, unscaledTime, yAxis.inverse);
|
double yValue = serieData.GetCurrData(1, 0, isFadeOut ? 0 : dataChangeDuration, unscaledTime, yAxis.inverse);
|
||||||
|
|
||||||
if (serieData.IsDataChanged())
|
if (serieData.IsDataChanged())
|
||||||
dataChanging = true;
|
dataChanging = true;
|
||||||
@@ -177,13 +178,15 @@ namespace XCharts.Runtime
|
|||||||
serieData.context.position = pos;
|
serieData.context.position = pos;
|
||||||
var datas = serieData.data;
|
var datas = serieData.data;
|
||||||
var symbolSize = 0f;
|
var symbolSize = 0f;
|
||||||
if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting, interactDuration))
|
if (isFadeOut || !serieData.interact.TryGetValue(ref symbolSize, ref interacting, interactDuration))
|
||||||
{
|
{
|
||||||
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme.serie.scatterSymbolSize, state);
|
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme.serie.scatterSymbolSize, state);
|
||||||
serieData.interact.SetValue(ref interacting, symbolSize, true);
|
if (!isFadeOut)
|
||||||
serieData.interact.TryGetValue(ref symbolSize, ref interacting, interactDuration);
|
{
|
||||||
|
serieData.interact.SetValue(ref interacting, symbolSize, true);
|
||||||
|
serieData.interact.TryGetValue(ref symbolSize, ref interacting, interactDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
symbolSize *= rate;
|
symbolSize *= rate;
|
||||||
|
|
||||||
if (isEffectScatter)
|
if (isEffectScatter)
|
||||||
|
|||||||
Reference in New Issue
Block a user