Exemple #1
0
        private void HandleScrollingState()
        {
            // Update current touch point.
            bool touchPositionChanged = UpdateCurrentTouchpoint();

            if (touchInfo.touchUp || !(touchInfo.isTouching)) // Gesture ends.
            {
                Gesture scrollEnd = new Gesture();
                scrollEnd.type = Type.SCROLL_END;
                UpdateGesture(ref scrollEnd);
                GestureList.Add(scrollEnd);

                if (SwipeDetected()) // Gesture ends with a swipe.
                {
                    Gesture swipe = new Gesture();
                    swipe.type = Type.SWIPE;
                    UpdateGesture(ref swipe);

                    // Set the displacement of swipe to zero.
                    swipe.displacement = Vector2.zero;
                    GestureList.Add(swipe);

                    if (Verbose)
                    {
                        Debug.Log("A swipe gesture is detected.");
                    }
                }
                Reset();
                if (Verbose)
                {
                    Debug.Log("Gesture detection ends");
                }
            }
            else if (touchPositionChanged) // User continues scrolling and there is
            // a change in touch position.
            {
                Gesture scrollUpdate = new Gesture();
                scrollUpdate.type = Type.SCROLL_UPDATE;
                UpdateGesture(ref scrollUpdate);
                GestureList.Add(scrollUpdate);
            }
        }
        private void AddGesture()
        {
            var eyeGesture = new EyeGesture()
            {
                Steps = new ObservableCollection <EyeGestureStep>()
                {
                    new EyeGestureStep()
                }
            };

            if (GestureList != null)
            {
                GestureList.Add(eyeGesture);
            }
            else
            {
                GestureList = new ObservableCollection <EyeGesture>()
                {
                    eyeGesture
                }
            };

            EyeGesture = eyeGesture;
        }
Exemple #3
0
        private void HandleDetectingState()
        {
            // user lifts up finger from touch pad.
            if (touchInfo.touchUp || !(touchInfo.isTouching))
            {
                Reset();
                return;
            }

            // Touch position is changed and the touch point moves outside of slop.
            if (UpdateCurrentTouchpoint() && touchInfo.isTouching &&
                !InSlop(touchInfo.touchPoint.position))
            {
                state = State.SCROLLING;
                Gesture gesture = new Gesture();
                gesture.type = Type.SCROLL_START;
                UpdateGesture(ref gesture);
                GestureList.Add(gesture);
                if (Verbose)
                {
                    Debug.Log("Gesture detection starts");
                }
            }
        }