Gesture
Usage
First you need to install the package
There are various ways we can utilize the Gesture from ngxtension/gestures
The examples show using NgxDrag
, for DragGesture
, but they can apply to other gestures as well.
Directive
NgxDrag
is a directive that we can use to attach on any element to capture that element’s drag events.
As hostDirective
We can also use NgxDrag
on a Host element by leveraging hostDirectives
injectDrag
Another way of enabling Drag Gesture is to use the CIF injectDrag
.
With that in mind, the true power of injectDrag
is the ease of composing different behaviors on top of Drag Gesture. For example, we can have a CIF
that both enables Drag Gesture and returns a Signal<Vector2>
that can trigger other effects.
Configuration
- For
NgxDrag
, we can provide a config object via[ngxDragConfig]
Input. - For
injectDrag
, we can provide a configSignal<DragConfig>
(or aFunction
that returnsDragConfig
) in the 2nd argument
Zone
Drag Gesture is enabled inside of Zone by default.
- For
NgxDrag
, we can go into zoneless mode via[ngxDragZoneless]
Input. - For
injectDrag
, we can go into zoneless mode viazoneless
option in the 2nd argument
Global Zoneless
Additionally, we can allow all gestures in a certain component tree to automatically opt-in to zoneless mode by calling provideZonelessGesture()