Esempio n. 1
0
        internal void INTERNAL_TouchCancelled(TouchPoint touch)
        {
            var total = numTouches - 1;

            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0)
                {
                    touchesNumState = TouchesNumState.PassedMinThreshold;
                }
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches)
                    {
                        touchesNumState = TouchesNumState.PassedMinThreshold;
                    }
                }
                // last event we already were under minTouches
                else
                {
                    touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold)
                        {
                            touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        }
                        // this event we crossed maxTouches
                        else
                        {
                            touchesNumState = TouchesNumState.PassedMaxThreshold;
                        }
                    }
                    // last event we already were over maxTouches
                    else
                    {
                        touchesNumState = TouchesNumState.TooMany;
                    }
                }
            }

            activeTouches.Remove(touch);
            numTouches = total;
            touchCancelled(touch);
        }
Esempio n. 2
0
        internal void INTERNAL_TouchesBegan(IList <ITouch> touches)
        {
            var count = touches.Count;
            var total = numTouches + count;

            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // minTouches is not set and we got our first touches
                if (numTouches == 0)
                {
                    touchesNumState = TouchesNumState.PassedMinThreshold;
                }
            }
            else
            {
                if (numTouches < minTouches)
                {
                    // had < minTouches, got >= minTouches
                    if (total >= minTouches)
                    {
                        touchesNumState = TouchesNumState.PassedMinThreshold;
                    }
                    else
                    {
                        touchesNumState = TouchesNumState.TooFew;
                    }
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches <= maxTouches)
                {
                    if (total > maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold)
                        {
                            touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        }
                        // this event we crossed maxTouches
                        else
                        {
                            touchesNumState = TouchesNumState.PassedMaxThreshold;
                        }
                    }
                }
                // last event we already were over maxTouches
                else
                {
                    touchesNumState = TouchesNumState.TooMany;
                }
            }

            activeTouches.AddRange(touches);
            numTouches = total;
            touchesBegan(touches);
        }
Esempio n. 3
0
 internal void INTERNAL_Reset()
 {
     activeTouches.Clear();
     numTouches            = 0;
     delayedStateChange    = GestureState.Possible;
     touchesNumState       = TouchesNumState.TooFew;
     requiredGestureFailed = false;
     reset();
 }
Esempio n. 4
0
 internal void INTERNAL_TouchMoved(TouchPoint touch)
 {
     touchesNumState = TouchesNumState.InRange;
     if (minTouches > 0 && numTouches < minTouches)
     {
         touchesNumState = TouchesNumState.TooFew;
     }
     if (maxTouches > 0 && touchesNumState == TouchesNumState.InRange && numTouches > maxTouches)
     {
         touchesNumState = TouchesNumState.TooMany;
     }
     touchMoved(touch);
 }
Esempio n. 5
0
 internal void INTERNAL_TouchesMoved(IList <ITouch> touches)
 {
     touchesNumState = TouchesNumState.InRange;
     if (minTouches > 0 && numTouches < minTouches)
     {
         touchesNumState = TouchesNumState.TooFew;
     }
     if (maxTouches > 0 && touchesNumState == TouchesNumState.InRange && numTouches > maxTouches)
     {
         touchesNumState = TouchesNumState.TooMany;
     }
     touchesMoved(touches);
 }
Esempio n. 6
0
        internal void INTERNAL_TouchBegan(TouchPoint touch)
        {
            if (numTouches == 0)
            {
                layer = touch.Layer;
            }

            var total = numTouches + 1;

            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // minTouches is not set and we got our first touches
                if (numTouches == 0)
                {
                    touchesNumState = TouchesNumState.PassedMinThreshold;
                }
            }
            else
            {
                if (numTouches < minTouches)
                {
                    // had < minTouches, got >= minTouches
                    if (total >= minTouches)
                    {
                        touchesNumState = TouchesNumState.PassedMinThreshold;
                    }
                    else
                    {
                        touchesNumState = TouchesNumState.TooFew;
                    }
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches <= maxTouches)
                {
                    if (total > maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold)
                        {
                            touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        }
                        // this event we crossed maxTouches
                        else
                        {
                            touchesNumState = TouchesNumState.PassedMaxThreshold;
                        }
                    }
                }
                // last event we already were over maxTouches
                else
                {
                    touchesNumState = TouchesNumState.TooMany;
                }
            }

            if (state == GestureState.Began || state == GestureState.Changed)
            {
                touch.INTERNAL_Retain();
            }

            activeTouches.Add(touch);
            numTouches = total;
            touchBegan(touch);
        }
Esempio n. 7
0
        internal void INTERNAL_TouchCancelled(TouchPoint touch)
        {
            var total = numTouches - 1;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                }
                // last event we already were under minTouches
                else touchesNumState = TouchesNumState.TooFew;
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                    // last event we already were over maxTouches
                    else touchesNumState = TouchesNumState.TooMany;
                }
            }

            activeTouches.Remove(touch);
            numTouches = total;
            touchCancelled(touch);
        }
Esempio n. 8
0
        internal void INTERNAL_TouchEnded(TouchPoint touch)
        {
            var total = numTouches - 1;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                }
                // last event we already were under minTouches
                else touchesNumState = TouchesNumState.TooFew;
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                    // last event we already were over maxTouches
                    else touchesNumState = TouchesNumState.TooMany;
                }
            }

            activeTouches.Remove(touch);
            numTouches = total;

            if (combineTouches)
            {
                touchSequence.Add(touch);

                if (NumTouches == 0)
                {
                    // Checking which points were removed in clusterExistenceTime seconds to set their centroid as cached screen position
                    var cluster = touchSequence.FindElementsLaterThan(Time.time - combineTouchesInterval,
                        shouldCacheTouchPosition);
                    cachedScreenPosition = ClusterUtils.Get2DCenterPosition(cluster);
                    cachedPreviousScreenPosition = ClusterUtils.GetPrevious2DCenterPosition(cluster);
                }
            }
            else
            {
                if (NumTouches == 0)
                {
                    if (shouldCacheTouchPosition(touch))
                    {
                        cachedScreenPosition = touch.Position;
                        cachedPreviousScreenPosition = touch.PreviousPosition;
                    }
                    else
                    {
                        cachedScreenPosition = TouchManager.INVALID_POSITION;
                        cachedPreviousScreenPosition = TouchManager.INVALID_POSITION;
                    }
                }
            }

            touchEnded(touch);
        }
Esempio n. 9
0
 internal void INTERNAL_TouchMoved(TouchPoint touch)
 {
     touchesNumState = TouchesNumState.InRange;
     if (minTouches > 0 && numTouches < minTouches) touchesNumState = TouchesNumState.TooFew;
     if (maxTouches > 0 && touchesNumState == TouchesNumState.InRange && numTouches > maxTouches) touchesNumState = TouchesNumState.TooMany;
     touchMoved(touch);
 }
Esempio n. 10
0
 internal void INTERNAL_Reset()
 {
     activeTouches.Clear();
     numTouches = 0;
     delayedStateChange = GestureState.Possible;
     touchesNumState = TouchesNumState.TooFew;
     requiredGestureFailed = false;
     reset();
 }
Esempio n. 11
0
        internal void INTERNAL_TouchesCancelled(IList<ITouch> touches)
        {
            var count = touches.Count;
            var total = numTouches - count;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                }
                // last event we already were under minTouches
                else touchesNumState = TouchesNumState.TooFew;
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                    // last event we already were over maxTouches
                    else touchesNumState = TouchesNumState.TooMany;
                }
            }

            for (var i = 0; i < count; i++) activeTouches.Remove(touches[i]);
            numTouches = total;
            touchesCancelled(touches);
        }
Esempio n. 12
0
 internal void INTERNAL_TouchesMoved(IList<ITouch> touches)
 {
     touchesNumState = TouchesNumState.InRange;
     if (minTouches > 0 && numTouches < minTouches) touchesNumState = TouchesNumState.TooFew;
     if (maxTouches > 0 && touchesNumState == TouchesNumState.InRange && numTouches > maxTouches) touchesNumState = TouchesNumState.TooMany;
     touchesMoved(touches);
 }
Esempio n. 13
0
        internal void INTERNAL_TouchesBegan(IList<ITouch> touches)
        {
            var count = touches.Count;
            var total = numTouches + count;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // minTouches is not set and we got our first touches
                if (numTouches == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches < minTouches)
                {
                    // had < minTouches, got >= minTouches
                    if (total >= minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                    else touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches <= maxTouches)
                {
                    if (total > maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                }
                // last event we already were over maxTouches
                else touchesNumState = TouchesNumState.TooMany;
            }

            activeTouches.AddRange(touches);
            numTouches = total;
            touchesBegan(touches);
        }
Esempio n. 14
0
        internal void INTERNAL_TouchesCancelled(IList <ITouch> touches)
        {
            var count = touches.Count;
            var total = numTouches - count;

            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0)
                {
                    touchesNumState = TouchesNumState.PassedMinThreshold;
                }
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches)
                    {
                        touchesNumState = TouchesNumState.PassedMinThreshold;
                    }
                }
                // last event we already were under minTouches
                else
                {
                    touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold)
                        {
                            touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        }
                        // this event we crossed maxTouches
                        else
                        {
                            touchesNumState = TouchesNumState.PassedMaxThreshold;
                        }
                    }
                    // last event we already were over maxTouches
                    else
                    {
                        touchesNumState = TouchesNumState.TooMany;
                    }
                }
            }

            for (var i = 0; i < count; i++)
            {
                activeTouches.Remove(touches[i]);
            }
            numTouches = total;
            touchesCancelled(touches);
        }
Esempio n. 15
0
        internal void INTERNAL_TouchEnded(TouchPoint touch)
        {
            var total = numTouches - 1;

            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // have no touches
                if (total == 0)
                {
                    touchesNumState = TouchesNumState.PassedMinThreshold;
                }
            }
            else
            {
                if (numTouches >= minTouches)
                {
                    // had >= minTouches, got < minTouches
                    if (total < minTouches)
                    {
                        touchesNumState = TouchesNumState.PassedMinThreshold;
                    }
                }
                // last event we already were under minTouches
                else
                {
                    touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches > maxTouches)
                {
                    if (total <= maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold)
                        {
                            touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        }
                        // this event we crossed maxTouches
                        else
                        {
                            touchesNumState = TouchesNumState.PassedMaxThreshold;
                        }
                    }
                    // last event we already were over maxTouches
                    else
                    {
                        touchesNumState = TouchesNumState.TooMany;
                    }
                }
            }

            activeTouches.Remove(touch);
            numTouches = total;

            if (combineTouches)
            {
                touchSequence.Add(touch);

                if (NumTouches == 0)
                {
                    // Checking which points were removed in clusterExistenceTime seconds to set their centroid as cached screen position
                    var cluster = touchSequence.FindElementsLaterThan(Time.time - combineTouchesInterval,
                                                                      shouldCacheTouchPosition);
                    cachedScreenPosition         = ClusterUtils.Get2DCenterPosition(cluster);
                    cachedPreviousScreenPosition = ClusterUtils.GetPrevious2DCenterPosition(cluster);
                }
            }
            else
            {
                if (NumTouches == 0)
                {
                    if (shouldCacheTouchPosition(touch))
                    {
                        cachedScreenPosition         = touch.Position;
                        cachedPreviousScreenPosition = touch.PreviousPosition;
                    }
                    else
                    {
                        cachedScreenPosition         = TouchManager.INVALID_POSITION;
                        cachedPreviousScreenPosition = TouchManager.INVALID_POSITION;
                    }
                }
            }

            touchEnded(touch);
        }
Esempio n. 16
0
        internal void INTERNAL_TouchBegan(TouchPoint touch)
        {
            if (numTouches == 0) layer = touch.Layer;

            var total = numTouches + 1;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // minTouches is not set and we got our first touches
                if (numTouches == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches < minTouches)
                {
                    // had < minTouches, got >= minTouches
                    if (total >= minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                    else touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches <= maxTouches)
                {
                    if (total > maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                }
                // last event we already were over maxTouches
                else touchesNumState = TouchesNumState.TooMany;
            }

            if (state == GestureState.Began || state == GestureState.Changed) touch.INTERNAL_Retain();

            activeTouches.Add(touch);
            numTouches = total;
            touchBegan(touch);
        }
Esempio n. 17
0
        internal void INTERNAL_TouchesBegan(IList<TouchPoint> touches)
        {
            if (numTouches == 0) layer = touches[0].Layer;

            var count = touches.Count;
            var total = numTouches + count;
            touchesNumState = TouchesNumState.InRange;

            if (minTouches <= 0)
            {
                // minTouches is not set and we got our first touches
                if (numTouches == 0) touchesNumState = TouchesNumState.PassedMinThreshold;
            }
            else
            {
                if (numTouches < minTouches)
                {
                    // had < minTouches, got >= minTouches
                    if (total >= minTouches) touchesNumState = TouchesNumState.PassedMinThreshold;
                    else touchesNumState = TouchesNumState.TooFew;
                }
            }

            if (maxTouches > 0)
            {
                if (numTouches <= maxTouches)
                {
                    if (total > maxTouches)
                    {
                        // this event we crossed both minTouches and maxTouches
                        if (touchesNumState == TouchesNumState.PassedMinThreshold) touchesNumState = TouchesNumState.PassedMinMaxThreshold;
                        // this event we crossed maxTouches
                        else touchesNumState = TouchesNumState.PassedMaxThreshold;
                    }
                }
                // last event we already were over maxTouches
                else touchesNumState = TouchesNumState.TooMany;
            }

            if (state == GestureState.Began || state == GestureState.Changed)
            {
                for (var i = 0; i < count; i++) touches[i].INTERNAL_Retain();
            }

            activeTouches.AddRange(touches);
            numTouches = total;
            touchesBegan(touches);
        }