mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 00:20:18 +00:00
增加Serie部分配置修改时的自刷新
This commit is contained in:
@@ -176,7 +176,7 @@ namespace XCharts.Runtime
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
foreach (var handler in m_SerieHandlers) handler.OnValidate();
|
||||
foreach (var handler in m_SerieHandlers) handler.ForceUpdateSerieContext();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1041,6 +1041,12 @@ namespace XCharts.Runtime
|
||||
titleDirty = true;
|
||||
}
|
||||
|
||||
public override void SetVerticesDirty()
|
||||
{
|
||||
base.SetVerticesDirty();
|
||||
handler.ForceUpdateSerieContext();
|
||||
}
|
||||
|
||||
private bool AnySerieDataVerticesDirty()
|
||||
{
|
||||
if (IsPerformanceMode())
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace XCharts.Runtime
|
||||
public virtual void OnBeginDrag(PointerEventData eventData) { }
|
||||
public virtual void OnEndDrag(PointerEventData eventData) { }
|
||||
public virtual void OnScroll(PointerEventData eventData) { }
|
||||
public virtual void OnValidate() { }
|
||||
public virtual void RefreshLabelNextFrame() { }
|
||||
public virtual void RefreshLabelInternal() { }
|
||||
public virtual void ForceUpdateSerieContext() { }
|
||||
public virtual void UpdateSerieContext() { }
|
||||
public virtual void UpdateTooltipSerieParams(int dataIndex, bool showCategory,
|
||||
string category, string marker,
|
||||
@@ -64,6 +64,9 @@ namespace XCharts.Runtime
|
||||
protected int m_LegendEnterIndex;
|
||||
protected ChartLabel m_EndLabel;
|
||||
|
||||
private float[] m_LastRadius = new float[2] { 0, 0 };
|
||||
private float[] m_LastCenter = new float[2] { 0, 0 };
|
||||
|
||||
public T serie { get; internal set; }
|
||||
public GameObject labelObject { get { return m_SerieLabelRoot; } }
|
||||
|
||||
@@ -75,13 +78,9 @@ namespace XCharts.Runtime
|
||||
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
||||
}
|
||||
|
||||
public override void OnValidate()
|
||||
{
|
||||
m_ForceUpdateSerieContext = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
CheckConfigurationChanged();
|
||||
if (m_NeedInitComponent)
|
||||
{
|
||||
m_NeedInitComponent = false;
|
||||
@@ -136,6 +135,27 @@ namespace XCharts.Runtime
|
||||
UpdateSerieContextInternal();
|
||||
}
|
||||
|
||||
public override void ForceUpdateSerieContext()
|
||||
{
|
||||
m_ForceUpdateSerieContext = true;
|
||||
}
|
||||
|
||||
private void CheckConfigurationChanged()
|
||||
{
|
||||
if (m_LastRadius[0] != serie.radius[0] || m_LastRadius[1] != serie.radius[1])
|
||||
{
|
||||
m_LastRadius[0] = serie.radius[0];
|
||||
m_LastRadius[1] = serie.radius[1];
|
||||
serie.SetVerticesDirty();
|
||||
}
|
||||
if (m_LastCenter[0] != serie.center[0] || m_LastCenter[1] != serie.center[1])
|
||||
{
|
||||
m_LastCenter[0] = serie.center[0];
|
||||
m_LastCenter[1] = serie.center[1];
|
||||
serie.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSerieContextInternal()
|
||||
{
|
||||
var lastEnter = serie.context.pointerEnter;
|
||||
|
||||
Reference in New Issue
Block a user