• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Bound Gesture Configuration
2
3You can set the gestures that are bound to a component. Specifically, you can add or remove gestures by calling the APIs of the **UIGestureEvent** object.
4
5>**NOTE**
6>
7>The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## UIGestureEvent
10
11Provides APIs for configuring gestures bound to a component.
12
13### addGesture
14
15addGesture(gesture: GestureHandler\<T>, priority?: GesturePriority, mask?: GestureMask): void
16
17Adds a gesture.
18
19**Atomic service API**: This API can be used in atomic services since API version 12.
20
21**Parameters**
22
23| Name| Type  | Mandatory| Description                      |
24| ------ | ------ | ---- | -------------------------- |
25| gesture  |  [GestureHandler\<T>](#gesturehandlert) | Yes  | Gesture handler object.|
26| priority  |  [GesturePriority](#gesturepriority) | No  | Priority of the bound gesture.|
27| mask  |  [GestureMask](./ts-gesture-settings.md#gesturemask) | No  | Mask for gesture events.|
28
29### addParallelGesture
30
31addParallelGesture(gesture: GestureHandler\<T>, mask?: GestureMask): void
32
33Adds a gesture that can be recognized at once by the component and its child component.
34
35**Atomic service API**: This API can be used in atomic services since API version 12.
36
37**Parameters**
38
39| Name| Type  | Mandatory| Description                      |
40| ------ | ------ | ---- | -------------------------- |
41| gesture  |  [GestureHandler\<T>](#gesturehandlert) | Yes  | Gesture handler object.|
42| mask  |  [GestureMask](./ts-gesture-settings.md#gesturemask) | No  | Mask for gesture events.|
43
44### removeGestureByTag
45
46removeGestureByTag(tag: string): void
47
48Remove a gesture from a component that has been bound with a specific tag through a modifier.
49
50**Atomic service API**: This API can be used in atomic services since API version 12.
51
52**Parameters**
53
54| Name| Type  | Mandatory| Description                      |
55| ------ | ------ | ---- | -------------------------- |
56| tag  |  string | Yes  | Gesture handler flag.|
57
58### clearGestures
59
60clearGestures(): void
61
62Clears all gestures that have been bound to the component through a modifier.
63
64**Atomic service API**: This API can be used in atomic services since API version 12.
65
66## GestureHandler\<T>
67
68Defines the basic type of the gesture handler.
69
70### tag
71
72tag(tag: string): T
73
74Sets the tag for the gesture handler.
75
76**Atomic service API**: This API can be used in atomic services since API version 12.
77
78**Parameters**
79
80| Name| Type| Mandatory|Description                                       |
81| ----  | ------  | ------|---------------------------------- |
82| tag   | string  | Yes|Tag of the gesture handler.|
83
84### allowedTypes<sup>14+</sup>
85
86allowedTypes(types: Array\<SourceTool>): T
87
88Sets the event input sources supported by the gesture handler.
89
90**Atomic service API**: This API can be used in atomic services since API version 14.
91
92**System capability**: SystemCapability.ArkUI.ArkUI.Full
93
94**Parameters**
95
96| Name| Type| Mandatory|Description                                       |
97| ----  | ------  | ------|---------------------------------- |
98| types   | Array\<[SourceTool](ts-gesture-settings.md#sourcetool9)>  | Yes|Event input sources supported by the gesture handler.|
99
100## TapGestureHandler
101
102Defines a type of gesture handler object for tap gestures.
103
104### constructor
105
106constructor(options?: TapGestureHandlerOptions)
107
108A constructor used to create a **TapGestureHandler** object.
109
110**Atomic service API**: This API can be used in atomic services since API version 12.
111
112**Parameters**
113
114| Name | Type                                                        | Mandatory| Description              |
115| ------- | ------------------------------------------------------------ | ---- | ------------------ |
116| options | [TapGestureHandlerOptions](#tapgesturehandleroptions) | No  | Parameters of the tap gesture handler.|
117
118### onAction
119
120onAction(event: Callback\<GestureEvent>): TapGestureHandler
121
122Invoked when a tap gesture is recognized.
123
124**Atomic service API**: This API can be used in atomic services since API version 12.
125
126**System capability**: SystemCapability.ArkUI.ArkUI.Full
127
128**Parameters**
129
130| Name| Type                             | Mandatory| Description                |
131| ------ | --------------------------------- | ---- | -------------------- |
132| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a tap gesture is recognized.|
133
134**Return value**
135
136| Type| Description|
137| -------- | -------- |
138| TapGestureHandler | Tap gesture handler object.|
139
140## TapGestureHandlerOptions
141
142Provides the parameters of the tap gesture handler.
143
144**Atomic service API**: This API can be used in atomic services since API version 12.
145
146**System capability**: SystemCapability.ArkUI.ArkUI.Full
147
148| Attributes        | Type                                  | Mandatory| Description                |
149| ------------ | -------------------------------------- | ---- | -------------------- |
150| count | number | No| Number of consecutive taps. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>1. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.<br>2. If the distance between the last tapped position and the current tapped position exceeds 60 vp, gesture recognition fails.|
151| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>1. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers pressing the screen within 300 ms of the first finger's being pressed is less than the required number, or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted is less than the required number.<br>2. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized.|
152| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**.<br>In multi-tap events (where the **count** parameter is greater than 1), each tap must have the same number of fingers as the configured value; otherwise, the gesture recognition fails.<br>Default value: **false**.|
153
154## LongPressGestureHandler
155
156Defines a type of gesture handler object for long press gestures.
157
158### constructor
159
160constructor(options?: LongPressGestureHandlerOptions)
161
162A constructor used to create a **LongPressGestureHandler** object.
163
164**Atomic service API**: This API can be used in atomic services since API version 12.
165
166**Parameters**
167
168
169| Name | Type                                                        | Mandatory| Description              |
170| ------- | ------------------------------------------------------------ | ---- | ------------------ |
171| options | [LongPressGestureHandlerOptions](#longpressgesturehandleroptions) | No  | Parameters of the long press gesture handler.|
172
173### onAction
174
175onAction(event: Callback\<GestureEvent>): LongPressGestureHandler
176
177Invoked when a long press gesture is recognized.
178
179**Atomic service API**: This API can be used in atomic services since API version 12.
180
181**System capability**: SystemCapability.ArkUI.ArkUI.Full
182
183**Parameters**
184
185| Name| Type                             | Mandatory| Description                |
186| ------ | --------------------------------- | ---- | -------------------- |
187| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a long press gesture is recognized.|
188
189**Return value**
190
191| Type| Description|
192| -------- | -------- |
193| LongPressGestureHandler | Long press gesture handler object.|
194
195### onActionEnd
196
197onActionEnd(event: Callback\<GestureEvent>): LongPressGestureHandler
198
199Invoked when the last finger is lifted after the long press gesture is recognized.
200
201**Atomic service API**: This API can be used in atomic services since API version 12.
202
203**System capability**: SystemCapability.ArkUI.ArkUI.Full
204
205**Parameters**
206
207| Name| Type                             | Mandatory| Description                |
208| ------ | --------------------------------- | ---- | -------------------- |
209| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when the last finger is lifted after the long press gesture is recognized.|
210
211**Return value**
212
213| Type| Description|
214| -------- | -------- |
215| LongPressGestureHandler | Long press gesture handler object.|
216
217### onActionCancel
218
219onActionCancel(event: Callback\<void>): LongPressGestureHandler
220
221Invoked when a tap cancellation event is received after a long press gesture is recognized.
222
223**Atomic service API**: This API can be used in atomic services since API version 12.
224
225**System capability**: SystemCapability.ArkUI.ArkUI.Full
226
227**Parameters**
228
229| Name| Type                             | Mandatory| Description                |
230| ------ | --------------------------------- | ---- | -------------------- |
231| event  | [Callback](./ts-types.md#callback12)\<void> | Yes| Callback invoked when a tap cancellation event is received after a long press gesture is recognized.|
232
233**Return value**
234
235| Type| Description|
236| -------- | -------- |
237| LongPressGestureHandler | Long press gesture handler object.|
238
239## LongPressGestureHandlerOptions
240
241Provides the parameters of the long press gesture handler.
242
243**Atomic service API**: This API can be used in atomic services since API version 12.
244
245**System capability**: SystemCapability.ArkUI.ArkUI.Full
246
247| Attributes        | Type                                  | Mandatory| Description                |
248| ------------ | -------------------------------------- | ---- | -------------------- |
249| fingers | number | No| Minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10.<br>Default value: **1**<br> **NOTE**<br>If a finger moves more than 15 px after being pressed, the gesture recognition fails.|
250| repeat | boolean | No| Whether to continuously trigger the event callback. The value **true** means to continuously trigger the event callback, and **false** means the opposite.<br>Default value: **false**.|
251| duration | number | No| Minimum hold-down time, in ms.<br>Default value: **500**<br>**NOTE**<br>Value range: [0, +∞). If the value is less than or equal to 0, the default value **500** is used.|
252| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**.<br>For gestures that have already been successfully recognized, changes in the number of fingers touching the screen will not trigger the repeat event. However, if the number of fingers touching the screen returns to the configured minimum number, the [onAction](ts-basic-gestures-longpressgesture.md#events) event can be triggered. The [onActionEnd](ts-basic-gestures-longpressgesture.md#events) event can also be triggered regardless of the finger count.<br>Default value: **false**.|
253
254## PanGestureHandler
255
256Defines a type of gesture handler object for pan gestures.
257
258### constructor
259
260constructor(options?: PanGestureHandlerOptions)
261
262A constructor used to create a **PanGestureHandler** object.
263
264**Atomic service API**: This API can be used in atomic services since API version 12.
265
266**Parameters**
267
268
269| Name | Type                                                        | Mandatory| Description              |
270| ------- | ------------------------------------------------------------ | ---- | ------------------ |
271| options | [PanGestureHandlerOptions](#pangesturehandleroptions) | No  | Parameters of the pan gesture handler.|
272
273### onActionStart
274
275onActionStart(event: Callback\<GestureEvent>): PanGestureHandler
276
277Invoked when a pan gesture is recognized.
278
279**Atomic service API**: This API can be used in atomic services since API version 12.
280
281**System capability**: SystemCapability.ArkUI.ArkUI.Full
282
283**Parameters**
284
285| Name| Type                             | Mandatory| Description                |
286| ------ | --------------------------------- | ---- | -------------------- |
287| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a pan gesture is recognized.|
288
289**Return value**
290
291| Type| Description|
292| -------- | -------- |
293| PanGestureHandler | Pan gesture handler object.|
294
295### onActionUpdate
296
297onActionUpdate(event: Callback\<GestureEvent>): PanGestureHandler
298
299Invoked during the movement of a pan gesture.
300
301**Atomic service API**: This API can be used in atomic services since API version 12.
302
303**System capability**: SystemCapability.ArkUI.ArkUI.Full
304
305**Parameters**
306
307| Name| Type                             | Mandatory| Description                |
308| ------ | --------------------------------- | ---- | -------------------- |
309| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked during the movement of a pan gesture.<br>If **fingerList** contains multiple fingers, this callback updates the location information of only one finger each time.|
310
311**Return value**
312
313| Type| Description|
314| -------- | -------- |
315| PanGestureHandler | Pan gesture handler object.|
316
317### onActionEnd
318
319onActionEnd(event: Callback\<GestureEvent>): PanGestureHandler
320
321Invoked when the finger used for a pan gesture is lifted.
322
323**Atomic service API**: This API can be used in atomic services since API version 12.
324
325**System capability**: SystemCapability.ArkUI.ArkUI.Full
326
327**Parameters**
328
329| Name| Type                             | Mandatory| Description                |
330| ------ | --------------------------------- | ---- | -------------------- |
331| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when the finger used for a pan gesture is lifted.|
332
333**Return value**
334
335| Type| Description|
336| -------- | -------- |
337| PanGestureHandler | Pan gesture handler object.|
338
339### onActionCancel
340
341onActionCancel(event: Callback\<void>): PanGestureHandler
342
343Invoked when a tap cancellation event is received after a pan gesture is recognized.
344
345**Atomic service API**: This API can be used in atomic services since API version 12.
346
347**System capability**: SystemCapability.ArkUI.ArkUI.Full
348
349**Parameters**
350
351| Name| Type                             | Mandatory| Description                |
352| ------ | --------------------------------- | ---- | -------------------- |
353| event  | [Callback](./ts-types.md#callback12)\<void> | Yes| Callback invoked when a tap cancellation event is received after a pan gesture is recognized.|
354
355**Return value**
356
357| Type| Description|
358| -------- | -------- |
359| PanGestureHandler | Pan gesture handler object.|
360
361## PanGestureHandlerOptions
362
363Provides the parameters of the pan gesture handler.
364
365**Atomic service API**: This API can be used in atomic services since API version 12.
366
367**System capability**: SystemCapability.ArkUI.ArkUI.Full
368
369| Attributes        | Type                                  | Mandatory| Description                |
370| ------------ | -------------------------------------- | ---- | -------------------- |
371| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**<br>Value range: [1, 10]<br>**NOTE**<br>If the value is less than 1 or is not set, the default value is used.|
372| direction | [PanDirection](./ts-basic-gestures-pangesture.md#pandirection) | No| Pan direction. The value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All**|
373| distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and a [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.<br>Value range: [0, +∞). If the value specified is less than 0, the default value **5** is used.|
374| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**. The gesture can only be successfully recognized if the number of fingers touching the screen equals the configured minimum number and the swipe distance meets the threshold.<br>For gestures that have already been successfully recognized, changing the number of fingers touching the screen will not trigger the [onActionUpdate](ts-basic-gestures-pangesture.md#events) event, but the [onActionEnd](ts-basic-gestures-pangesture.md#events) event can still be triggered.<br>Default value: **false**.|
375
376## SwipeGestureHandler
377
378Defines a type of gesture handler object for swipe gestures.
379
380### constructor
381
382constructor(options?: SwipeGestureHandlerOptions)
383
384A constructor used to create a **SwipeGestureHandler** object.
385
386**Atomic service API**: This API can be used in atomic services since API version 12.
387
388**Parameters**
389
390| Name | Type                                                        | Mandatory| Description              |
391| ------- | ------------------------------------------------------------ | ---- | ------------------ |
392| options | [SwipeGestureHandlerOptions](#swipegesturehandleroptions) | No  | Parameters of the swipe gesture handler.|
393
394### onAction
395
396onAction(event: Callback\<GestureEvent>): SwipeGestureHandlerOptions
397
398Invoked when a swipe gesture is recognized.
399
400**Atomic service API**: This API can be used in atomic services since API version 12.
401
402**System capability**: SystemCapability.ArkUI.ArkUI.Full
403
404**Parameters**
405
406| Name| Type                             | Mandatory| Description                |
407| ------ | --------------------------------- | ---- | -------------------- |
408| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a swipe gesture is recognized.|
409
410**Return value**
411
412| Type| Description|
413| -------- | -------- |
414| SwipeGestureHandler | Swipe gesture handler object.|
415
416## SwipeGestureHandlerOptions
417
418Provides the parameters of the swipe gesture handler.
419
420**Atomic service API**: This API can be used in atomic services since API version 12.
421
422**System capability**: SystemCapability.ArkUI.ArkUI.Full
423
424| Attributes        | Type                                  | Mandatory| Description                |
425| ------------ | -------------------------------------- | ---- | -------------------- |
426| fingers | number | No| Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10.<br>Default value: **1**|
427| direction | [SwipeDirection](./ts-basic-gestures-swipegesture.md#swipedirection) | No| Swipe direction.<br>Default value: **SwipeDirection.All**|
428| speed | number | No| Minimum speed of the swipe gesture.<br>Default value: 100 vp/s<br>**NOTE**<br>If the value is less than or equal to 0, it will be converted to the default value.|
429| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**.<br>Default value: **false**.|
430
431## PinchGestureHandler
432
433Defines a type of gesture handler object for pinch gestures.
434
435### constructor
436
437constructor(options?: PinchGestureHandlerOptions)
438
439A constructor used to create a **PinchGestureHandler** object.
440
441**Atomic service API**: This API can be used in atomic services since API version 12.
442
443**Parameters**
444
445
446| Name | Type                                                        | Mandatory| Description              |
447| ------- | ------------------------------------------------------------ | ---- | ------------------ |
448| options | [PinchGestureHandlerOptions](#pinchgesturehandleroptions) | No  | Parameters of the pinch gesture handler.|
449
450### onActionStart
451
452onActionStart(event: Callback\<GestureEvent>): PinchGestureHandler
453
454Invoked when a pinch gesture is recognized.
455
456**Atomic service API**: This API can be used in atomic services since API version 12.
457
458**System capability**: SystemCapability.ArkUI.ArkUI.Full
459
460**Parameters**
461
462| Name| Type                             | Mandatory| Description                |
463| ------ | --------------------------------- | ---- | -------------------- |
464| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a pinch gesture is recognized.|
465
466**Return value**
467
468| Type| Description|
469| -------- | -------- |
470| PinchGestureHandler | Pinch gesture handler object.|
471
472### onActionUpdate
473
474onActionUpdate(event: Callback\<GestureEvent>): PinchGestureHandler
475
476Invoked during the movement of a pinch gesture.
477
478**Atomic service API**: This API can be used in atomic services since API version 12.
479
480**System capability**: SystemCapability.ArkUI.ArkUI.Full
481
482**Parameters**
483
484| Name| Type                             | Mandatory| Description                |
485| ------ | --------------------------------- | ---- | -------------------- |
486| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked during the movement of a pinch gesture.|
487
488**Return value**
489
490| Type| Description|
491| -------- | -------- |
492| PinchGestureHandler | Pinch gesture handler object.|
493
494### onActionEnd
495
496onActionEnd(event: Callback\<GestureEvent>): PinchGestureHandler
497
498Invoked when the finger used for a pinch gesture is lifted.
499
500**Atomic service API**: This API can be used in atomic services since API version 12.
501
502**System capability**: SystemCapability.ArkUI.ArkUI.Full
503
504**Parameters**
505
506| Name| Type                             | Mandatory| Description                |
507| ------ | --------------------------------- | ---- | -------------------- |
508| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when the finger used for a pinch gesture is lifted.|
509
510**Return value**
511
512| Type| Description|
513| -------- | -------- |
514| PinchGestureHandler | Pinch gesture handler object.|
515
516### onActionCancel
517
518onActionCancel(event: Callback\<void>): PinchGestureHandler
519
520Invoked when a tap cancellation event is received after a pinch gesture is recognized.
521
522**Atomic service API**: This API can be used in atomic services since API version 12.
523
524**System capability**: SystemCapability.ArkUI.ArkUI.Full
525
526**Parameters**
527
528| Name| Type                             | Mandatory| Description                |
529| ------ | --------------------------------- | ---- | -------------------- |
530| event  | [Callback](./ts-types.md#callback12)\<void> | Yes| Callback invoked when a tap cancellation event is received after a pinch gesture is recognized.|
531
532**Return value**
533
534| Type| Description|
535| -------- | -------- |
536| PinchGestureHandler | Pan gesture handler object.|
537
538## PinchGestureHandlerOptions
539
540Provides the parameters of the pinch gesture handler.
541
542**Atomic service API**: This API can be used in atomic services since API version 12.
543
544**System capability**: SystemCapability.ArkUI.ArkUI.Full
545
546| Attributes        | Type                                  | Mandatory| Description                |
547| ------------ | -------------------------------------- | ---- | -------------------- |
548| fingers | number | No| Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5.<br>Default value: **2**<br>While more fingers than the minimum number can be pressed to trigger the gesture, only the first fingers of the minimum number participate in gesture calculation.|
549| distance | number | No| Minimum recognition distance, in vp.<br>Default value: **5**<br>**NOTE**<br> If the value is less than or equal to 0, it will be converted to the default value.|
550| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**. The gesture can only be successfully recognized if the number of fingers equals the configured minimum and the swipe distance meets the threshold. Note that only the first two fingers that touch the screen are considered for the gesture. If one of these fingers is lifted, the gesture recognition fails. For gestures that have already been successfully recognized, changing the number of fingers touching the screen will not trigger the [onActionUpdate](ts-basic-gestures-pinchgesture.md#events) event, but the [onActionEnd](ts-basic-gestures-pinchgesture.md#events) event can still be triggered.<br>Default value: **false**.|
551
552## RotationGestureHandler
553
554Defines a type of gesture handler object for rotation gestures.
555
556### constructor
557
558constructor(options?: RotationGestureHandlerOptions)
559
560A constructor used to create a **RotationGestureHandler** object.
561
562**Atomic service API**: This API can be used in atomic services since API version 12.
563
564**Parameters**
565
566
567| Name | Type                                                        | Mandatory| Description              |
568| ------- | ------------------------------------------------------------ | ---- | ------------------ |
569| options | [RotationGestureHandlerOptions](#rotationgesturehandleroptions) | No  | Parameters of the rotation gesture handler.|
570
571### onActionStart
572
573onActionStart(event: Callback\<GestureEvent>): RotationGestureHandler
574
575Invoked when a rotation gesture is recognized.
576
577**Atomic service API**: This API can be used in atomic services since API version 12.
578
579**System capability**: SystemCapability.ArkUI.ArkUI.Full
580
581**Parameters**
582
583| Name| Type                             | Mandatory| Description                |
584| ------ | --------------------------------- | ---- | -------------------- |
585| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when a rotation gesture is recognized.|
586
587**Return value**
588
589| Type| Description|
590| -------- | -------- |
591| RotationGestureHandler | Pan gesture handler object.|
592
593### onActionUpdate
594
595onActionUpdate(event: Callback\<GestureEvent>): RotationGestureHandler
596
597Invoked during the movement of the rotation gesture.
598
599**Atomic service API**: This API can be used in atomic services since API version 12.
600
601**System capability**: SystemCapability.ArkUI.ArkUI.Full
602
603**Parameters**
604
605| Name| Type                             | Mandatory| Description                |
606| ------ | --------------------------------- | ---- | -------------------- |
607| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked during the movement of the rotation gesture.|
608
609**Return value**
610
611| Type| Description|
612| -------- | -------- |
613| RotationGestureHandler | Pan gesture handler object.|
614
615### onActionEnd
616
617onActionEnd(event: Callback\<GestureEvent>): RotationGestureHandler
618
619Invoked when the finger used for the rotation gesture is lifted.
620
621**Atomic service API**: This API can be used in atomic services since API version 12.
622
623**System capability**: SystemCapability.ArkUI.ArkUI.Full
624
625**Parameters**
626
627| Name| Type                             | Mandatory| Description                |
628| ------ | --------------------------------- | ---- | -------------------- |
629| event  | [Callback](./ts-types.md#callback12)<[GestureEvent](ts-gesture-settings.md#gestureevent)> | Yes| Callback invoked when the finger used for the rotation gesture is lifted.|
630
631**Return value**
632
633| Type| Description|
634| -------- | -------- |
635| RotationGestureHandler | Rotation gesture handler object.|
636
637### onActionCancel
638
639onActionCancel(event: Callback\<void>): RotationGestureHandler
640
641Invoked when a tap cancellation event is received after the rotation gesture is recognized.
642
643**Atomic service API**: This API can be used in atomic services since API version 12.
644
645**System capability**: SystemCapability.ArkUI.ArkUI.Full
646
647**Parameters**
648
649| Name| Type                             | Mandatory| Description                |
650| ------ | --------------------------------- | ---- | -------------------- |
651| event  | [Callback](./ts-types.md#callback12)\<void> | Yes| Callback invoked when a tap cancellation event is received after the rotation gesture is recognized.|
652
653**Return value**
654
655| Type| Description|
656| -------- | -------- |
657| RotationGestureHandler | Pan gesture handler object.|
658
659## RotationGestureHandlerOptions
660
661Provides the parameters of the rotation gesture handler.
662
663**Atomic service API**: This API can be used in atomic services since API version 12.
664
665**System capability**: SystemCapability.ArkUI.ArkUI.Full
666
667| Attributes        | Type                                  | Mandatory| Description                |
668| ------------ | -------------------------------------- | ---- | -------------------- |
669| fingers | number | No| Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5.<br>Default value: **2**<br>While more fingers than the minimum number can be pressed to trigger the gesture, only the first two fingers participate in gesture calculation.|
670| angle | number | No| Minimum degree that can trigger the rotation gesture.<br>Default value: **1**<br>**NOTE**<br>If the value is less than or equal to 0 or greater than 360, it will be converted to the default value.|
671| isFingerCountLimited<sup>15+</sup> | boolean | No| Whether to enforce the exact number of fingers touching the screen.<br>**true**: Enforce the exact number of fingers touching the screen.<br>**false**: Do not enforce the exact number of fingers touching the screen.<br> With the value **true**, the gesture recognition fails if the number of fingers touching the screen does not match the configured value of **fingers**. The gesture can only be successfully recognized if the number of fingers equals the configured minimum and the swipe distance meets the threshold. Note that only the first two fingers that touch the screen are considered for the gesture. If one of these fingers is lifted, the gesture recognition fails.<br>For gestures that have already been successfully recognized, changing the number of fingers touching the screen will not trigger the[onActionUpdate](ts-basic-gestures-rotationgesture.md#events) event, but the [onActionEnd](ts-basic-gestures-rotationgesture.md#events) event can still be triggered.<br>Default value: **false**.|
672
673## GestureGroupHandler
674
675Defines a type of gesture handler object for gesture groups.
676
677### constructor
678
679constructor(options?: GestureGroupGestureHandlerOptions)
680
681A constructor used to create a **GestureGroupHandler** object.
682
683**Atomic service API**: This API can be used in atomic services since API version 12.
684
685**Parameters**
686
687| Name | Type                                                        | Mandatory| Description              |
688| ------- | ------------------------------------------------------------ | ---- | ------------------ |
689| options | [GestureGroupGestureHandlerOptions](#gesturegroupgesturehandleroptions) | No  | Parameters of the gesture group handler.|
690
691### onCancel
692
693onCancel(event: Callback\<void>): GestureGroupHandler
694
695Invoked when a cancellation event is received after the gesture group in sequential gesture recognition (**GestureMode.Sequence**) is recognized.
696
697**Atomic service API**: This API can be used in atomic services since API version 12.
698
699**System capability**: SystemCapability.ArkUI.ArkUI.Full
700
701**Parameters**
702
703| Name| Type                             | Mandatory| Description                |
704| ------ | --------------------------------- | ---- | -------------------- |
705| event  | [Callback](./ts-types.md#callback12)\<void> | Yes| Callback invoked when a cancellation event is received after the gesture group in sequential gesture recognition **GestureMode.Sequence**) is recognized.|
706
707**Return value**
708
709| Type| Description|
710| -------- | -------- |
711| GestureGroupHandler | Gesture group handler object.|
712
713## GestureGroupGestureHandlerOptions
714
715Provides the parameters of the gesture group handler.
716
717**Atomic service API**: This API can be used in atomic services since API version 12.
718
719**System capability**: SystemCapability.ArkUI.ArkUI.Full
720
721| Attributes        | Type                                  | Mandatory| Description                |
722| ------------ | -------------------------------------- | ---- | -------------------- |
723| mode    | [GestureMode](./ts-combined-gestures.md#gesturemode)                          | Yes  | Recognition mode of combined gestures.<br>Default value: **GestureMode.Sequence**     |
724| gestures | [GestureHandler](#gesturehandlert)\<[TapGestureHandler](#tapgesturehandler) \| [LongPressGestureHandler](#longpressgesturehandler) \| [PanGestureHandler](#pangesturehandler) \| [SwipeGestureHandler](#swipegesturehandler) \| [PinchGestureHandler](#pinchgesturehandler) \| [RotationGestureHandler](#rotationgesturehandler) \| [GestureGroupHandler](#gesturegrouphandler)>[] | Yes  | Gestures that need to be included in the gesture group.<br>**NOTE**<br>To add both tap and double-tap gestures for a component, add two TapGestures, with the tap gesture added after the double-tap gesture.|
725
726## GesturePriority
727
728**Atomic service API**: This API can be used in atomic services since API version 12.
729
730| Name| Description|
731| -------- | -------- |
732| NORMAL | Normal priority.|
733| PRIORITY | High priority.|
734
735## Example
736
737For details, see [Gesture Modifier](./ts-universal-attributes-gesture-modifier.md).
738