mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
修复饼图在Inspector上修改相关参数后不刷新的问题
This commit is contained in:
@@ -172,6 +172,12 @@ namespace XCharts.Runtime
|
||||
DefaultChart();
|
||||
Awake();
|
||||
}
|
||||
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
foreach (var handler in m_SerieHandlers) handler.OnValidate();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void Start()
|
||||
|
||||
@@ -76,13 +76,13 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void UpdateSerieContext()
|
||||
{
|
||||
var needCheck = m_LegendEnter || m_LegendExiting || (chart.isPointerInChart && PointerIsInPieSerie(serie, chart.pointerPos));
|
||||
var needCheck = m_LegendEnter || m_LegendExiting || m_ForceUpdateSerieContext || (chart.isPointerInChart && PointerIsInPieSerie(serie, chart.pointerPos));
|
||||
var needInteract = false;
|
||||
var interactEnable = serie.animation.enable && serie.animation.interaction.enable;
|
||||
Color32 color, toColor;
|
||||
if (!needCheck)
|
||||
{
|
||||
if (m_LastCheckContextFlag != needCheck)
|
||||
if (m_LastCheckContextFlag != needCheck || m_ForceUpdateSerieContext)
|
||||
{
|
||||
serie.context.pointerItemDataIndex = -1;
|
||||
serie.context.pointerEnter = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ 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 UpdateSerieContext() { }
|
||||
@@ -59,6 +60,7 @@ namespace XCharts.Runtime
|
||||
protected bool m_LastCheckContextFlag = false;
|
||||
protected bool m_LegendEnter = false;
|
||||
protected bool m_LegendExiting = false;
|
||||
protected bool m_ForceUpdateSerieContext = false;
|
||||
protected int m_LegendEnterIndex;
|
||||
protected ChartLabel m_EndLabel;
|
||||
|
||||
@@ -73,6 +75,11 @@ namespace XCharts.Runtime
|
||||
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
||||
}
|
||||
|
||||
public override void OnValidate()
|
||||
{
|
||||
m_ForceUpdateSerieContext = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (m_NeedInitComponent)
|
||||
@@ -134,6 +141,7 @@ namespace XCharts.Runtime
|
||||
var lastEnter = serie.context.pointerEnter;
|
||||
var lastDataIndex = serie.context.pointerItemDataIndex;
|
||||
UpdateSerieContext();
|
||||
m_ForceUpdateSerieContext = false;
|
||||
if (lastEnter != serie.context.pointerEnter || lastDataIndex != serie.context.pointerItemDataIndex)
|
||||
{
|
||||
if (chart.onSerieEnter != null || chart.onSerieExit != null || serie.onEnter != null || serie.onExit != null)
|
||||
|
||||
Reference in New Issue
Block a user