public static ZoomOut IsZoomOut(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))
                    {
                        ZoomOut zoomOut = new ZoomOut(CustomGestureType.ZOOM_OUT, frame);
                        return(zoomOut);
                    }
                    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);
        }
        public ZoomOut(CustomGestureType type, Leap.Frame frame)
            : base(type, frame)
        {
            if (other != null)
            {
                if (other.State.Equals(GestureState.NA))
                {
                    _state = GestureState.START;
                }
                else if (other.State.Equals(GestureState.END))
                {
                    _state = GestureState.NA;
                }
                else
                {
                    _state = GestureState.MIDDLE;
                }
            }

            other = this;
        }
        public override void OnFrame(Leap.Controller controller)
        {
            Leap.Frame frame = controller.Frame();

            Leap.InteractionBox interactionBox = frame.InteractionBox;
            _pointerPosition =
                interactionBox.NormalizePoint(frame.Pointables.Frontmost.TipPosition);

            _standardGestures = frame.Gestures();

            foreach (Leap.Gesture gesture in _standardGestures)
            {
                if (gesture.State.Equals(Leap.Gesture.GestureState.STATESTOP))
                {
                    if (gesture.Type.Equals(Leap.Gesture.GestureType.TYPESWIPE))
                    {
                        Print("Finger Swipe Detected");
                        Leap.SwipeGesture       swipe      = new Leap.SwipeGesture(gesture);
                        Events.FingerSwipeEvent swipeEvent = new Events.FingerSwipeEvent(swipe);
                        OnFingerSwipeDetected(swipeEvent);
                    }

                    if (gesture.Type.Equals(Leap.Gesture.GestureType.TYPE_CIRCLE))
                    {
                        Print("Circle Gesture Detected");
                        Leap.CircleGesture circle      = new Leap.CircleGesture(gesture);
                        Events.CircleEvent circleEvent = new Events.CircleEvent(circle);
                        OnCircleDetected(circleEvent);
                    }

                    if (gesture.Type.Equals(Leap.Gesture.GestureType.TYPE_SCREEN_TAP))
                    {
                        Print("Screen Tap Detected");
                        Leap.ScreenTapGesture screenTap      = new Leap.ScreenTapGesture(gesture);
                        Events.ScreenTapEvent screenTapEvent = new Events.ScreenTapEvent(screenTap);
                        OnScreenTapDetected(screenTapEvent);
                    }
                }
            }

            Gestures.HandSwipe handSwipe = Gestures.HandSwipe.IsHandSwipe(frame);
            if (handSwipe != null)
            {
                if (handSwipe.State.Equals(Gestures.GestureState.END))
                {
                    Print("Hand Swipe Detected");

                    Events.HandSwipeEvent swipeEvent = new Events.HandSwipeEvent(handSwipe);
                    OnHandSwipeDetected(swipeEvent);
                }
            }

            Gestures.ZoomIn zoomIn = Gestures.ZoomIn.IsZoomIn(frame);
            if (zoomIn != null)
            {
                if (zoomIn.State.Equals(Gestures.GestureState.END))
                {
                    Print("ZoomIn Detected");

                    Events.ZoomInEvent zoomInEvent = new Events.ZoomInEvent(zoomIn);
                    OnZoomInDetected(zoomInEvent);
                }
            }

            Gestures.ZoomOut zoomOut = Gestures.ZoomOut.IsZoomOut(frame);
            if (zoomOut != null)
            {
                if (zoomOut.State.Equals(Gestures.GestureState.END))
                {
                    Print("ZoomOut Detected");

                    Events.ZoomOutEvent zoomOutEvent = new Events.ZoomOutEvent(zoomOut);
                    OnZoomOutDetected(zoomOutEvent);
                }
            }
        }