增加Animation在重新初始化数据时自启动功能

This commit is contained in:
monitor1394
2019-09-06 09:46:13 +08:00
parent d216079e78
commit 0f822b6848
5 changed files with 74 additions and 13 deletions

View File

@@ -54,6 +54,7 @@ namespace XCharts
[NonSerialized] private bool m_RefreshChart = false;
[NonSerialized] private bool m_RefreshLabel = false;
[NonSerialized] private bool m_ReinitLabel = false;
[NonSerialized] private bool m_CheckAnimation = false;
protected Vector2 chartAnchorMax { get { return rectTransform.anchorMax; } }
protected Vector2 chartAnchorMin { get { return rectTransform.anchorMin; } }
@@ -79,6 +80,7 @@ namespace XCharts
InitSerieLabel();
InitTooltip();
TransferOldVersionData();
m_Series.AnimationStop();
m_Series.AnimationStart();
}
@@ -96,6 +98,7 @@ namespace XCharts
CheckTooltip();
CheckRefreshChart();
CheckRefreshLabel();
CheckAnimation();
}
protected override void OnEnable()
@@ -315,7 +318,7 @@ namespace XCharts
var backgroundColor = serie.label.backgroundColor;
var labelObj = ChartHelper.AddSerieLabel(textName, labelObject.transform, m_ThemeInfo.font,
color, backgroundColor, serie.label.fontSize, serie.label.fontStyle, serie.label.rotate,
serie.label.backgroundWidth,serie.label.backgroundHeight);
serie.label.backgroundWidth, serie.label.backgroundHeight);
var isAutoSize = serie.label.backgroundWidth == 0 || serie.label.backgroundHeight == 0;
serieData.InitLabel(labelObj, isAutoSize, serie.label.paddingLeftRight, serie.label.paddingTopBottom);
serieData.SetLabelActive(false);
@@ -469,6 +472,15 @@ namespace XCharts
}
}
protected void CheckAnimation()
{
if (!m_CheckAnimation)
{
m_CheckAnimation = true;
m_Series.AnimationStart();
}
}
protected virtual void OnRefreshLabel()
{