mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 22:40:10 +00:00
支持除鼠标以外其他输入方式的Point位置获取,比如VR项目
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
@@ -35,6 +35,7 @@ namespace XCharts.Runtime
|
||||
protected bool m_PainerDirty = false;
|
||||
protected bool m_IsOnValidate = false;
|
||||
protected Vector3 m_LastLocalPosition;
|
||||
protected PointerEventData m_PointerEventData;
|
||||
|
||||
protected Action<PointerEventData, BaseGraph> m_OnPointerClick;
|
||||
protected Action<PointerEventData, BaseGraph> m_OnPointerDown;
|
||||
@@ -209,7 +210,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!isPointerInChart) return;
|
||||
if (canvas == null) return;
|
||||
Vector2 mousePos = Input.mousePosition;
|
||||
Vector2 mousePos = m_PointerEventData.position;
|
||||
Vector2 local;
|
||||
if (!ScreenPointToChartPoint(mousePos, out local))
|
||||
{
|
||||
@@ -278,13 +279,13 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
isPointerInChart = true;
|
||||
m_PointerEventData = eventData;
|
||||
if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this);
|
||||
}
|
||||
|
||||
public virtual void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
isPointerInChart = false;
|
||||
m_PointerEventData = null;
|
||||
if (m_OnPointerExit != null) m_OnPointerExit(eventData, this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user