diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md index 97df89b9a62e9ad72fea29a0f928cbf9ac4600e7..7c4dfb8a9e6a50e9684d3169c69de51fbe1fb290 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md @@ -1,8 +1,11 @@ # LongPressGesture +**LongPressGesture** is used to trigger a long press gesture, which requires one or more fingers with a minimum 500 ms hold-down time. + +> **NOTE** +> +> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -> **NOTE**
-> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -14,31 +17,31 @@ None LongPressGesture(options?: { fingers?: number, repeat?: boolean, duration?: number }) - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | fingers | number | No | 1 | Minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10. | - | repeat | boolean | No | false | Whether to continuously trigger the event callback. | - | duration | number | No | 500 | Minimum hold-down time, in ms. | + | fingers | number | No| 1 | Minimum number of fingers to trigger a long press gesture. The value ranges from 1 to 10.| + | repeat | boolean | No| false | Whether to continuously trigger the event callback.| + | duration | number | No| 500 | Minimum hold-down time, in ms.| ## Events -| Name | Description | +| Name| Description| | -------- | -------- | -| onAction((event?: GestureEvent) => void) | Callback invoked when a long press gesture is recognized. | -| onActionEnd((event?: GestureEvent) => void) | Callback invoked when the finger used for a long press gesture is lift. | -| onActionCancel(event: () => void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized. | +| onAction((event?: GestureEvent) => void) | Callback invoked when a long press gesture is recognized.| +| onActionEnd((event?: GestureEvent) => void) | Callback invoked when the finger used for a long press gesture is lift.| +| onActionCancel(event: () => void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized.| - GestureEvent attributes related to the long press gesture - | Name | Type | Description | + | Name| Type| Description| | -------- | -------- | -------- | - | repeat | boolean | Whether the event is repeated. | + | repeat | boolean | Whether the event is repeated.| ## Example - -``` +```ts +// xxx.ets @Entry @Component struct LongPressGestureExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md index fb74814e6747dc43419148990560a256e10a0285..55918fd9594a7531abefc16d1f37d0a6a4434f8e 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md @@ -1,7 +1,11 @@ # PanGesture -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +**PanGesture** is used to trigger a pan gesture, which requires a minimum 5 vp movement distance of a finger on the screen. + +> **NOTE** +> +> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. + ## Required Permissions @@ -10,65 +14,66 @@ None ## APIs -PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: number } | [PanGestureOption](#pangestureoptions)) +PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: number } | [PanGestureOptions](#pangestureoptions)) - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | fingers | number | No | 1 | Minimum number of fingers to trigger a slide gesture. The value ranges from 1 to 10. | - | direction | PanDirection | No | All | Slide direction. The enumerated value supports the AND (&) and OR (\|) operations. | - | distance | number | No | 5.0 | Minimum slide recognition distance, in vp. | + | fingers | number | No| 1 | Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.| + | direction | PanDirection | No| All | Pan direction. The enumerated value supports the AND (&) and OR (\|)|operations.| + | distance | number | No| 5.0 | Minimum pan distance to trigger the gesture, in vp.
**NOTE**
If a pan gesture and tab swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.| - PanDirection enums - | Name | Description | + | Name| Description| | -------- | -------- | - | All | All directions. | - | Horizontal | Horizontal slide. | - | Vertical | Vertical slide. | - | Left | Slide to the left. | - | Right | Slide to the right. | - | Up | Slide up. | - | Down | Slide down. | - | None | Slide disabled. | + | All | All directions.| + | Horizontal | Horizontal panning.| + | Vertical | Vertical panning.| + | Left | Panning to the left.| + | Right | Panning to the right.| + | Up | Panning up.| + | Down | Panning down.| + | None | Panning disabled.| ### PanGestureOptions -The attributes of the slide gesture recognizer can be dynamically modified using the **PanGestureOptions** AP. This avoids modifying attributes through status variables, which will cause the UI to be refreshed. +The attributes of the pan gesture recognizer can be dynamically modified using the **PanGestureOptions** API. This avoids modifying attributes through state variables, which will cause the UI to be refreshed. PanGestureOptions(options?: { fingers?: number, direction?: PanDirection, distance?: number }) - Parameters - For details, see **PanGesture**. - + +For details, see **PanGesture**. + - APIs - | Name | Description | + | Name| Description| | -------- | -------- | - | setDirection(value: PanDirection) | Sets the direction. | - | setDistance(value: number) | Sets the distance. | - | setFingers(value: number) | Sets the number of fingers. | + | setDirection(value: PanDirection) | Sets the direction.| + | setDistance(value: number) | Sets the distance.| + | setFingers(value: number) | Sets the number of fingers.| ## Events -| Name | Description | +| Name| Description| | -------- | -------- | -| onActionStart(callback: (event?: GestureEvent) => void) | Callback for the pan gestures reorganization event. | -| onActionUpdate(callback: (event?: GestureEvent) => void) | Callback invoked when a pan gesture is recognized. | -| onActionEnd(callback: (event?: GestureEvent) => void) | Callback invoked when the finger used for a pan gesture is lift. | -| onActionCancel(callback: () => void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized. | +| onActionStart(callback: (event?: GestureEvent) => void) | Callback invoked when a pan gesture is recognized.| +| onActionUpdate(callback: (event?: GestureEvent) => void) | Callback invoked when the pan gesture status is updated.| +| onActionEnd(callback: (event?: GestureEvent) => void) | Callback invoked when the finger used for a pan gesture is lift.| +| onActionCancel(callback: () => void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized.| -- GestureEvent attributes related to the pan gesture - | Name | Type | Description | +- GestureEvent attributes related to the pan gesture + | Name| Type| Description| | -------- | -------- | -------- | - | offsetX | number | Offset of the gesture event, in vp. | - | offsetY | number | Offset of the gesture event, in vp. | + | offsetX | number | Offset of the gesture event, in vp.| + | offsetY | number | Offset of the gesture event, in vp.| ## Example - -``` +```ts +// xxx.ets @Entry @Component struct PanGestureExample {