예제 #1
0
 public virtual void OnUIPointerElementDragEnd(VRTK4UIPointerEventArgs e)
 {
     if (UIPointerElementDragEnd != null)
     {
         UIPointerElementDragEnd(this, e);
     }
 }
예제 #2
0
        public virtual void OnUIPointerElementEnter(VRTK4UIPointerEventArgs e)
        {
            if (e.currentTarget != currentTarget)
            {
                ResetHoverTimer();
            }

            if (clickAfterHoverDuration > 0f && hoverDurationTimer <= 0f)
            {
                canClickOnHover    = true;
                hoverDurationTimer = clickAfterHoverDuration;
            }

            currentTarget = e.currentTarget;
            IsValidStateForClickFromHover = true;
            if (pointerEventData.pointerPress != null && pointerEventData.pointerPress != currentTarget)
            {
                IsValidStateForClickFromHover = false;
            }

            if (UIPointerElementEnter != null)
            {
                UIPointerElementEnter(this, e);
            }
        }
예제 #3
0
        public virtual void OnUIPointerElementClick(VRTK4UIPointerEventArgs e)
        {
            if (e.currentTarget == currentTarget)
            {
                ResetHoverTimer();
            }

            if (IsValidStateForClickFromHover && !ExplicitBlockClickOnce)
            {
                if (UIPointerElementClick != null)
                {
                    UIPointerElementClick(this, e);
                }
            }
        }
예제 #4
0
        public virtual void OnUIPointerElementExit(VRTK4UIPointerEventArgs e)
        {
            if (e.previousTarget == currentTarget)
            {
                ResetHoverTimer();
            }

            ExplicitBlockClickOnce        = false;
            IsValidStateForClickFromHover = false;
            if (UIPointerElementExit != null)
            {
                UIPointerElementExit(this, e);

                if (attemptClickOnDeactivate && !e.isActive && e.previousTarget)
                {
                    if (pointerEventData == null)
                    {
                        pointerEventData = new PointerEventData(EventSystem.current);
                    }

                    pointerEventData.pointerPress = e.previousTarget;
                }
            }
        }