/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
namespace NRKernal
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// Interface for canvas raycast target.
public interface ICanvasRaycastTarget
{
/// Gets the canvas.
/// The canvas.
Canvas canvas { get; }
/// Gets a value indicating whether this object is enabled.
/// True if enabled, false if not.
bool enabled { get; }
/// Gets a value indicating whether the ignore reversed graphics.
/// True if ignore reversed graphics, false if not.
bool ignoreReversedGraphics { get; }
void GraphicRaycast(bool ignoreReversedGraphics, Ray ray, float distance, Vector3 screenCenterPoint, NRPointerRaycaster raycaster, List raycastResults);
}
///
/// The class enables an UGUI Canvas and its children to be interactive with NRInput raycasters.
[RequireComponent(typeof(Canvas))]
[DisallowMultipleComponent]
public class CanvasRaycastTarget : UIBehaviour, ICanvasRaycastTarget
{
/// The canvas.
private Canvas m_canvas;
/// True to ignore reversed graphics.
[SerializeField]
private bool m_IgnoreReversedGraphics = true;
/// Gets the canvas.
/// The canvas.
public virtual Canvas canvas { get { return m_canvas ?? (m_canvas = GetComponent