diff --git a/CHANGELOG-EN.md b/CHANGELOG-EN.md index 4b3ba41e..ee7a0ebc 100644 --- a/CHANGELOG-EN.md +++ b/CHANGELOG-EN.md @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index d91c6167..088aec15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Runtime/Component/Sub/SerieAnimation.cs b/Runtime/Component/Sub/SerieAnimation.cs index 150d6be9..d319fe3b 100644 --- a/Runtime/Component/Sub/SerieAnimation.cs +++ b/Runtime/Component/Sub/SerieAnimation.cs @@ -100,7 +100,14 @@ namespace XCharts /// 数据变更的动画时长(毫秒)。 /// public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } } - + /// + /// 渐入动画完成回调 + /// + public Action fadeInFinishCallback { get; set; } + /// + /// 渐出动画完成回调 + /// + public Action fadeOutFinishCallback { get; set; } private Dictionary m_DataCurrProgress = new Dictionary(); private Dictionary m_DataDestProgress = new Dictionary(); 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; + } } }