示例#1
0
        public VisualButton Assign(TouchGestureType gesture)
        {
            // Should it replace the assignment?
            this.mappingGestures.Add(gesture);

            return this;
        }
示例#2
0
 public TouchGestureEventArgs(TouchGesture direction)
 {
     this.m_direction  = direction;
     this.m_handled    = false;
     this.m_difference = 0;
     this.m_type       = TouchGestureType.Gesture;
 }
示例#3
0
        public InputEvent Assign(TouchGestureType gesture)
        {
            // Should it replace the assignment?
            this.mappingGestures.Add(gesture);

            return this;
        }
示例#4
0
 public TouchGestureEventArgs(TouchGesture direction)
 {
     this.m_direction = direction;
     this.m_handled = false;
     this.m_difference = 0;
     this.m_type = TouchGestureType.Gesture;
 }
示例#5
0
 public TouchGesture(TouchGestureType gestureType, Vector position, Vector position2, Vector delta, Vector delta2)
 {
     this.GestureType = gestureType;
     this.Position = position;
     this.Position2 = position2;
     this.Delta = delta;
     this.Delta2 = delta2;
 }
示例#6
0
        /// <summary>
        /// Recognize the gesture by the tracked data
        /// </summary>
        /// <returns>the type of gesture, if recognized</returns>
        private TouchGestureType InterpretGesture()
        {
            TouchGestureType resultType = TouchGestureType.None;

            if (pointTracker.Count == 2)
            {
                resultType = TouchGestureType.Pinch;
            }
            else if (pointTracker.Count == 1)
            {
                IEnumerator it = pointTracker.Values.GetEnumerator();
                if (!it.MoveNext())
                {
                    resultType = TouchGestureType.SingleTap;
                }
                else
                {
                    List <Point> points = (List <Point>)it.Current;

                    // get first and last point from the list of points
                    if (points != null)
                    {
                        Point firstPoint = points[0];
                        Point lastPoint  = points[points.Count - 1];

                        // horizontal and vertical movement
                        double deltaX = lastPoint.X - firstPoint.X;
                        double deltaY = lastPoint.Y - firstPoint.Y;

                        // Update the left & right moving edge
                        if (deltaX > 0 && deltaX > MaxRightPosition)
                        {
                            MaxRightPosition = deltaX;
                        }
                        else if (deltaX < 0 && deltaX < MaxLeftPosition)
                        {
                            MaxLeftPosition = deltaX;
                        }

                        // check if distance traveled on X and Y axis is more the minimum
                        // gesture length specified above
                        if (Math.Abs(deltaY) > MinimumMove && Math.Abs(deltaY) > Math.Abs(deltaX))
                        {
                            // if yDiff is negative, we moved upwards
                            resultType = (deltaY > 0) ? TouchGestureType.MoveTopToBottom : TouchGestureType.MoveBottomToUp;
                        }

                        if (Math.Abs(deltaX) > MinimumMove && Math.Abs(deltaX) > Math.Abs(deltaY))
                        {
                            // if xDiff is negative, we moved left
                            resultType = (deltaX > 0) ? TouchGestureType.MoveLeftToRight : TouchGestureType.MoveRightToLeft;
                        }
                    }
                }
            }

            return(resultType);
        }
        public TouchGestureType GetGestureType(GestureRecognizer gesture)
        {
            TouchGestureType retGestureType = TouchGestureType.INVALID;

            if (null != gesture)
            {
                for (int i = 0; i < m_gestures.Length; ++i)
                {
                    if (gesture == m_gestures[i])
                    {
                        retGestureType = (TouchGestureType)i;
                        Debug.Assert(retGestureType < TouchGestureType.COUNT);
                        break;
                    }
                }
            }
            return(retGestureType);
        }
        //This function will return the gesture if Active and ahead of the ifBeforeTheseTypes gestures in the active queue.
        public GestureRecognizer GetActiveGesture(TouchGestureType type, params TouchGestureType[] ifBeforeTheseTypes)
        {
            Debug.Assert(type < TouchGestureType.COUNT);

            GestureRecognizer retGesture = null;

            if (TouchGestureType.CONTINUOUS_START <= type && type <= TouchGestureType.CONTINUOUS_END)
            {
                //Continuous Gestures need to be tested through the queue.
                for (int i = 0; i < m_ActiveGestureList.Count; ++i)
                {
                    TouchGestureType activeType = GetGestureType(m_ActiveGestureList[i]);

                    bool foundUnwanted = false;
                    for (int j = 0; !foundUnwanted && j < ifBeforeTheseTypes.Length; ++j)
                    {
                        foundUnwanted |= ifBeforeTheseTypes[j] == activeType;
                    }

                    if (foundUnwanted)
                    {
                        break;
                    }
                    else if (type == activeType)
                    {
                        retGesture = m_ActiveGestureList[i];
                        break;
                    }
                }
            }
            else
            {
                //User Requested a discrete gesture. Don't use the active gesture list.  Returning if active.
                retGesture = m_gestures[(int)type].IsValidated ? m_gestures[(int)type] : null;
            }
            return(retGesture);
        }
示例#9
0
 public Gesture(TouchGestureType val)
 {
     Value = val;
 }
示例#10
0
 public TouchGesture()
 {
     _gestureType = TouchGestureType.NONE;
     _metaData    = null;
 }
示例#11
0
 public TouchGesture(TouchGestureType gestureType)
 {
     this.GestureType = gestureType;
 }
示例#12
0
 public TouchGestureEventArgs(long id, TouchGestureType type, SKPoint data)
 {
     Id   = id;
     Type = type;
     Data = data;
 }