mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 20:58:47 +00:00
优化Comment坐标刷新
This commit is contained in:
@@ -14,7 +14,7 @@ namespace XCharts.Runtime
|
|||||||
var comment = component;
|
var comment = component;
|
||||||
comment.OnChanged();
|
comment.OnChanged();
|
||||||
comment.painter = null;
|
comment.painter = null;
|
||||||
comment.refreshComponent = delegate()
|
comment.refreshComponent = delegate ()
|
||||||
{
|
{
|
||||||
var objName = ChartCached.GetComponentObjectName(comment);
|
var objName = ChartCached.GetComponentObjectName(comment);
|
||||||
var commentObj = ChartHelper.AddObject(objName,
|
var commentObj = ChartHelper.AddObject(objName,
|
||||||
@@ -31,12 +31,12 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
var item = comment.items[i];
|
var item = comment.items[i];
|
||||||
var labelStyle = comment.GetLabelStyle(i);
|
var labelStyle = comment.GetLabelStyle(i);
|
||||||
|
item.location.OnChanged();
|
||||||
var labelPos = chart.chartPosition + item.location.GetPosition(chart.chartWidth, chart.chartHeight);
|
var labelPos = chart.chartPosition + item.location.GetPosition(chart.chartWidth, chart.chartHeight);
|
||||||
var label = ChartHelper.AddChartLabel(s_CommentObjectName + i, commentObj.transform, labelStyle, chart.theme.common,
|
var label = ChartHelper.AddChartLabel(s_CommentObjectName + i, commentObj.transform, labelStyle, chart.theme.common,
|
||||||
GetContent(item), Color.clear, TextAnchor.MiddleCenter);
|
GetContent(item), Color.clear, TextAnchor.MiddleCenter);
|
||||||
label.SetActive(comment.show && item.show, true);
|
label.SetActive(comment.show && item.show, true);
|
||||||
label.SetPosition(labelPos);
|
label.SetPosition(labelPos + labelStyle.offset);
|
||||||
label.text.SetLocalPosition(labelStyle.offset);
|
|
||||||
item.labelObject = label;
|
item.labelObject = label;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ namespace XCharts.Runtime
|
|||||||
if (endLabelStyle == null)
|
if (endLabelStyle == null)
|
||||||
return;
|
return;
|
||||||
var dataCount = serie.context.dataPoints.Count;
|
var dataCount = serie.context.dataPoints.Count;
|
||||||
var active = endLabelStyle.show && dataCount > 0;
|
var active = endLabelStyle.show && dataCount > 0 && !ChartHelper.IsZeroVector(serie.context.lineEndPostion);
|
||||||
m_EndLabel.SetActive(active);
|
m_EndLabel.SetActive(active);
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user