增加Legend几种内置图标的支持 #90

This commit is contained in:
monitor1394
2021-03-05 08:56:55 +08:00
parent ef3817d231
commit 642dde3c27
9 changed files with 210 additions and 23 deletions

View File

@@ -105,6 +105,28 @@ namespace XCharts
}
}
public Rect GetIconRect()
{
if (m_GameObject && m_IconRect)
{
var pos = m_GameObject.transform.localPosition;
var sizeDelta = m_IconRect.sizeDelta;
var y = pos.y - (m_Rect.sizeDelta.y - sizeDelta.y) / 2 - sizeDelta.y;
return new Rect(pos.x, y, m_IconRect.sizeDelta.x, m_IconRect.sizeDelta.y);
}
else
{
return Rect.zero;
}
}
public Color GetIconColor()
{
if (m_Icon) return m_Icon.color;
else return Color.clear;
}
public void SetIconColor(Color color)
{
if (m_Icon)
@@ -121,6 +143,14 @@ namespace XCharts
}
}
public void SetIconActive(bool active)
{
if (m_Icon)
{
m_Icon.gameObject.SetActive(active);
}
}
public void SetContentColor(Color color)
{
if (m_Text != null)