/* OnBeginDrag */
 protected override void OnBeginDragImple(ICustomEventData eventData)
 {
     if (thisTopmostScrollerInMotion != null)
     {
         EvaluateDrag(eventData);
         thisUIManager.SetInputHandlingScroller(
             this,
             UIManager.InputName.BeginDrag
             );
         if (thisIsTopmostScrollerInMotion)
         {
             CacheTouchPosition(eventData.position);
         }
         else
         {
             thisTopmostScrollerInMotion.OnBeginDrag(eventData);
         }
     }
     else
     {
         EvaluateDrag(eventData);
         if (thisShouldProcessDrag)
         {
             thisUIManager.SetInputHandlingScroller(this, UIManager.InputName.BeginDrag);
             CacheTouchPosition(eventData.position);
         }
         else
         {
             base.OnBeginDragImple(eventData);
         }
     }
 }
 public override void OnPointerDown(ICustomEventData eventData)
 {
     thisEngine.SetTouchPosition(eventData.position);
     thisEngine.IncrementTouchCounter();
     thisEngine.TouchUIE();
     thisEngine.WaitForTap();
 }
        protected virtual void ProcessSwipe(ICustomEventData eventData)
        {
            if (thisIsEnabledInertia)
            {
                Vector2 nonscaledVelocity = GetNonscaledDeltaPosition(eventData.velocity);
                nonscaledVelocity = CalcAxisCorrectedDeltaPosition(nonscaledVelocity);
                ResetDrag();

                if (InitialVelocityIsOverThreshold(nonscaledVelocity))
                {
                    DisableScrollInputRecursively(this);
                }

                for (int i = 0; i < 2; i++)
                {
                    if (!this.IsOutOfBounds(i))
                    {
                        StartInertialScrollOnAxis(
                            nonscaledVelocity,
                            i
                            );
                    }
                    else
                    {
                        CheckAndPerformStaticBoundarySnapOnAxis(i);
                    }
                }
                CheckAndPerformStaticBoundarySnapFrom(thisProximateParentScroller);
            }
            else
            {
                CheckAndPerformStaticBoundarySnapFrom(this);
            }
        }
Exemple #4
0
        protected override void OnDragImple(ICustomEventData eventData)
        {
            ICustomEventData adjustedData = CreateAdjustedData(eventData);

            base.OnDragImple(adjustedData);
            thisInputManager.OnDrag(eventData);
        }
Exemple #5
0
 void PassOnSwipeUpward(ICustomEventData eventData)
 {
     if (thisParentUIE != null)
     {
         thisParentUIE.OnSwipe(eventData);
     }
 }
Exemple #6
0
 public override void OnDrag(ICustomEventData eventData)
 {
     if (PointerDeltaIsWithinDrawThreshold(eventData.velocity))
     {
         thisEngine.SwitchToDrawingState();
     }
 }
Exemple #7
0
 void PassOnDragUpward(ICustomEventData eventData)
 {
     if (thisParentUIE != null)
     {
         thisParentUIE.OnDrag(eventData);
     }
 }
 public override void OnDrag(ICustomEventData eventData)
 {
     // throw new System.InvalidOperationException("OnDrag should be impossible when pointer is held up, something's wrong");
     thisEngine.OnPointerDown(eventData);
     thisEngine.OnBeginDrag(eventData);
     thisEngine.OnDrag(eventData);
 }
 /* Swipe */
 protected override void OnSwipeImple(ICustomEventData eventData)
 {
     if (!thisIsEvaluatedDrag)
     {
         this.OnBeginDragImple(eventData);
     }
     if (thisShouldProcessDrag)
     {
         thisUIManager.SetInputHandlingScroller(this, UIManager.InputName.Swipe);
         if (thisTopmostScrollerInMotion != null)
         {
             if (thisIsTopmostScrollerInMotion)
             {
                 ProcessSwipe(eventData);
             }
             else
             {
                 thisTopmostScrollerInMotion.OnSwipe(eventData);
                 CheckAndPerformStaticBoundarySnap();
                 ResetDrag();
             }
         }
         else
         {
             ProcessSwipe(eventData);
         }
     }
     else
     {
         base.OnSwipeImple(eventData);
         CheckAndPerformStaticBoundarySnap();
         ResetDrag();
     }
 }
 /* Drag */
 protected override void OnDragImple(ICustomEventData eventData)
 {
     if (thisShouldProcessDrag)
     {
         thisUIManager.SetInputHandlingScroller(this, UIManager.InputName.Drag);
         if (thisTopmostScrollerInMotion != null)
         {
             if (thisIsTopmostScrollerInMotion)
             {
                 DisplaceScrollerElement(eventData.deltaPos);
             }
             else
             {
                 thisTopmostScrollerInMotion.OnDrag(eventData);
             }
         }
         else
         {
             DisplaceScrollerElement(eventData.deltaPos);
         }
     }
     else
     {
         base.OnDragImple(eventData);
     }
 }
Exemple #11
0
 public override void OnDrag(ICustomEventData eventData)
 {
     // throw new System.InvalidOperationException(
     //  "OnDrag: cannot happen while pointer is up"
     // );
     thisEngine.OnTouch(1);
     thisEngine.OnDrag(eventData);
 }
Exemple #12
0
 /* Drag */
 public void OnDrag(ICustomEventData eventData)
 {
     if (this.IsActivated() && thisIsEnabledInput)
     {
         OnDragImple(eventData);
     }
     else
     {
         PassOnDragUpward(eventData);
     }
 }
Exemple #13
0
 protected bool ShouldSwipe(ICustomEventData eventData)
 {
     if (VelocityIsOverSwipeThreshold(eventData.velocity))
     {
         if (EnoughDistanceIsCoveredSinceTouch(eventData.position))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #14
0
        ICustomEventData CreateAdjustedData(ICustomEventData source)
        {
            Vector3 adjustedDeltaPosition = source.deltaPos * thisScrollMultiplier;
            Vector3 adjustedVelocity      = source.velocity * thisScrollMultiplier;

            return(new CustomEventData(
                       source.position,
                       adjustedDeltaPosition,
                       adjustedVelocity,
                       thisUIManager
                       ));
        }
Exemple #15
0
 public override void OnDrag(ICustomEventData eventData)
 {
     if (PointerDeltaIsWithinDrawThreshold(eventData.velocity))
     {
         return;
     }
     else
     {
         thisEngine.HoldDraw();
         thisEngine.SwitchToLookingAroundState();
     }
 }
Exemple #16
0
 protected virtual void ProcessSwipe(ICustomEventData eventData)
 {
     if (thisIsEnabledInertia)
     {
         StartInertialScroll(eventData.velocity);
         CheckAndPerformStaticBoundarySnapFrom(thisProximateParentScroller);
     }
     else
     {
         CheckAndPerformStaticBoundarySnapFrom(this);
     }
 }
Exemple #17
0
        /* Swipe override  */
        protected override void ProcessSwipe(ICustomEventData eventData)
        {
            Vector2 swipeDeltaPos = CalcDragDeltaPos(eventData.deltaPos);

            if (thisSwipeToSnapNext)
            {
                SnapNext(swipeDeltaPos, eventData.velocity);
            }
            else
            {
                base.ProcessSwipe(eventData);
            }
        }
Exemple #18
0
 /* Swipe */
 public void OnSwipe(ICustomEventData eventData)
 {
     if (this.IsActivated() && thisIsEnabledInput)
     {
         if (!(this is IScroller))
         {
             CheckAndPerformStaticBoundarySnapFrom(this);
         }
         OnSwipeImple(eventData);
     }
     else
     {
         PassOnSwipeUpward(eventData);
     }
 }
Exemple #19
0
        public override void OnPointerUp(ICustomEventData eventData)
        {
            thisEngine.WaitForNextTouch();

            PushVelocityStack(eventData.velocity);
            Vector2 velocity = GetAverageVelocity();

            eventData.SetVelocity(velocity);

            if (VelocityIsOverSwipeThreshold(eventData.velocity))
            {
                thisEngine.SwipeUIE(eventData);
            }
            else
            {
                thisEngine.TapUIE();
            }
        }
        public override void OnPointerUp(ICustomEventData eventData)
        {
            thisEngine.WaitForNextTouch();

            PushVelocityStack(eventData.velocity);
            Vector2 velocity = GetAverageVelocity();

            eventData.SetVelocity(velocity);

            if (this.ShouldSwipe(eventData))
            {
                thisEngine.SwipeUIE(eventData);
            }
            else
            {
                thisEngine.TapUIE();
            }

            thisEngine.ClearTouchPosition();
        }
Exemple #21
0
        /* Swipe override  */
        protected override void ProcessSwipe(ICustomEventData eventData)
        {
            Vector2 swipeDeltaPos = CalcDragDeltaPos(eventData.deltaPos);

            if (thisSwipeToSnapNext)
            {
                SnapNext(swipeDeltaPos, eventData.velocity);
            }
            else
            {
                if (thisIsEnabledInertia)
                {
                    StartInertialScroll(eventData.velocity);
                    CheckAndPerformStaticBoundarySnapFrom(thisProximateParentScroller);
                }
                else
                {
                    CheckAndPerformStaticBoundarySnapFrom(this);
                }
            }
        }
Exemple #22
0
 public override void OnPointerExit(ICustomEventData eventData)
 {
     return;
 }
Exemple #23
0
 public override void OnBeginDrag(ICustomEventData eventData)
 {
     throw new System.InvalidOperationException("OnBeginDrag should not be called while pointer is held up");
 }
Exemple #24
0
 public override void OnPointerUp(ICustomEventData eventData)
 {
     throw new System.InvalidOperationException("OnPointerUp should not be called while pointer is already held up");
 }
Exemple #25
0
 public abstract void OnPointerExit(ICustomEventData eventData);
Exemple #26
0
 public abstract void OnDrag(ICustomEventData eventData);
Exemple #27
0
 public abstract void OnPointerDown(ICustomEventData eventData);
 public void OnPointerExit(ICustomEventData eventData)
 {
     thisCurState.OnPointerExit(eventData);
 }
 public void OnDrag(ICustomEventData eventData)
 {
     thisCurState.OnDrag(eventData);
 }
 // float thisSwipeVelocityThreshold = 200f;
 /* IRawInputHandler */
 public void OnPointerDown(ICustomEventData eventData)
 {
     thisCurState.OnPointerDown(eventData);
 }