ScreenTapGestureΒΆ
Methods:
The ScreenTapGesture class represents a tapping gesture by a finger or tool.
A screen tap gesture is recognized when the tip of a finger pokes forward and then springs back to approximately the original position, 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.enableGesture(Gesture.Type.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 screen tap configuration parameters:
controller.config().setFloat("Gesture.ScreenTap.MinForwardVelocity", 30.0f); controller.config().setFloat("Gesture.ScreenTap.HistorySeconds", .5f); controller.config().setFloat("Gesture.ScreenTap.MinDistance", 1.0f); controller.config().save();The Controller object must be connected to the Leap Motion service/daemon before setting the configuration parameters.
Public Functions
- Since
- 1.0
Public Static FunctionsVector direction()The direction of finger tip motion.
Vector pokeDirection = screentap.direction();
- Return
- Vector A unit direction vector.
- Since
- 1.0
Pointable pointable()Vector position()float progress()The progress value is always 1.0 for a screen tap gesture.
- Return
- float The value 1.0.
- Since
- 1.0
ScreenTapGesture()Constructs a new ScreenTapGesture object.
An uninitialized ScreenTapGesture object is considered invalid. Get valid instances of the ScreenTapGesture class from a Frame object.
- Since
- 1.0
ScreenTapGesture(Gesture rhs)Constructs a ScreenTapGesture object from an instance of the Gesture class.
if(gesture.type() == Gesture.Type.TYPE_SCREEN_TAP) { ScreenTapGesture screentapGesture = new ScreenTapGesture(gesture); }
- Since
- 1.0
- Parameters
- rhs -
The Gesture instance to specialize. This Gesture instance must be a ScreenTapGesture object.
Gesture.Type classType()The screen tap gesture type.
if(gesture.type() == ScreenTapGesture.classType()) { ScreenTapGesture screentapGesture = new ScreenTapGesture(gesture); }
- Return
- Type The type value designating a screen tap gesture.
- Since
- 1.0
