예제 #1
0
 public CustomGesture(CustomGestureType type, Leap.Frame frame)
 {
     _type                 = type;
     _handsForGesture      = frame.Hands;
     _pointablesForGesture = frame.Pointables;
     _state                = GestureState.NA;
 }
예제 #2
0
        public static ZoomIn IsZoomIn(Leap.Frame frame)
        {
            if (frame.IsValid)
            {
                Leap.HandList hands = frame.Hands;

                if ((hands[0].IsValid && hands[1].IsValid) && handsTogether(hands[0], hands[1]))
                {
                    if ((hands.Leftmost.PalmVelocity.x < -500) && (hands.Rightmost.PalmVelocity.x > 500))
                    {
                        ZoomIn zoomIn = new ZoomIn(CustomGestureType.ZOOM_IN, frame);
                        return(zoomIn);
                    }
                    else if (other != null)
                    {
                        if (other.State.Equals(GestureState.END) || other.State.Equals(GestureState.NA))
                        {
                            other._state = GestureState.NA;
                            return(other);
                        }
                        else
                        {
                            other._state = GestureState.END;
                            return(other);
                        }
                    }
                }
            }

            return(null);
        }
예제 #3
0
        public static HandSwipe IsHandSwipe(Leap.Frame frame)
        {
            if (frame.IsValid)
            {
                Leap.HandList hands = frame.Hands;

                if ((hands[0].IsValid && hands[1].IsValid) && handsTogether(hands[0], hands[1]))
                {
                    return(null);
                }

                if (Math.Abs(hands.Frontmost.PalmVelocity.x) > 900)
                {
                    HandSwipe handSwipe = new HandSwipe(CustomGestureType.HAND_SWIPE, frame);
                    return(handSwipe);
                }
                else if ((other != null))
                {
                    if (other.State.Equals(GestureState.END) || other.State.Equals(GestureState.NA))
                    {
                        other._state = GestureState.NA;
                        return(other);
                    }
                    else
                    {
                        other._state = GestureState.END;
                        return(other);
                    }
                }
            }

            return(null);
        }