ScreenTapGesture¶
Attributes:
- class Leap.ScreenTapGesture¶
Extends Leap.Gesture.
A screen tap gesture is recognized when the tip of a finger pokes forward and then springs back to approximately the original postion, as if tapping a vertical screen. The tapping finger must pause briefly before beginning the tap.
Important: To use screen tap gestures in your application, you must enable recognition of the screen tap gesture. You can enable recognition with:
controller.enable_gesture(Leap.Gesture.TYPE_SCREEN_TAP)
ScreenTap gestures are discrete. The ScreenTapGesture object representing a tap always has the state, STATE_STOP. Only one ScreenTapGesture object is created for each screen tap gesture recognized.
You can set the minimum finger movement and velocity required for a movement to be recognized as a screen tap as well as adjust the detection window for evaluating the movement using the config attribute of a connected Controller object. Use the following keys to configure screen tap recognition:
Key string Value type Default value Units Gesture.ScreenTap.MinForwardVelocity float 50 mm/s Gesture.ScreenTap.HistorySeconds float 0.1 s Gesture.ScreenTap.MinDistance float 5.0 mm The following example demonstrates how to set the key tap configuration parameters:
controller.config.set("Gesture.ScreenTap.MinForwardVelocity", 30.0) controller.config.set("Gesture.ScreenTap.HistorySeconds", .5) controller.config.set("Gesture.ScreenTap.MinDistance", 1.0) controller.config.save()
New in version 1.0.
- classmethod ScreenTapGesture([gesture])¶
Constructs a ScreenTapGesture object from an instance of the Gesture class.
for gesture in frame.gestures(): if gesture.type is Leap.Gesture.TYPE_SCREEN_TAP: screen_tap = Leap.ScreenTapGesture(gesture)
Parameters: gesture (Gesture) – The Gesture instance to specialize. This Gesture instance must be a ScreenTapGesture object. If no argument is supplied, an invalid ScreenTapGesture object is created. New in version 1.0.
- position¶
Type: Vector The position where the screen tap is registered.
tap_point = screen_tap.position
New in version 1.0.
- direction¶
Type: Vector The direction of finger tip motion. If the finger is stationary, at the time this gesture object is recorded, then the direction will be a zero vector.
tap_direction = screen_tap.direction
New in version 1.0.
- progress¶
Type: float The progess value is always 1.0 for a screen tap gesture.
New in version 1.0.
- classmethod class_type()¶
Type: integer The screen tap gesture type designator: Gesture.TYPE_SCREEN_TAP
New in version 1.0.