Files
XCharts/Runtime/Component/Axis/AxisLine.cs

78 lines
2.4 KiB
C#
Raw Normal View History

2019-07-13 16:38:38 +08:00
using UnityEngine;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2019-07-13 16:38:38 +08:00
{
/// <summary>
/// Settings related to axis line.
2022-03-24 08:37:06 +08:00
/// |坐标轴轴线。
/// </summary>
[System.Serializable]
2021-01-11 08:54:28 +08:00
public class AxisLine : BaseLine
2019-07-13 16:38:38 +08:00
{
[SerializeField] private bool m_OnZero;
2021-01-11 08:54:28 +08:00
[SerializeField] private bool m_ShowArrow;
2021-11-23 13:20:07 +08:00
[SerializeField] private ArrowStyle m_Arrow = new ArrowStyle();
2019-07-13 16:38:38 +08:00
/// <summary>
/// When mutiple axes exists, this option can be used to specify which axis can be "onZero" to.
2022-03-24 08:37:06 +08:00
/// |X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
/// </summary>
public bool onZero
{
get { return m_OnZero; }
2021-01-11 08:54:28 +08:00
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
}
/// <summary>
2022-03-24 08:37:06 +08:00
/// Whether to show the arrow symbol of axis.
/// |是否显示箭头。
/// </summary>
2021-01-11 08:54:28 +08:00
public bool showArrow
{
2021-01-11 08:54:28 +08:00
get { return m_ShowArrow; }
set { if (PropertyUtil.SetStruct(ref m_ShowArrow, value)) SetVerticesDirty(); }
}
/// <summary>
2021-01-11 08:54:28 +08:00
/// the arrow of line.
2022-03-24 08:37:06 +08:00
/// |轴线箭头。
/// </summary>
2021-11-23 13:20:07 +08:00
public ArrowStyle arrow
{
2021-01-11 08:54:28 +08:00
get { return m_Arrow; }
set { if (PropertyUtil.SetClass(ref m_Arrow, value)) SetVerticesDirty(); }
}
2019-07-13 16:38:38 +08:00
public static AxisLine defaultAxisLine
{
get
{
var axisLine = new AxisLine
{
m_Show = true,
m_OnZero = true,
2021-01-11 08:54:28 +08:00
m_ShowArrow = false,
2021-11-23 13:20:07 +08:00
m_Arrow = new ArrowStyle(),
2021-01-11 08:54:28 +08:00
m_LineStyle = new LineStyle(LineStyle.Type.None),
2019-07-13 16:38:38 +08:00
};
return axisLine;
}
}
public AxisLine Clone()
{
var axisLine = new AxisLine();
axisLine.show = show;
axisLine.onZero = onZero;
2021-01-11 08:54:28 +08:00
axisLine.showArrow = showArrow;
axisLine.arrow = arrow.Clone();
return axisLine;
}
public void Copy(AxisLine axisLine)
{
2021-01-11 08:54:28 +08:00
base.Copy(axisLine);
onZero = axisLine.onZero;
2021-01-11 08:54:28 +08:00
showArrow = axisLine.showArrow;
arrow.Copy(axisLine.arrow);
}
2019-07-13 16:38:38 +08:00
}
}