增加TooltiptriggerOn指定触发条件

This commit is contained in:
monitor1394
2024-03-20 13:34:21 +08:00
parent 99b1624b54
commit 0990b11c1c
17 changed files with 284 additions and 60 deletions

View File

@@ -73,6 +73,23 @@ namespace XCharts.Runtime
Auto
}
/// <summary>
/// the condition of trigger tooltip.
/// ||触发条件。
/// </summary>
public enum TriggerOn
{
/// <summary>
/// Trigger when mouse move.
/// ||鼠标移动时触发。
/// </summary>
MouseMove,
/// <summary>
/// Trigger when mouse click.
/// ||鼠标点击时触发。
/// </summary>
Click,
}
/// <summary>
/// Position type.
/// ||坐标类型。
/// </summary>
@@ -102,6 +119,7 @@ namespace XCharts.Runtime
[SerializeField] private bool m_Show = true;
[SerializeField] private Type m_Type = Type.Auto;
[SerializeField] private Trigger m_Trigger = Trigger.Auto;
[SerializeField][Since("v3.11.0")] private TriggerOn m_TriggerOn = TriggerOn.MouseMove;
[SerializeField][Since("v3.3.0")] private Position m_Position = Position.Auto;
[SerializeField] private string m_ItemFormatter;
[SerializeField] private string m_TitleFormatter;
@@ -144,6 +162,12 @@ namespace XCharts.Runtime
public TooltipContext context = new TooltipContext();
public TooltipView view;
/// <summary>
/// the callback of tooltip click index.
/// ||Tooltip为Click触发时点击的X轴索引的回调。
/// </summary>
public System.Action<int> onClickIndex { get; set; }
/// <summary>
/// Whether to show the tooltip component.
/// ||是否显示提示框组件。
@@ -172,6 +196,15 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_Trigger, value)) SetAllDirty(); }
}
/// <summary>
/// Condition of trigger tooltip.
/// ||触发条件。
/// </summary>
public TriggerOn triggerOn
{
get { return m_TriggerOn; }
set { if (PropertyUtil.SetStruct(ref m_TriggerOn, value)) SetAllDirty(); }
}
/// <summary>
/// Type of position.
/// ||显示位置类型。
/// </summary>