增加动画完成回调接口

This commit is contained in:
monitor1394
2020-07-17 12:19:21 +08:00
parent d9e8e2e26b
commit 4bb662043c
3 changed files with 24 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
# 更新日志
* (2020.07.17) Added animation completion callback interface for `SerieAnimation`.
* (2020.07.17) Optimize `Chart` under `ScrollView` without affecting the scrolling and dragging of `ScrollView`.
* (2020.07.16) Fixed a problem with `Tooltip` that would also show up if it was blocked on top. #74
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`#70

View File

@@ -1,6 +1,7 @@
# 更新日志
* (2020.07.17) 增加`SerieAnimation`动画完成回调接口
* (2020.07.17) 优化`Chart`放在`ScrollView`下时不影响`ScrollView`的滚动和拖动
* (2020.07.16) 修复`Tooltip`在上层有遮挡还会显示的问题#74
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`#70

View File

@@ -100,7 +100,14 @@ namespace XCharts
/// 数据变更的动画时长(毫秒)。
/// </summary>
public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } }
/// <summary>
/// 渐入动画完成回调
/// </summary>
public Action fadeInFinishCallback { get; set; }
/// <summary>
/// 渐出动画完成回调
/// </summary>
public Action fadeOutFinishCallback { get; set; }
private Dictionary<int, float> m_DataCurrProgress = new Dictionary<int, float>();
private Dictionary<int, float> m_DataDestProgress = new Dictionary<int, float>();
private bool m_FadeIn = false;
@@ -190,13 +197,26 @@ namespace XCharts
if (m_IsEnd) return;
m_ActualDuration = (int)((Time.time - startTime) * 1000) - (m_FadeOut ? fadeOutDelay : fadeInDelay);
m_CurrDataProgress = m_DestDataProgress + (m_FadeOut ? -1 : 1);
m_FadeIn = false;
m_IsEnd = true;
m_IsInit = false;
if (m_FadeIn)
{
m_FadeIn = false;
if (fadeInFinishCallback != null)
{
fadeInFinishCallback();
fadeInFinishCallback = null;
}
}
if (m_FadeOut)
{
m_FadeOut = false;
m_FadeOuted = true;
if (fadeOutFinishCallback != null)
{
fadeOutFinishCallback();
fadeOutFinishCallback = null;
}
}
}