using System;
using UnityEngine;
namespace XCharts.Runtime
{
///
///
[Serializable]
public class ArrowStyle : ChildComponent
{
[SerializeField] private float m_Width = 10;
[SerializeField] private float m_Height = 15;
[SerializeField] private float m_Offset = 0;
[SerializeField] private float m_Dent = 3;
[SerializeField] private Color32 m_Color = Color.clear;
///
/// The widht of arrow.
/// |箭头宽。
///
public float width
{
get { return m_Width; }
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetVerticesDirty(); }
}
///
/// The height of arrow.
/// |箭头高。
///
public float height
{
get { return m_Height; }
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetVerticesDirty(); }
}
///
/// The offset of arrow.
/// |箭头偏移。
///
public float offset
{
get { return m_Offset; }
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetVerticesDirty(); }
}
///
/// The dent of arrow.
/// |箭头的凹度。
///
public float dent
{
get { return m_Dent; }
set { if (PropertyUtil.SetStruct(ref m_Dent, value)) SetVerticesDirty(); }
}
///
/// the color of arrow.
/// |箭头颜色。
///
public Color32 color
{
get { return m_Color; }
set { if (PropertyUtil.SetColor(ref m_Color, value)) SetVerticesDirty(); }
}
public ArrowStyle Clone()
{
var arrow = new ArrowStyle();
arrow.width = width;
arrow.height = height;
arrow.offset = offset;
arrow.dent = dent;
arrow.color = color;
return arrow;
}
public void Copy(ArrowStyle arrow)
{
width = arrow.width;
height = arrow.height;
offset = arrow.offset;
dent = arrow.dent;
color = arrow.color;
}
public Color32 GetColor(Color32 defaultColor)
{
if (ChartHelper.IsClearColor(color))
return defaultColor;
else
return color;
}
}
}