mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-15 04:20:09 +00:00
增加部分鼠标事件回调
This commit is contained in:
@@ -9,6 +9,7 @@ using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
@@ -88,7 +89,6 @@ namespace XCharts
|
||||
/// The position of chart.
|
||||
/// 图表的左下角起始坐标。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Vector3 chartPosition { get { return m_ChartPosition; } }
|
||||
public Rect chartRect { get { return m_ChartRect; } }
|
||||
/// <summary>
|
||||
@@ -97,13 +97,53 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public Vector2 pointerPos { get; protected set; }
|
||||
/// <summary>
|
||||
/// 自定义绘制回调。
|
||||
/// </summary>
|
||||
public Action<VertexHelper> customDrawCallback { set { m_CustomDrawCallback = value; } }
|
||||
/// <summary>
|
||||
/// 警告信息。
|
||||
/// </summary>
|
||||
public string warningInfo { get; protected set; }
|
||||
/// <summary>
|
||||
/// 强制开启鼠标事件检测。
|
||||
/// </summary>
|
||||
public bool forceOpenRaycastTarget { get { return m_ForceOpenRaycastTarget; } set { m_ForceOpenRaycastTarget = value; } }
|
||||
/// <summary>
|
||||
/// 自定义绘制回调。
|
||||
/// </summary>
|
||||
public Action<VertexHelper> onCustomDraw { set { m_OnCustomDrawCallback = value; } }
|
||||
/// <summary>
|
||||
/// 鼠标点击回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onPointerClick { set { m_OnPointerClick = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标按下回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onPointerDown { set { m_OnPointerDown = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标弹起回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onPointerUp { set { m_OnPointerUp = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标进入回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onPointerEnter { set { m_OnPointerEnter = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标退出回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onPointerExit { set { m_OnPointerExit = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标开始拖拽回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onBeginDrag { set { m_OnBeginDrag = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标拖拽回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onDrag { set { m_OnDrag = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标结束拖拽回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onEndDrag { set { m_OnEndDrag = value; m_ForceOpenRaycastTarget = true; } }
|
||||
/// <summary>
|
||||
/// 鼠标滚动回调。
|
||||
/// </summary>
|
||||
public Action<BaseChart, PointerEventData> onScroll { set { m_OnScroll = value; m_ForceOpenRaycastTarget = true; } }
|
||||
|
||||
/// <summary>
|
||||
/// 设置图表的宽高(在非stretch pivot下才有效,其他情况需要自己调整RectTransform)
|
||||
@@ -704,5 +744,8 @@ namespace XCharts
|
||||
|
||||
[Obsolete("Use BaseChart.AnimationFadeOut() instead.", true)]
|
||||
public void MissAnimationStart() { }
|
||||
|
||||
[Obsolete("Use onCustomDraw instead.", false)]
|
||||
public Action<VertexHelper> customDrawCallback { set { m_OnCustomDrawCallback = value; } }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user