增加SymbolStyleborderWidthemptyColor配置

This commit is contained in:
monitor1394
2024-12-23 21:31:27 +08:00
parent 301c66eccf
commit 5d24580725
6 changed files with 39 additions and 4 deletions

View File

@@ -84,6 +84,8 @@ namespace XCharts.Runtime
[SerializeField] protected Sprite m_Image;
[SerializeField] protected Image.Type m_ImageType;
[SerializeField] protected Color32 m_Color;
[SerializeField][Since("v3.13.0")] protected float m_BorderWidth = 0f;
[SerializeField][Since("v3.13.0")] protected Color32 m_EmptyColor;
public virtual void Reset()
{
@@ -183,6 +185,24 @@ namespace XCharts.Runtime
get { return m_Color; }
set { if (PropertyUtil.SetStruct(ref m_Color, value)) SetAllDirty(); }
}
/// <summary>
/// the border width of symbol.
/// ||图形的边框宽度。
/// </summary>
public float borderWidth
{
get { return m_BorderWidth; }
set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetAllDirty(); }
}
/// <summary>
/// the color of empty symbol.
/// ||空心图形的颜色。
/// </summary>
public Color32 emptyColor
{
get { return m_EmptyColor; }
set { if (PropertyUtil.SetStruct(ref m_EmptyColor, value)) SetAllDirty(); }
}
public Vector3 offset3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
/// <summary>

View File

@@ -22,13 +22,14 @@ namespace XCharts.Runtime
}
else
{
if (tickness > 0)
if (tickness > 0 && !ChartHelper.IsClearColor(borderColor))
UGL.DrawDoughnut(vh, pos, symbolSize, symbolSize + tickness, borderColor, borderColor, color, smoothness);
else
UGL.DrawCricle(vh, pos, symbolSize, color, toColor, smoothness);
}
break;
case SymbolType.EmptyCircle:
if (tickness == 0) tickness = 4f;
if (gap > 0)
{
UGL.DrawCricle(vh, pos, symbolSize + gap, backgroundColor, smoothness);
@@ -57,6 +58,7 @@ namespace XCharts.Runtime
}
break;
case SymbolType.EmptyRect:
if (tickness == 0) tickness = 4f;
if (gap > 0)
{
UGL.DrawSquare(vh, pos, symbolSize + gap, backgroundColor);
@@ -75,6 +77,7 @@ namespace XCharts.Runtime
}
if (type == SymbolType.EmptyTriangle)
{
if (tickness == 0) tickness = 4f;
UGL.DrawEmptyTriangle(vh, pos, symbolSize * 1.4f, tickness * 2f, color, emptyColor);
}
else
@@ -92,6 +95,7 @@ namespace XCharts.Runtime
}
if (type == SymbolType.EmptyDiamond)
{
if (tickness == 0) tickness = 4f;
UGL.DrawEmptyDiamond(vh, pos, xRadius, yRadius, tickness, color, emptyColor);
}
else
@@ -124,6 +128,7 @@ namespace XCharts.Runtime
arrowOffset, arrowDent, color);
if (type == SymbolType.EmptyArrow)
{
if (tickness == 0) tickness = 4f;
arrowWidth = (symbolSize - tickness) * 2;
arrowHeight = arrowWidth * 1.5f;
arrowOffset = 0;

View File

@@ -7,6 +7,7 @@ namespace XCharts.Runtime
{
private static Dictionary<string, Color32> s_ColorCached = new Dictionary<string, Color32>();
public static readonly Color32 clearColor32 = new Color32(0, 0, 0, 0);
public static readonly Color32 white = new Color32(255, 255, 255, 255);
public static readonly Vector2 zeroVector2 = Vector2.zero;
/// <summary>