KeyTapGestureΒΆ
Methods:
The KeyTapGesture class represents a tapping gesture by a finger or tool.
A key tap gesture is recognized when the tip of a finger rotates down toward the palm and then springs back to approximately the original position, as if tapping. The tapping finger must pause briefly before beginning the tap.
Important: To use key tap gestures in your application, you must enable recognition of the key tap gesture. You can enable recognition with:
controller.enableGesture(Leap::Gesture::TYPE_KEY_TAP);Key tap gestures are discrete. The KeyTapGesture object representing a tap always has the state, STATE_STOP. Only one KeyTapGesture object is created for each key tap gesture recognized.
You can set the minimum finger movement and velocity required for a movement to be recognized as a key tap as well as adjust the detection window for evaluating the movement using the config attribute of a connected Controller object. Use the following configuration keys to configure key tap recognition:
Key string Value type Default value Units Gesture.KeyTap.MinDownVelocity float 50 mm/s Gesture.KeyTap.HistorySeconds float 0.1 s Gesture.KeyTap.MinDistance float 3.0 mm The following example demonstrates how to set the key tap configuration parameters:
controller.config().setFloat("Gesture.KeyTap.MinDownVelocity", 40.0); controller.config().setFloat("Gesture.KeyTap.HistorySeconds", .2); controller.config().setFloat("Gesture.KeyTap.MinDistance", 8.0); 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.
Leap::Vector tapDirection = keytap.direction();
- Return
- Vector A unit direction vector if the finger tip is moving; otherwise, a zero-vector.
- Since
- 1.0
KeyTapGesture()Constructs a new KeyTapGesture object.
An uninitialized KeyTapGesture object is considered invalid. Get valid instances of the KeyTapGesture class from a Frame object.
- Since
- 1.0
KeyTapGesture(const Gesture & rhs)Constructs a KeyTapGesture object from an instance of the Gesture class.
Leap::KeyTapGesture keytapGesture = Leap::Gesture::invalid(); if(gesture.type() == Leap::KeyTapGesture::classType()) keytapGesture = Leap::KeyTapGesture(gesture);
- Since
- 1.0
- Parameters
- rhs -
The Gesture instance to specialize. This Gesture instance must be a KeyTapGesture object.
Pointable pointable()The finger performing the key tap gesture.
Leap::Pointable tappingPointable = keytap.pointable();Vector position()The position where the key tap is registered.
Leap::Vector tapPosition = keytap.position();float progress()The progress value is always 1.0 for a key tap gesture.
- Return
- float The value 1.0.
- Since
- 1.0
Type classType()The key tap gesture type.
if(gesture.type() == Leap::KeyTapGesture::classType()) Leap::KeyTapGesture keytapGesture = Leap::KeyTapGesture(gesture);
- Return
- Type The type value designating a key tap gesture.
- Since
- 1.0
