mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +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; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ namespace XCharts
|
||||
/// reutrn true when all the show axis is `Value` type.
|
||||
/// 纯数值坐标轴(数值轴或对数轴)。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsValue()
|
||||
{
|
||||
foreach (var axis in m_XAxises)
|
||||
@@ -154,6 +153,9 @@ namespace XCharts
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 纯类目轴。
|
||||
/// </summary>
|
||||
public bool IsCategory()
|
||||
{
|
||||
foreach (var axis in m_XAxises)
|
||||
@@ -167,6 +169,9 @@ namespace XCharts
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 坐标是否在坐标轴内。
|
||||
/// </summary>
|
||||
public bool IsInCooridate(Vector2 local)
|
||||
{
|
||||
return IsInCooridate(local.x, local.y);
|
||||
@@ -253,7 +258,7 @@ namespace XCharts
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置可缓存的最大数据量。
|
||||
/// 设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
|
||||
/// </summary>
|
||||
public void SetMaxCache(int maxCache)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user