// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UltimateXR.Core;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace UltimateXR.UI.UnityInputModule
{
///
/// Raycaster compatible with Unity UI to use components on canvases, enabling
/// interaction using laser pointers from a distance.
///
[RequireComponent(typeof(Canvas))]
public class UxrLaserPointerRaycaster : UxrGraphicRaycaster
{
#region Public Overrides GraphicRaycaster
///
public override void Raycast(PointerEventData eventData, List resultAppendList)
{
// Check if it should be ray-casted
UxrPointerEventData pointerEventData = eventData as UxrPointerEventData;
if (pointerEventData == null || pointerEventData.LaserPointer == null)
{
return;
}
// Initialize if necessary
if (_canvas == null)
{
_canvas = gameObject.GetComponent