protected virtual void OnHandSwipeDetected(Events.HandSwipeEvent swipe) { EventHandler <Events.HandSwipeEvent> handler = HandSwipeDetected; if (handler != null) { Print("Hand Swipe Event Called"); handler(this, swipe); } }
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); } } }