未验证 提交 5b88cb35 编写于 作者: O openharmony_ci 提交者: Gitee

!2974 2498 处理完成:手势事件接口变更文档同步

Merge pull request !2974 from ester.zhou/TR-2498
......@@ -24,9 +24,9 @@ Navigates to a specified page in the application.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Page routing parameters.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Page routing parameters.|
**Example**
......@@ -72,9 +72,9 @@ Replaces the current page with another one in the application and destroys the c
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the new page.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the new page.|
**Example**
```
......@@ -112,9 +112,9 @@ Returns to the previous page or a specified page.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If this parameter is not set, the application returns to the previous page.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | Yes| Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If this parameter is not set, the application returns to the previous page.|
**Example**
```
......@@ -190,9 +190,9 @@ getLength(): string
Obtains the number of pages in the current stack.
**Return value**
| Type| Description|
| -------- | -------- |
| string | Number of pages in the stack. The maximum value is **32**.|
| Type| Description|
| -------- | -------- |
| string | Number of pages in the stack. The maximum value is **32**.|
**Example**
```
......@@ -222,11 +222,11 @@ Describes the page routing state.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name| Type| Description|
| -------- | -------- | -------- |
| index | number | Index of the current page in the stack.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;The index starts from 1 from the bottom to the top of the stack.|
| name | string | Name of the current page, that is, the file name.|
| path | string | Path of the current page.|
| Name| Type| Description|
| -------- | -------- | -------- |
| index | number | Index of the current page in the stack.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;The index starts from 1 from the bottom to the top of the stack.|
| name | string | Name of the current page, that is, the file name.|
| path | string | Path of the current page.|
**Example**
```
......@@ -249,9 +249,9 @@ Enables the display of a confirm dialog box before returning to the previous pag
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [EnableAlertOptions](#enablealertoptions) | Yes| Description of the dialog box.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [EnableAlertOptions](#enablealertoptions) | Yes| Description of the dialog box.|
**Example**
......@@ -289,6 +289,7 @@ Disables the display of a confirm dialog box before returning to the previous pa
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Example**
```
export default {
disableAlertBeforeBackPage() {
......@@ -311,6 +312,7 @@ Obtains the parameters passed from the page that initiates redirection to the cu
| ------ | ---------------------------------- |
| Object | Parameters passed from the page that initiates redirection to the current page.|
**Example**
- Web-like example
......
......@@ -15,25 +15,25 @@ 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?: LongPressGestureEvent) =&gt; void) | Callback invoked when a long press gesture is recognized. |
| onActionEnd((event?: LongPressGestureEvent) =&gt; void) | Callback invoked when the finger used for a long press gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized. |
| onAction((event?: GestureEvent) =&gt; void) | Callback invoked when a long press gesture is recognized. |
| onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a long press gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a long press gesture is recognized. |
- LongPressGestureEvent<sup>8+</sup> attributes
| Name | Type | Description |
- GestureEvent attributes related to the long press gesture
| Name | Type | Description |
| -------- | -------- | -------- |
| repeat | boolean | Whether the event is repeated. |
| repeat | boolean | Whether the event is repeated. |
## Example
......@@ -53,7 +53,7 @@ struct LongPressGestureExample {
.gesture(
LongPressGesture({ repeat: true })
// Repeatedly triggered when the long press gesture exists.
.onAction((event: LongPressGestureEvent) => {
.onAction((event: GestureEvent) => {
if (event.repeat) { this.count++ }
})
// Triggered when the long press gesture ends.
......
......@@ -55,12 +55,12 @@ PanGestureOptions(options?: { fingers?: number, direction?: PanDirection, distan
| Name | Description |
| -------- | -------- |
| onActionStart(callback: (event?: PanGestureEvent) =&gt; void) | Callback for the pan gestures reorganization event. |
| onActionUpdate(callback: (event?: PanGestureEvent) =&gt; void) | Callback invoked when a pan gesture is recognized. |
| onActionEnd(callback: (event?: PanGestureEvent) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift. |
| onActionStart(callback: (event?: GestureEvent) =&gt; void) | Callback for the pan gestures reorganization event. |
| onActionUpdate(callback: (event?: GestureEvent) =&gt; void) | Callback invoked when a pan gesture is recognized. |
| onActionEnd(callback: (event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift. |
| onActionCancel(callback: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized. |
- PanGestureEvent<sup>8+</sup> attributes
- GestureEvent attributes related to the pan gesture
| Name | Type | Description |
| -------- | -------- | -------- |
| offsetX | number | Offset of the gesture event, in vp. |
......@@ -85,10 +85,10 @@ struct PanGestureExample {
.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: PanGestureEvent) => {
.onActionStart((event: GestureEvent) => {
console.info('Pan start')
})
.onActionUpdate((event: PanGestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
......
......@@ -15,27 +15,27 @@ None
PinchGesture(options?: { fingers?: number, distance?: number })
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 2 | Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. |
| distance | number | No | 3.0 | Minimum recognition distance, in vp. |
| fingers | number | No | 2 | Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. |
| distance | number | No | 3.0 | Minimum recognition distance, in vp. |
## Events
| Name | Description |
| Name | Description |
| -------- | -------- |
| onActionStart((event?: PinchGestureEvent) =&gt; void) | Callback invoked when a pinch gesture is recognized. |
| onActionUpdate((event?: PinchGestureEvent) =&gt; void) | Callback invoked during the movement of a pinch gesture. |
| onActionEnd((event?: PinchGestureEvent) =&gt; void) | Callback invoked when the finger used for a pinch gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pinch gesture is recognized. |
| onActionStart((event?: GestureEvent) =&gt; void) | Callback invoked when a pinch gesture is recognized. |
| onActionUpdate((event?: GestureEvent) =&gt; void) | Callback invoked during the movement of a pinch gesture. |
| onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for a pinch gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pinch gesture is recognized. |
- PinchGestureEvent<sup>8+</sup> attributes
| Name | Type | Description |
- GestureEvent attributes related to the pinch gesture
| Name | Type | Description |
| -------- | -------- | -------- |
| scale | number | Scale ratio. This attribute is used for the pinch gesture. |
| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px. |
| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px. |
| scale | number | Scale ratio. This attribute is used for the pinch gesture. |
| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px. |
| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px. |
## Example
......@@ -55,10 +55,10 @@ struct PinchGestureExample {
.scale({ x: this.scale, y: this.scale, z: this.scale })
.gesture(
PinchGesture()
.onActionStart((event: PinchGestureEvent) => {
.onActionStart((event: GestureEvent) => {
console.info('Pinch start')
})
.onActionUpdate((event: PinchGestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.scale = event.scale
})
.onActionEnd(() => {
......
......@@ -15,25 +15,25 @@ None
RotationGesture(options?: { fingers?: number, angle?: number })
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| fingers | number | No | 2 | Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. |
| angle | number | No | 1.0 | Minimum degree that can trigger the rotation gesture. |
| fingers | number | No | 2 | Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. |
| angle | number | No | 1.0 | Minimum degree that can trigger the rotation gesture. |
## Events
| Name | Description |
| Name | Description |
| -------- | -------- |
| onActionStart((event?: RotationGestureEvent) =&gt; void) | Callback invoked when a rotation gesture is recognized. |
| onActionUpdate((event?: RotationGestureEvent) =&gt; void) | Callback invoked during the movement of the rotation gesture. |
| onActionEnd((event?: RotationGestureEvent) =&gt; void) | Callback invoked when the finger used for the rotation gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after the rotation gesture is recognized. |
| onActionStart((event?: GestureEvent) =&gt; void) | Callback invoked when a rotation gesture is recognized. |
| onActionUpdate((event?: GestureEvent) =&gt; void) | Callback invoked during the movement of the rotation gesture. |
| onActionEnd((event?: GestureEvent) =&gt; void) | Callback invoked when the finger used for the rotation gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after the rotation gesture is recognized. |
- RotationGestureEvent<sup>8+</sup> attributes
| Name | Type | Description |
- GestureEvent attributes related to the rotation gesture
| Name | Type | Description |
| -------- | -------- | -------- |
| angle | number | Rotation angle. |
| angle | number | Rotation angle. |
## Example
......@@ -53,10 +53,10 @@ struct RotationGestureExample {
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.gesture(
RotationGesture()
.onActionStart((event: RotationGestureEvent) => {
.onActionStart((event: GestureEvent) => {
console.log('Rotation start')
})
.onActionUpdate((event: RotationGestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.angle = event.angle
})
.onActionEnd(() => {
......
......@@ -15,32 +15,32 @@ None
SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: 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 swipe gesture. The value ranges from 1 to 10. |
| direction | SwipeDirection | No | SwipeDirection.All | Swipe direction. |
| speed | number | No | 100 | Minimum speed of the swipe gesture (100 vp/s). |
| fingers | number | No | 1 | Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10. |
| direction | SwipeDirection | No | SwipeDirection.All | Swipe direction. |
| speed | number | No | 100 | Minimum speed of the swipe gesture (100 vp/s). |
- SwipeDirection enums
| Name | Description |
| Name | Description |
| -------- | -------- |
| All | All directions. |
| Horizontal | Horizontal direction. |
| Vertical | Vertical direction. |
| All | All directions. |
| Horizontal | Horizontal direction. |
| Vertical | Vertical direction. |
## Events
| Name | Description |
| Name | Description |
| -------- | -------- |
| onAction(callback:(event?: SwipeGestureEvent) =&gt; void) | Callback invoked when a swipe gesture is recognized. |
| onAction(callback:(event?: GestureEvent) =&gt; void) | Callback invoked when a swipe gesture is recognized. |
- SwipeGestureEvent attributes
| Name | Type | Description |
- GestureEvent attributes related to the swipe gesture
| Name | Type | Description |
| -------- | -------- | -------- |
| angle | number | Angle of the swipe gesture. |
| speed | number | Speed of the swipe gesture. |
| angle | number | Angle of the swipe gesture. |
| speed | number | Speed of the swipe gesture. |
## Example
......@@ -64,7 +64,7 @@ struct SwipeGestureExample {
.rotate({x: 0, y: 0, z: 1, angle: this.rotateAngle})
.gesture(
SwipeGesture({fingers: 1, direction:SwipeDirection.Vertical})
.onAction((event: SwipeGestureEvent) => {
.onAction((event: GestureEvent) => {
this.speed = event.speed
this.rotateAngle = event.angle
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册