Example #1
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);
        }
Example #2
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);
        }