private void Hover(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            if (pointer.pointerEventData.pointerEnter)
            {
                if (ShouldIgnoreElement(pointer.pointerEventData.pointerEnter, pointer.ignoreCanvasWithTagOrClass))
                {
                    return;
                }

                if (NoValidCollision(pointer, results))
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
                    pointer.pointerEventData.hovered.Remove(pointer.pointerEventData.pointerEnter);
                    pointer.pointerEventData.pointerEnter = null;
                }
            }
            else
            {
                foreach (var result in results)
                {
                    if (ShouldIgnoreElement(result.gameObject, pointer.ignoreCanvasWithTagOrClass))
                    {
                        continue;
                    }

                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                    if (target != null)
                    {
                        var selectable = target.GetComponent <Selectable>();
                        if (selectable)
                        {
                            var noNavigation = new Navigation();
                            noNavigation.mode     = Navigation.Mode.None;
                            selectable.navigation = noNavigation;
                        }

                        pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(target, pointer.hoveringElement));
                        pointer.hoveringElement = target;
                        pointer.pointerEventData.pointerCurrentRaycast = result;
                        pointer.pointerEventData.pointerEnter          = target;
                        pointer.pointerEventData.hovered.Add(pointer.pointerEventData.pointerEnter);
                        break;
                    }
                    else
                    {
                        if (result.gameObject != pointer.hoveringElement)
                        {
                            pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(result.gameObject, pointer.hoveringElement));
                        }
                        pointer.hoveringElement = result.gameObject;
                    }
                }

                if (pointer.hoveringElement && results.Count == 0)
                {
                    pointer.OnUIPointerElementExit(pointer.SetUIPointerEvent(null, pointer.hoveringElement));
                    pointer.hoveringElement = null;
                }
            }
        }
Esempio n. 2
0
 // Token: 0x0600176D RID: 5997 RVA: 0x0007D640 File Offset: 0x0007B840
 protected virtual bool AttemptClick(VRTK_UIPointer pointer)
 {
     if (!pointer.pointerEventData.pointerPress)
     {
         return(false);
     }
     if (!this.ValidElement(pointer.pointerEventData.pointerPress))
     {
         pointer.pointerEventData.pointerPress = null;
         return(true);
     }
     if (pointer.pointerEventData.eligibleForClick)
     {
         if (!this.IsHovering(pointer))
         {
             ExecuteEvents.ExecuteHierarchy <IPointerUpHandler>(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
             pointer.pointerEventData.pointerPress = null;
         }
     }
     else
     {
         pointer.OnUIPointerElementClick(pointer.SetUIPointerEvent(pointer.pointerEventData.pointerPressRaycast, pointer.pointerEventData.pointerPress, null));
         ExecuteEvents.ExecuteHierarchy <IPointerClickHandler>(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerClickHandler);
         ExecuteEvents.ExecuteHierarchy <IPointerUpHandler>(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
         pointer.pointerEventData.pointerPress = null;
     }
     return(true);
 }
        protected virtual List <RaycastResult> CheckRaycasts(VRTK_UIPointer pointer)
        {
            RaycastResult raycastResult = new RaycastResult();

            raycastResult.worldPosition = pointer.GetOriginPosition();
            raycastResult.worldNormal   = pointer.GetOriginForward();

            pointer.pointerEventData.pointerCurrentRaycast = raycastResult;

            List <RaycastResult> raycasts = new List <RaycastResult>();

            eventSystem.RaycastAll(pointer.pointerEventData, raycasts);

            raycasts.Sort((res1, res2) =>
            {
                // use depth, if the canvas is the same and therefore distance is small
                // you might need to tweak the 0.001 for your case
                if (Mathf.Abs(res1.distance - res2.distance) < 0.001)
                {
                    return(res2.depth.CompareTo(res1.depth));
                }
                return(res1.distance.CompareTo(res2.distance));
            });

            if (raycasts.Count > 0)
            {
                pointer.pointerEventData.pointerCurrentRaycast = raycasts[0];
            }

            return(raycasts);
        }
Esempio n. 4
0
        protected virtual void Scroll(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            if (null == pointer.controller)
            {
                return;
            }
            pointer.pointerEventData.scrollDelta = pointer.controller.GetTouchpadAxis();
            var scrollWheelVisible = false;

            foreach (RaycastResult result in results)
            {
                if (pointer.pointerEventData.scrollDelta != Vector2.zero)
                {
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.scrollHandler);
                    if (target)
                    {
                        scrollWheelVisible = true;
                    }
                }
            }

            if (pointer.controllerRenderModel)
            {
                VRTK_SDK_Bridge.SetControllerRenderModelWheel(pointer.controllerRenderModel, scrollWheelVisible);
            }
        }
Esempio n. 5
0
 private void GetMissingVariables()
 {
     if (uiPointer == null)
     {
         uiPointer = GetComponent <VRTK.VRTK_UIPointer>();
     }
 }
        protected virtual bool IsEligibleClick(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            if (pointer.pointerEventData.eligibleForClick)
            {
                for (int i = 0; i < results.Count; i++)
                {
                    RaycastResult result = results[i];
                    if (!ValidElement(result.gameObject))
                    {
                        continue;
                    }

                    GameObject target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerDownHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pressPosition       = pointer.pointerEventData.position;
                        pointer.pointerEventData.pointerPressRaycast = result;
                        pointer.pointerEventData.pointerPress        = target;
                        return(true);
                    }
                }
            }

            return(false);
        }
        private bool AttemptClick(VRTK_UIPointer pointer)
        {
            if (pointer.pointerEventData.pointerPress)
            {
                if (!ValidElement(pointer.pointerEventData.pointerPress))
                {
                    return(true);
                }

                if (pointer.pointerEventData.eligibleForClick)
                {
                    if (!IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                        pointer.pointerEventData.pointerPress = null;
                    }
                }
                else
                {
                    pointer.OnUIPointerElementClick(pointer.SetUIPointerEvent(pointer.pointerEventData.pointerPress));
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerClickHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                    pointer.pointerEventData.pointerPress = null;
                }
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
        protected virtual List <RaycastResult> CheckRaycasts(VRTK_UIPointer pointer)
        {
            var raycastResult = new RaycastResult();

            raycastResult.worldPosition = pointer.GetOriginPosition();
            raycastResult.worldNormal   = pointer.GetOriginForward();

            pointer.pointerEventData.pointerCurrentRaycast = raycastResult;

            List <RaycastResult> raycasts = new List <RaycastResult>();

            eventSystem.RaycastAll(pointer.pointerEventData, raycasts);

            // custom - begin
            // 포인터에 닿은게 없다면 Raycast 강제 무시
            if (pointer.pointerRenderer != null)
            {
                var hit = pointer.pointerRenderer.GetDestinationHit();
                if (hit.collider == null)
                {
                    raycasts.Clear();
                }
            }
            // custom - end

            return(raycasts);
        }
        private void Hover(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            if (pointer.pointerEventData.pointerEnter)
            {
                if (NoValidCollision(pointer, results))
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
                    pointer.pointerEventData.pointerEnter = null;
                }
            }
            else
            {
                foreach (var result in results)
                {
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                    if (target != null)
                    {
                        var selectable = target.GetComponent <Selectable>();
                        if (selectable)
                        {
                            var noNavigation = new Navigation();
                            noNavigation.mode     = Navigation.Mode.None;
                            selectable.navigation = noNavigation;
                        }

                        pointer.pointerEventData.pointerCurrentRaycast = result;
                        pointer.pointerEventData.pointerEnter          = target;
                        break;
                    }
                }
            }
        }
Esempio n. 10
0
 // Token: 0x0600176A RID: 5994 RVA: 0x0007D522 File Offset: 0x0007B722
 protected virtual void ClickOnUp(VRTK_UIPointer pointer, List <RaycastResult> results)
 {
     pointer.pointerEventData.eligibleForClick = pointer.ValidClick(false, false);
     if (!this.AttemptClick(pointer))
     {
         this.IsEligibleClick(pointer, results);
     }
 }
Esempio n. 11
0
 // Token: 0x0600176B RID: 5995 RVA: 0x0007D549 File Offset: 0x0007B749
 protected virtual void ClickOnDown(VRTK_UIPointer pointer, List <RaycastResult> results, bool forceClick = false)
 {
     pointer.pointerEventData.eligibleForClick = (forceClick || pointer.ValidClick(true, false));
     if (this.IsEligibleClick(pointer, results))
     {
         pointer.pointerEventData.eligibleForClick = false;
         this.AttemptClick(pointer);
     }
 }
Esempio n. 12
0
        protected virtual void OnTriggerExit(Collider collider)
        {
            VRTK_UIPointer pointerCheck = collider.GetComponentInParent <VRTK_UIPointer>();

            if (pointerCheck != null)
            {
                pointerCheck.collisionClick = false;
            }
        }
Esempio n. 13
0
        // Token: 0x06001A96 RID: 6806 RVA: 0x0008C2C8 File Offset: 0x0008A4C8
        protected virtual void OnTriggerExit(Collider collider)
        {
            VRTK_UIPointer componentInParent = collider.GetComponentInParent <VRTK_UIPointer>();

            if (componentInParent)
            {
                componentInParent.collisionClick = false;
            }
        }
Esempio n. 14
0
        // Token: 0x06001A9D RID: 6813 RVA: 0x0008C740 File Offset: 0x0008A940
        protected virtual void OnTriggerExit(Collider collider)
        {
            VRTK_UIPointer componentInParent = collider.GetComponentInParent <VRTK_UIPointer>();

            if (componentInParent && componentInParent.autoActivatingCanvas == base.gameObject)
            {
                componentInParent.autoActivatingCanvas = null;
            }
        }
        private void ClickOnUp(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            pointer.pointerEventData.eligibleForClick = pointer.ValidClick(false);

            if (!AttemptClick(pointer))
            {
                IsEligibleClick(pointer, results);
            }
        }
Esempio n. 16
0
        protected virtual void OnTriggerExit(Collider collider)
        {
            VRTK_UIPointer pointerCheck = collider.GetComponentInParent <VRTK_UIPointer>();

            if (pointerCheck != null && pointerCheck.autoActivatingCanvas == gameObject)
            {
                pointerCheck.autoActivatingCanvas = null;
            }
        }
Esempio n. 17
0
 // Token: 0x06001768 RID: 5992 RVA: 0x0007D2F0 File Offset: 0x0007B4F0
 protected virtual void Hover(VRTK_UIPointer pointer, List <RaycastResult> results)
 {
     if (pointer.pointerEventData.pointerEnter)
     {
         this.CheckPointerHoverClick(pointer, results);
         if (!this.ValidElement(pointer.pointerEventData.pointerEnter))
         {
             pointer.pointerEventData.pointerEnter = null;
             return;
         }
         if (this.NoValidCollision(pointer, results))
         {
             ExecuteEvents.ExecuteHierarchy <IPointerExitHandler>(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
             pointer.pointerEventData.hovered.Remove(pointer.pointerEventData.pointerEnter);
             pointer.pointerEventData.pointerEnter = null;
             return;
         }
     }
     else
     {
         foreach (RaycastResult raycastResult in results)
         {
             if (this.ValidElement(raycastResult.gameObject))
             {
                 GameObject gameObject = ExecuteEvents.ExecuteHierarchy <IPointerEnterHandler>(raycastResult.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                 if (gameObject != null)
                 {
                     Selectable component = gameObject.GetComponent <Selectable>();
                     if (component)
                     {
                         component.navigation = new Navigation
                         {
                             mode = Navigation.Mode.None
                         };
                     }
                     pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(raycastResult, gameObject, pointer.hoveringElement));
                     pointer.hoveringElement = gameObject;
                     pointer.pointerEventData.pointerCurrentRaycast = raycastResult;
                     pointer.pointerEventData.pointerEnter          = gameObject;
                     pointer.pointerEventData.hovered.Add(pointer.pointerEventData.pointerEnter);
                     break;
                 }
                 if (raycastResult.gameObject != pointer.hoveringElement)
                 {
                     pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(raycastResult, raycastResult.gameObject, pointer.hoveringElement));
                 }
                 pointer.hoveringElement = raycastResult.gameObject;
             }
         }
         if (pointer.hoveringElement && results.Count == 0)
         {
             pointer.OnUIPointerElementExit(pointer.SetUIPointerEvent(default(RaycastResult), null, pointer.hoveringElement));
             pointer.hoveringElement = null;
         }
     }
 }
Esempio n. 18
0
        //[Pure]
        protected virtual void Raycast(Canvas canvas, Camera eventCamera, PointerEventData eventData, Ray ray, ref List <RaycastResult> results)
        {
            float           hitDistance    = GetHitDistance(ray, VRTK_UIPointer.GetPointerLength(eventData.pointerId));
            IList <Graphic> canvasGraphics = GraphicRegistry.GetGraphicsForCanvas(canvas);

            for (int i = 0; i < canvasGraphics.Count; ++i)
            {
                Graphic graphic = canvasGraphics[i];

                if (graphic.depth == -1 || !graphic.raycastTarget)
                {
                    continue;
                }

                Transform graphicTransform = graphic.transform;
                Vector3   graphicForward   = graphicTransform.forward;
                float     distance         = Vector3.Dot(graphicForward, graphicTransform.position - ray.origin) / Vector3.Dot(graphicForward, ray.direction);

                if (distance < 0)
                {
                    continue;
                }

                //Prevents "flickering hover" on items near canvas center.
                if ((distance - UI_CONTROL_OFFSET) > hitDistance)
                {
                    continue;
                }

                Vector3 position        = ray.GetPoint(distance);
                Vector2 pointerPosition = eventCamera.WorldToScreenPoint(position);

                if (!RectTransformUtility.RectangleContainsScreenPoint(graphic.rectTransform, pointerPosition, eventCamera))
                {
                    continue;
                }

                if (graphic.Raycast(pointerPosition, eventCamera))
                {
                    RaycastResult result = new RaycastResult()
                    {
                        gameObject     = graphic.gameObject,
                        module         = this,
                        distance       = distance,
                        screenPosition = pointerPosition,
                        worldPosition  = position,
                        depth          = graphic.depth,
                        sortingLayer   = canvas.sortingLayerID,
                        sortingOrder   = canvas.sortingOrder,
                    };
                    VRTK_SharedMethods.AddListValue(results, result);
                }
            }

            results.Sort((g1, g2) => g2.depth.CompareTo(g1.depth));
        }
Esempio n. 19
0
        protected virtual void OnTriggerEnter(Collider collider)
        {
            VRTK_PlayerObject colliderCheck = collider.GetComponentInParent <VRTK_PlayerObject>();
            VRTK_UIPointer    pointerCheck  = collider.GetComponentInParent <VRTK_UIPointer>();

            if (pointerCheck != null && colliderCheck != null && colliderCheck.objectType == VRTK_PlayerObject.ObjectTypes.Collider)
            {
                pointerCheck.collisionClick = clickOnPointerCollision;
            }
        }
Esempio n. 20
0
        // Token: 0x06001A9C RID: 6812 RVA: 0x0008C700 File Offset: 0x0008A900
        protected virtual void OnTriggerEnter(Collider collider)
        {
            VRTK_PlayerObject componentInParent  = collider.GetComponentInParent <VRTK_PlayerObject>();
            VRTK_UIPointer    componentInParent2 = collider.GetComponentInParent <VRTK_UIPointer>();

            if (componentInParent2 && componentInParent && componentInParent.objectType == VRTK_PlayerObject.ObjectTypes.Collider)
            {
                componentInParent2.autoActivatingCanvas = base.gameObject;
            }
        }
Esempio n. 21
0
        protected virtual void OnTriggerEnter(Collider collider)
        {
            VRTK_PlayerObject colliderCheck = collider.GetComponentInParent <VRTK_PlayerObject>();
            VRTK_UIPointer    pointerCheck  = collider.GetComponentInParent <VRTK_UIPointer>();

            if (pointerCheck != null && colliderCheck != null && colliderCheck.objectType == VRTK_PlayerObject.ObjectTypes.Collider)
            {
                pointerCheck.autoActivatingCanvas = gameObject;
            }
        }
        private void ClickOnDown(VRTK_UIPointer pointer, List <RaycastResult> results, bool forceClick = false)
        {
            pointer.pointerEventData.eligibleForClick = (forceClick ? true : pointer.ValidClick(true));

            if (IsEligibleClick(pointer, results))
            {
                pointer.pointerEventData.eligibleForClick = false;
                AttemptClick(pointer);
            }
        }
Esempio n. 23
0
        // Token: 0x06001A95 RID: 6805 RVA: 0x0008C280 File Offset: 0x0008A480
        protected virtual void OnTriggerEnter(Collider collider)
        {
            VRTK_PlayerObject componentInParent  = collider.GetComponentInParent <VRTK_PlayerObject>();
            VRTK_UIPointer    componentInParent2 = collider.GetComponentInParent <VRTK_UIPointer>();

            if (componentInParent2 && componentInParent && componentInParent.objectType == VRTK_PlayerObject.ObjectTypes.Collider)
            {
                componentInParent2.collisionClick = this.clickOnPointerCollision;
            }
        }
Esempio n. 24
0
 // Token: 0x06001765 RID: 5989 RVA: 0x0007D1E4 File Offset: 0x0007B3E4
 protected virtual bool IsHovering(VRTK_UIPointer pointer)
 {
     foreach (GameObject gameObject in pointer.pointerEventData.hovered)
     {
         if (pointer.pointerEventData.pointerEnter && gameObject && this.CheckTransformTree(gameObject.transform, pointer.pointerEventData.pointerEnter.transform))
         {
             return(true);
         }
     }
     return(false);
 }
 private bool IsHovering(VRTK_UIPointer pointer)
 {
     foreach (var hoveredObject in pointer.pointerEventData.hovered)
     {
         if (pointer.pointerEventData.pointerEnter && hoveredObject && CheckTransformTree(hoveredObject.transform, pointer.pointerEventData.pointerEnter.transform))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 26
0
        // Token: 0x06001762 RID: 5986 RVA: 0x0007D120 File Offset: 0x0007B320
        protected virtual List <RaycastResult> CheckRaycasts(VRTK_UIPointer pointer)
        {
            RaycastResult pointerCurrentRaycast = default(RaycastResult);

            pointerCurrentRaycast.worldPosition            = pointer.GetOriginPosition();
            pointerCurrentRaycast.worldNormal              = pointer.GetOriginForward();
            pointer.pointerEventData.pointerCurrentRaycast = pointerCurrentRaycast;
            List <RaycastResult> list = new List <RaycastResult>();

            base.eventSystem.RaycastAll(pointer.pointerEventData, list);
            return(list);
        }
 protected virtual bool IsHovering(VRTK_UIPointer pointer)
 {
     for (int i = 0; i < pointer.pointerEventData.hovered.Count; i++)
     {
         GameObject hoveredObject = pointer.pointerEventData.hovered[i];
         if (pointer.pointerEventData.pointerEnter != null && hoveredObject != null && CheckTransformTree(hoveredObject.transform, pointer.pointerEventData.pointerEnter.transform))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 28
0
 // Token: 0x06001767 RID: 5991 RVA: 0x0007D29C File Offset: 0x0007B49C
 protected virtual void CheckPointerHoverClick(VRTK_UIPointer pointer, List <RaycastResult> results)
 {
     if (pointer.hoverDurationTimer > 0f)
     {
         pointer.hoverDurationTimer -= Time.deltaTime;
     }
     if (pointer.canClickOnHover && pointer.hoverDurationTimer <= 0f)
     {
         pointer.canClickOnHover = false;
         this.ClickOnDown(pointer, results, true);
     }
 }
        private List<RaycastResult> CheckRaycasts(VRTK_UIPointer pointer)
        {
            var raycastResult = new RaycastResult();
            raycastResult.worldPosition = pointer.transform.position;
            raycastResult.worldNormal = pointer.transform.forward;

            pointer.pointerEventData.pointerCurrentRaycast = raycastResult;

            List<RaycastResult> raycasts = new List<RaycastResult>();
            eventSystem.RaycastAll(pointer.pointerEventData, raycasts);
            return raycasts;
        }
Esempio n. 30
0
    public override void OnEndDrag(PointerEventData eventData)
    {
        canvasGroup.blocksRaycasts = true;
        dragTransform       = null;
        transform.position += (transform.forward * forwardOffset);
        bool validDragEnd = true;

        if (restrictToDropZone)
        {
            if (validDropZone != null && validDropZone != startDropZone)
            {
                transform.SetParent(validDropZone.transform);
            }
            else
            {
                ResetElement();
                validDragEnd = false;
            }
        }

        Canvas destinationCanvas = (eventData.pointerEnter != null ? eventData.pointerEnter.GetComponentInParent <Canvas>() : null);

        if (restrictToOriginalCanvas)
        {
            if (destinationCanvas != null && destinationCanvas != startCanvas)
            {
                ResetElement();
                validDragEnd = false;
            }
        }

        if (destinationCanvas == null)
        {
            //We've been dropped off of a canvas
            ResetElement();
            validDragEnd = false;
            Destroy(gameObject);
        }

        if (validDragEnd)
        {
            VRTK.VRTK_UIPointer pointer = GetPointer(eventData);
            if (pointer != null)
            {
                pointer.OnUIPointerElementDragEnd(pointer.SetUIPointerEvent(pointer.pointerEventData.pointerPressRaycast, gameObject));
            }
            OnDraggableItemDropped(SetEventPayload(validDropZone));
        }

        validDropZone = null;
        startParent   = null;
        startCanvas   = null;
    }
        private void Click(VRTK_UIPointer pointer, List <RaycastResult> results)
        {
            switch (pointer.clickMethod)
            {
            case VRTK_UIPointer.ClickMethods.Click_On_Button_Up:
                ClickOnUp(pointer, results);
                break;

            case VRTK_UIPointer.ClickMethods.Click_On_Button_Down:
                ClickOnDown(pointer, results);
                break;
            }
        }
        private void Click(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            pointer.pointerEventData.eligibleForClick = pointer.controller.uiClickPressed;

            if (pointer.pointerEventData.pointerPress)
            {
                if (ShouldIgnoreElement(pointer.pointerEventData.pointerPress, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                {
                    return;
                }

                if (pointer.pointerEventData.eligibleForClick)
                {
                    if (!IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                        pointer.pointerEventData.pointerPress = null;
                    }
                }
                else
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerClickHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                    pointer.pointerEventData.pointerPress = null;
                }
            }
            else if (pointer.pointerEventData.eligibleForClick)
            {
                foreach (var result in results)
                {
                    if (ShouldIgnoreElement(result.gameObject, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                    {
                        continue;
                    }

                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerDownHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pressPosition = pointer.pointerEventData.position;
                        pointer.pointerEventData.pointerPressRaycast = result;
                        pointer.pointerEventData.pointerPress = target;
                        break;
                    }
                }
            }
        }
        private void Click(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            pointer.pointerEventData.eligibleForClick = pointer.controller.uiClickPressed;

            if (pointer.pointerEventData.pointerPress)
            {
                if (pointer.pointerEventData.eligibleForClick)
                {
                    if (!IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                        pointer.pointerEventData.pointerPress = null;
                    }
                }
                else
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerClickHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerPress, pointer.pointerEventData, ExecuteEvents.pointerUpHandler);
                    pointer.pointerEventData.pointerPress = null;
                }
            }
            else if (pointer.pointerEventData.eligibleForClick)
            {
                foreach (var result in results)
                {
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerDownHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pressPosition = pointer.pointerEventData.position;
                        pointer.pointerEventData.pointerPressRaycast = result;
                        pointer.pointerEventData.pointerPress = target;
                        break;
                    }
                }
            }
        }
        private void Hover(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            if (pointer.pointerEventData.pointerEnter)
            {
                if (ShouldIgnoreElement(pointer.pointerEventData.pointerEnter, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                {
                    return;
                }

                if (NoValidCollision(pointer, results))
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
                    pointer.pointerEventData.hovered.Remove(pointer.pointerEventData.pointerEnter);
                    pointer.pointerEventData.pointerEnter = null;
                }
            }
            else
            {
                foreach (var result in results)
                {
                    if (ShouldIgnoreElement(result.gameObject, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                    {
                        continue;
                    }

                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                    if (target != null)
                    {
                        var selectable = target.GetComponent<Selectable>();
                        if (selectable)
                        {
                            var noNavigation = new Navigation();
                            noNavigation.mode = Navigation.Mode.None;
                            selectable.navigation = noNavigation;
                        }

                        pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(target, pointer.hoveringElement));
                        pointer.hoveringElement = target;
                        pointer.pointerEventData.pointerCurrentRaycast = result;
                        pointer.pointerEventData.pointerEnter = target;
                        pointer.pointerEventData.hovered.Add(pointer.pointerEventData.pointerEnter);
                        break;
                    }
                    else
                    {
                        if (result.gameObject != pointer.hoveringElement)
                        {
                            pointer.OnUIPointerElementEnter(pointer.SetUIPointerEvent(result.gameObject, pointer.hoveringElement));
                        }
                        pointer.hoveringElement = result.gameObject;
                    }
                }

                if (pointer.hoveringElement && results.Count == 0)
                {
                    pointer.OnUIPointerElementExit(pointer.SetUIPointerEvent(null, pointer.hoveringElement));
                    pointer.hoveringElement = null;
                }
            }
        }
        private void Drag(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            pointer.pointerEventData.dragging = pointer.controller.uiClickPressed && pointer.pointerEventData.delta != Vector2.zero;

            if (pointer.pointerEventData.pointerDrag)
            {
                if (ShouldIgnoreElement(pointer.pointerEventData.pointerDrag, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                {
                    return;
                }

                if (pointer.pointerEventData.dragging)
                {
                    if (IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    }
                }
                else
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.endDragHandler);
                    foreach (RaycastResult raycast in results)
                    {
                        ExecuteEvents.ExecuteHierarchy(raycast.gameObject, pointer.pointerEventData, ExecuteEvents.dropHandler);
                    }
                    pointer.pointerEventData.pointerDrag = null;
                }
            }
            else if (pointer.pointerEventData.dragging)
            {
                foreach (var result in results)
                {
                    if (ShouldIgnoreElement(result.gameObject, pointer.ignoreCanvasWithTagOrClass, pointer.canvasTagOrScriptListPolicy))
                    {
                        continue;
                    }

                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.initializePotentialDrag);
                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.beginDragHandler);
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pointerDrag = target;
                        break;
                    }
                }
            }
        }
        private void Drag(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            pointer.pointerEventData.dragging = pointer.controller.uiClickPressed && pointer.pointerEventData.delta != Vector2.zero;

            if (pointer.pointerEventData.pointerDrag)
            {
                if (pointer.pointerEventData.dragging)
                {
                    if (IsHovering(pointer))
                    {
                        ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    }
                }
                else
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerDrag, pointer.pointerEventData, ExecuteEvents.endDragHandler);
                    foreach (RaycastResult raycast in results)
                    {
                        ExecuteEvents.ExecuteHierarchy(raycast.gameObject, pointer.pointerEventData, ExecuteEvents.dropHandler);
                    }
                    pointer.pointerEventData.pointerDrag = null;
                }
            }
            else if (pointer.pointerEventData.dragging)
            {
                foreach (var result in results)
                {
                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.initializePotentialDrag);
                    ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.beginDragHandler);
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.dragHandler);
                    if (target != null)
                    {
                        pointer.pointerEventData.pointerDrag = target;
                        break;
                    }
                }
            }
        }
        private void Hover(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            if (pointer.pointerEventData.pointerEnter)
            {
                if (NoValidCollision(pointer, results))
                {
                    ExecuteEvents.ExecuteHierarchy(pointer.pointerEventData.pointerEnter, pointer.pointerEventData, ExecuteEvents.pointerExitHandler);
                    pointer.pointerEventData.hovered.Remove(pointer.pointerEventData.pointerEnter);
                    pointer.pointerEventData.pointerEnter = null;
                }
            }
            else
            {
                foreach (var result in results)
                {
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.pointerEnterHandler);
                    if (target != null)
                    {
                        var selectable = target.GetComponent<Selectable>();
                        if (selectable)
                        {
                            var noNavigation = new Navigation();
                            noNavigation.mode = Navigation.Mode.None;
                            selectable.navigation = noNavigation;
                        }

                        pointer.pointerEventData.pointerCurrentRaycast = result;
                        pointer.pointerEventData.pointerEnter = target;
                        pointer.pointerEventData.hovered.Add(pointer.pointerEventData.pointerEnter);
                        break;
                    }
                }
            }
        }
 private bool IsHovering(VRTK_UIPointer pointer)
 {
     foreach (var hoveredObject in pointer.pointerEventData.hovered)
     {
         if (pointer.pointerEventData.pointerEnter && hoveredObject && CheckTransformTree(hoveredObject.transform, pointer.pointerEventData.pointerEnter.transform))
         {
             return true;
         }
     }
     return false;
 }
 private bool NoValidCollision(VRTK_UIPointer pointer, List<RaycastResult> results)
 {
     return (results.Count == 0 || !CheckTransformTree(results[0].gameObject.transform, pointer.pointerEventData.pointerEnter.transform));
 }
        private void Scroll(VRTK_UIPointer pointer, List<RaycastResult> results)
        {
            pointer.pointerEventData.scrollDelta = pointer.controller.GetTouchpadAxis();
            var scrollWheelVisible = false;
            foreach (RaycastResult result in results)
            {
                if (pointer.pointerEventData.scrollDelta != Vector2.zero)
                {
                    var target = ExecuteEvents.ExecuteHierarchy(result.gameObject, pointer.pointerEventData, ExecuteEvents.scrollHandler);
                    if (target)
                    {
                        scrollWheelVisible = true;
                    }
                }
            }

            if (pointer.controllerRenderModel)
            {
                VRTK_SDK_Bridge.SetControllerRenderModelWheel(pointer.controllerRenderModel, scrollWheelVisible);
            }
        }