diff --git a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md index b6e83506f74e8993b266ee8495156b927247004c..be8e50372e9fa37c88317e6e0d442187ec470f3a 100644 --- a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md +++ b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md @@ -15,7 +15,7 @@ Use the following attributes to bind gesture recognition to a component. When a | -------- | -------- | -------- | -------- | | gesture | gesture: [GestureType](#gesturetype),
mask?: [GestureMask](#gesturemask) | gesture: -,
mask: GestureMask.Normal | Gesture to bind.
- **gesture**: type of the gesture to bind.
- **mask**: event response setting.| | priorityGesture | gesture: [GestureType](#gesturetype),
mask?: [GestureMask](#gesturemask) | gesture: -,
mask: GestureMask.Normal | Gesture to preferentially recognize.
- **gesture**: type of the gesture to bind.
- **mask**: event response setting.
By default, a component recognizes gestures bound through **gesture**. When **priorityGesture** is configured for its parent component, the component preferentially recognizes gestures bound through **priorityGesture**.| -| parallelGesture | gesture: [GestureType](#gesturetype),
mask?: [GestureMask](#gesturemask) | gesture: -,
mask: GestureMask.Normal | Gesture that can be triggered together with the child component gesture.
- **gesture**: type of the gesture to bind.
- **mask**: event response setting.
The gesture event is not a bubbling event. When **parallelGesture** is set for the parent component, gesture events that are the same for the parent component and child components can be triggered, thereby implementing a bubbling effect.| +| parallelGesture | gesture: [GestureType](#gesturetype),
mask?: [GestureMask](#gesturemask) | gesture: -,
mask: GestureMask.Normal | Gesture that can be triggered together with the child component gesture.
- **gesture**: type of the gesture to bind.
- **mask**: event response setting.
The gesture event is not a bubbling event. When **parallelGesture** is set for the parent component, gesture events that are the same for the parent and child components can be triggered, thereby implementing a bubbling effect. If both the single-tap gesture event and the double-tap gesture event are bound to the parent and child components, only the single-tap gesture event is responded.| ## GestureType @@ -40,26 +40,31 @@ Use the following attributes to bind gesture recognition to a component. When a The component binds gesture objects of different **GestureType**s through gesture events. Each gesture object provides gesture-related information in the gesture response event. In the following example, the **TapGesture** object provides gesture-related information in the **onAction** event. For details about the event definitions of other gestures, see the corresponding gesture sections. To bind multiple gestures, use [combined gestures](ts-combined-gestures.md). -- TapGesture - | Name| Description| - | -------- | -------- | - | onAction((event?:GestureEvent) => void) | Callback invoked when a tap gesture is recognized.| +**TapGesture** + +| Name| Description| +| -------- | -------- | +| onAction((event?:GestureEvent) => void) | Callback invoked when a tap gesture is recognized.| ## GestureEvent | Name| Type| Description| | -------- | -------- | -------- | -| repeat | boolean | Whether the event is triggered repeatedly. This attribute is used for the **LongPressGesture** event. | -| offsetX | number | Offset of the gesture event on the x-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means panning from left to right, and a negative value means the opposite. | -| offsetY | number | Offset of the gesture event on the y-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means panning from top to bottom, and a negative value means the opposite. | +| repeat | boolean | Whether the event is triggered repeatedly. This attribute is used for the **LongPressGesture** event.| +| offsetX | number | Offset of the gesture event on the x-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from left to right, and a negative value means the opposite.| +| offsetY | number | Offset of the gesture event on the y-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from top to bottom, and a negative value means the opposite.| | angle | number | Rotation angle for the **RotationGesture** event;
angle of the swipe gesture for the **SwipeGesture** event, that is, the change in the included angle between the line segment created by the two fingers and the horizontal direction.
**NOTE**
Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) – arctan2(y2-y1,x2-x1) The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees.| | scale | number | Scale ratio. This attribute is used for the **PinchGesture** event.| -| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event. | -| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event. | +| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.| +| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.| | speed8+ | number | Swipe gesture speed, that is, the average swipe speed of all fingers. The unit is vp/s. This attribute is used for the **SwipeGesture** event.| | fingerList8+ | [FingerInfo](#fingerinfo)[] | Information about all fingers that trigger the event, which is used for the **LongPressGesture** and **TapGesture** events.| | timestamp8+ | number | Timestamp of the event.| | target8+ | [EventTarget](ts-universal-events-click.md#eventtarget8) | Display area of the element that triggers the gesture event.| | source8+ | [SourceType](#sourcetype) | Event input device.| +| pressure9+ | number | Press pressure.| +| tiltX9+ | number | Angle between the projection of the stylus on the device plane and the x-axis.| +| tiltY9+ | number | Angle between the projection of the stylus on the device plane and the y-axis.| +| sourceTool9+ | [SourceTool](#sourcetool) | Event input source.| ## SourceType | Name| Description| @@ -77,6 +82,13 @@ The component binds gesture objects of different **GestureType**s through gestur | localX | number | X-coordinate relative to the upper left corner of the current component.| | localY | number | Y-coordinate relative to the upper left corner of the current component.| +## SourceTool +| Name| Description| +| -------- | -------- | +| Unknown | Unknown input source.| +| Finger | Finger input.| +| Pen | Stylus input.| + ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index f1cb514bdf1643497721297fb69d5791b791c988..079220c606aeb636c21387cc389c41076f6a2e9d 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -23,6 +23,8 @@ getInspectorByKey(id: string): string Obtains all attributes of the component with the specified ID, excluding the information about child components. +This API is used only for test purposes. + **Parameters** | Name | Type | Mandatory | Description | @@ -41,6 +43,8 @@ getInspectorTree(): string Obtains the component tree and component attributes. +This API is used only for test purposes. + **Return value** | Type | Description | @@ -53,6 +57,8 @@ sendEventByKey(id: string, action: number, params: string): boolean Sends an event to the component with the specified ID. +This API is used only for test purposes. + **Parameters** | Name | Type | Mandatory | Description | @@ -73,6 +79,8 @@ sendTouchEvent(event: TouchObject): boolean Sends a touch event. +This API is used only for test purposes. + **Parameters** | Name | Type | Mandatory | Description | @@ -91,6 +99,8 @@ sendKeyEvent(event: KeyEvent): boolean Sends a key event. +This API is used only for test purposes. + **Parameters** | Name | Type | Mandatory | Description | @@ -109,6 +119,8 @@ sendMouseEvent(event: MouseEvent): boolean Sends a mouse event. +This API is used only for test purposes. + **Parameters** | Name | Type | Mandatory | Description |