Gesture types
The six gesture classes, their options, the callbacks each supports and the event each passes. import { PanGesture, TapGesture } from '@blotch/angular-lynx';
Usage
Create a gesture with new, chain its options and callbacks, then bind it with [lynxGesture]. Every option and callback returns the gesture.
Common to every gesture
When each one fires is on Lifecycle. A — default below means AngularLynx doesn't send the option, so Lynx uses its own default.
Positions: x and absoluteX
x,y: the finger's position from the top-left corner of the element that has the gesture.absoluteX,absoluteY: the finger's position from the top-left corner of thepage, the root of your app.translationX,translationY(pan only): how far the finger has moved since the gesture began. AngularLynx works it out fromabsoluteXandabsoluteY, because Lynx reports only positions.
TapGesture
Recognizes a quick touch and release.
Callbacks: onBegin, onStart, onEnd, onTouchesDown, onTouchesUp. onEnd fires only when the tap succeeded.
No Lynx platform counts taps, so numberOfTaps(2) still fires on the first tap. To detect a double tap, compare the times of successive onEnd calls yourself.
PanGesture
Tracks a finger dragging across the element. onUpdate fires on every move.
A pointer is one finger touching the screen. minPointers(2) means the gesture needs two fingers.
Callbacks: all six.
Register onBegin, even an empty one, whenever you use onStart or onEnd. Lynx fires those two only after onBegin has fired, and it fires onBegin only when you register it. AngularLynx also resets translationX and translationY when onEnd fires.
translationX is measured from where onBegin fired. If you register onStart, it's measured from where the pan activated instead.
FlingGesture
Recognizes a quick swipe in a direction.
Callbacks: all six. Register onBegin with onStart or onEnd, as for a pan.
LongPressGesture
Recognizes a finger held still on the element.
Callbacks: onBegin, onStart, onEnd, onTouchesDown, onTouchesUp. onStart fires once the hold is long enough. onEnd fires when the finger lifts after a successful long press.
PinchGesture and RotationGesture
Two-finger zoom and rotate. Neither class has options.
No Lynx platform has a native pinch or rotation handler, so these gestures never fire on a device. You can still compose them, for example Gesture.Simultaneous(pan, pinch), but drive zoom from a pan or on-screen buttons for now.
Callbacks: all six.
Why the defaults are sent
Once a gesture sends any option, Lynx reads every option it leaves out as 0. Without the defaults, a tap that set only numberOfTaps would get a maxDuration of 0 and fail the instant a finger lands. So TapGesture, LongPressGesture and PanGesture always send their full default set, shown above. You don't need to set them yourself.
If no gesture fires
Lynx ignores every gesture, with no error, unless the bundle was built with enableNewGesture: true. AngularLynx turns it on by default. If you pass plugin options in lynx.config.ts, don't set it to false.
If a pan's onStart or onEnd never fires, register onBegin (see PanGesture).
Types
Every event also has Lynx's raw fields as properties, such as pageX and clientX. params holds the same fields. GestureState is on Lifecycle.
