/// <summary> /// Convenience function for cloning PointerEventData /// </summary> /// <param name="from">Copy this value</param> /// <param name="to">to this object</param> protected void CopyFromTo(TouchUIPointerEventData @from, TouchUIPointerEventData @to) { @to.position = @from.position; @to.delta = @from.delta; @to.scrollDelta = @from.scrollDelta; @to.pointerCurrentRaycast = @from.pointerCurrentRaycast; @to.pointerEnter = @from.pointerEnter; @to.pointerPos = @from.pointerPos; }
/// <summary> /// Performs a raycast using eventData.worldSpaceRay /// </summary> /// <param name="eventData"></param> /// <param name="resultAppendList"></param> public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList) { TouchUIPointerEventData rayPointerEventData = eventData as TouchUIPointerEventData; if (rayPointerEventData != null) { Raycast(eventData, resultAppendList, new Ray(rayPointerEventData.pointerPos, canvas.transform.forward), true); } }
/// <summary> /// The purpose of this function is to allow us to switch between using the standard IsPointerMoving /// method for mouse driven pointers, but to always return true when it's a ray based pointer. /// All real-world ray-based input devices are always moving so for simplicity we just return true /// for them. /// /// If PointerEventData.IsPointerMoving was virtual we could just override that in /// OVRRayPointerEventData. /// </summary> /// <param name="pointerEvent"></param> /// <returns></returns> static bool IsPointerMoving(PointerEventData pointerEvent) { TouchUIPointerEventData rayPointerEventData = pointerEvent as TouchUIPointerEventData; if (rayPointerEventData != null) { return(true); } else { return(pointerEvent.IsPointerMoving()); } }
protected bool GetPointerData(int id, out TouchUIPointerEventData data, bool create) { if (!m_VRRayPointerData.TryGetValue(id, out data) && create) { data = new TouchUIPointerEventData(eventSystem) { pointerId = id, }; m_VRRayPointerData.Add(id, data); return(true); } return(false); }