mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
完善SerieSymbol以支持象形柱图PictorialBarChart扩展
This commit is contained in:
@@ -387,7 +387,8 @@ namespace XCharts
|
||||
return ChartHelper.GetOrAddComponent<Painter>(painterObj);
|
||||
}
|
||||
|
||||
public static Image AddIcon(string name, Transform parent, float width, float height)
|
||||
public static Image AddIcon(string name, Transform parent, float width, float height, Sprite sprite = null,
|
||||
Image.Type type = Image.Type.Simple)
|
||||
{
|
||||
var anchorMax = new Vector2(0.5f, 0.5f);
|
||||
var anchorMin = new Vector2(0.5f, 0.5f);
|
||||
@@ -396,6 +397,15 @@ namespace XCharts
|
||||
GameObject iconObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||
var img = GetOrAddComponent<Image>(iconObj);
|
||||
img.raycastTarget = false;
|
||||
img.type = type;
|
||||
if (sprite != null)
|
||||
{
|
||||
img.sprite = sprite;
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
img.SetNativeSize();
|
||||
}
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user