mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 06:50:18 +00:00
增加Legend几种内置图标的支持 #90
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user