mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 12:08:46 +00:00
增加Axis的onLabelClick回调事件
This commit is contained in:
@@ -115,13 +115,13 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public AxisContext context = new AxisContext();
|
public AxisContext context = new AxisContext();
|
||||||
|
|
||||||
private Action<Vector3, int, string> m_OnLabelClick;
|
private Action<int, string> m_OnLabelClick;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback function when click on the label. Parameters: clickPos, labelIndex, labelName.
|
/// Callback function when click on the label. Parameters: labelIndex, labelName.
|
||||||
/// ||点击文本标签回调函数。参数:clickPos, labelIndex, labelName。
|
/// ||点击文本标签回调函数。参数:labelIndex, labelName。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Since("v3.15.0")]
|
[Since("v3.15.0")]
|
||||||
public Action<Vector3, int, string> onLabelClick { internal get { return m_OnLabelClick; } set { m_OnLabelClick = value; } }
|
public Action<int, string> onLabelClick { internal get { return m_OnLabelClick; } set { m_OnLabelClick = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to show axis.
|
/// Whether to show axis.
|
||||||
/// ||是否显示坐标轴。
|
/// ||是否显示坐标轴。
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace XCharts
|
|||||||
if (label == null) continue;
|
if (label == null) continue;
|
||||||
if (label.InRect(chart.pointerPos))
|
if (label.InRect(chart.pointerPos))
|
||||||
{
|
{
|
||||||
component.onLabelClick.Invoke(chart.pointerPos, i, label.text.text.text);
|
component.onLabelClick.Invoke(i, label.text.text.text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user