Extends Gesture

Gesture.Tap

A discrete gesture recognizer for single and multiple taps. For the gesture to be recognized, the specified number of fingers must tap the item a specified number of times.

Item {
    with Gesture.Tap {
        tapsRequired: 3
        touchesRequired: 2

        on tapped {
            System.log("A two-finger triple-tap!")
        }
    }
}

event tapped(Vec2 point)

Event emitted when the tap is recognized.

property Int tapsRequired: 1

property Int touchesRequired: 1

Configures the number of taps and number of fingers per-tap required.

For example, to register a double tap set tapsRequired to 2. Likewise, to require a three-finger tap, set touchesRequired to 3.

By default, both tapsRequired and touchesRequired are 1, for recognizing a single finger tap.

property Bool isPressedread only

The isPressed property will be true when the gesture is being pressed and is still eligible to become a tap.

This property is useful for giving visual feedback that an active area has been touched before the tap is registered. In the case of multi-tap or multi-touch gestures, isPressed will become true for the first touch of each tap.

property Bool isTouchedread only

In the Default tapStyle isTouched is always equal to isPressed.

In the Button tapStyle, the isTouched property will be true when the gesture is being pressed, and the touch points are still inside the gesture area. It will become false if one or more of the touch points leaves the gesture area, and return to true once they reenter.

property Gesture.Tap.TapStyle tapStyle: .Default

The tap style recognized by the gesture.

Gesture.Tap.TapStyle.Default

A regular tap.

Gesture.Tap.TapStyle.Button

A tap style appropriate for a user button.

When using the Button tap style, a tap will be recognized as long as the touch points are inside the gesture area at the time of release, even if the user has moved their finger during the gesture. This allows the user to both intuitively cancel the tap by moving their finger to outside the gesture area, and to susequently change their mind by moving it back inside.

The isTouched property indicates whether the touch points are currently inside the gesture area.