interface OnGestureOptions {
    angleDiffThreshold?: number;
    debounceWindow?: number;
    deltaThreshold?: number;
    devices?: GestureDevice[] | CommaSeparatedStr<GestureDevice>;
    directions?: CommaSeparatedStr<Direction> | Direction[];
    intents?: GestureIntent[] | CommaSeparatedStr<GestureIntent>;
    maxTotalDeltaX?: number;
    maxTotalDeltaY?: number;
    maxTotalDeltaZ?: number;
    minTotalDeltaX?: number;
    minTotalDeltaY?: number;
    minTotalDeltaZ?: number;
    naturalTouchScroll?: boolean;
    preventDefault?: boolean;
    touchDragHoldTime?: number;
    touchDragNumFingers?: number;
}

Properties

angleDiffThreshold?: number
debounceWindow?: number

If given, callback will be called at most once every debounceWindow milliseconds.

Note that if both debounceWindow and deltaThreshold are set, both must be exceeded before callback is called.

deltaThreshold?: number

Callback will only be called when the gesture's accumulated delta, since the last time callback was called, exceeds deltaThreshold.

At least one of the three deltas (X, Y or Z) must exceed this number (in absolute value). Note that when comparing deltaZ, it is multiplied by 100 since it represents fractions of 1 (100%). So supplying deltaThreshold of 10 means is equivalent to the following condition:

abs(deltaX) >= 10 || abs(deltaY) >= 10 ||  abs(1 - deltaZ) >= 0.1

Accumulation of the delta ends if the gesture is terminated, for example, in case of touch gestures, by a "touchcancel" event of by the final finger lifting off..

Note that if both debounceWindow and deltaThreshold are set, both must be exceeded before callback is called.

One or more device types to listen for. If not specified, then all devices are enabled.

It can be a comma-separated list of GestureDevices or an array of such devices.

undefined

If given, callback will only be called if the gesture's direction is one of the given ones.

It can be a comma-separated list of Directions or an array of such directions.

undefined

If given, callback will only be called if the gesture's intent is one of the given ones.

It can be a comma-separated list of GestureIntents or an array of such intents.

undefined
maxTotalDeltaX?: number

Set maximum total delta X. Further increase in delta X above this value will be ignored.

The value is in pixels.

undefined
maxTotalDeltaY?: number

Set maximum total delta Y. Further increase in delta Y above this value will be ignored.

The value is in pixels.

undefined
maxTotalDeltaZ?: number

Set maximum total delta Z. Further increase in delta Z above this value will be ignored.

The value is in percentage zoom, relative to 1, and must be positive.

undefined
minTotalDeltaX?: number

Set minimum total delta X. Further reductions in delta X below this value will be ignored.

The value is in pixels and can be negative.

undefined
minTotalDeltaY?: number

Set minimum total delta Y. Further reductions in delta Y below this value will be ignored.

The value is in pixels and can be negative.

undefined
minTotalDeltaZ?: number

Set minimum total delta Z. Further reductions in delta Z below this value will be ignored.

The value is in percentage zoom, relative to 1, and can be less than 1 but must be > 0.1 which is a hard minimum.

undefined
naturalTouchScroll?: boolean

Whether touch scroll gestures follow the natural direction: swipe up with scroll intent results in direction down and swipe down results in direction up.

preventDefault?: boolean

If true, the events of the gesture, e.g. relevant key presses or touch moves, etc, will have their default action prevented.

IMPORTANT: For pointer gestures, then pointer/mouse down and click will be prevented.

touchDragHoldTime?: number

If the user presses and holds on a touchscreen for at least the given amount of milliseconds before moving the finger(s), touch gestures other than pinch will be treated as a drag intent instead of scroll as long as the number of fingers touching the screen is touchDragNumFingers.

Set to 0 in order to treat all non-pinch touch gestures as drag.

Set to a negative number in order to treat all non-pinch touch gestures as scroll.

touchDragNumFingers?: number

The number of fingers that could be considered a drag intent for touch gestures.