ArkUI_NativeGestureAPI_2

typedef struct {...} ArkUI_NativeGestureAPI_2

Overview

Defines a collection of gesture APIs.

Since: 18

Related module: ArkUI_NativeModule

Header file: native_gesture.h

Summary

Member Variables

Name Description
ArkUI_NativeGestureAPI_1* gestureApi1 Pointer to the ArkUI_NativeGestureAPI_1 struct.

Member Functions

Name Description
int32_t (*setGestureInterrupterToNode)(ArkUI_NodeHandle node, void* userData,ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info)) Sets the callback for gesture interruption events.

Member Function Description

setGestureInterrupterToNode()

int32_t (*setGestureInterrupterToNode)(ArkUI_NodeHandle node, void* userData, ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info))

Description

Sets the callback for gesture interruption events.

Parameters

Name Description
ArkUI_NodeHandle node Pointer to the ArkUI node for which you want to set a gesture interruption callback.
void* userData Pointer to user-defined data.
ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info) Gesture interruption callback to set. info returns the gesture interruption data. If interrupter returns GESTURE_INTERRUPT_RESULT_CONTINUE, the gesture recognition process continues. If it returns GESTURE_INTERRUPT_RESULT_REJECT, the gesture recognition process is paused. If this parameter is set to a null pointer, the callback function is unregistered.
Note: After the event interruption callback is registered, it will be available in subsequent single-gesture processing. That is, even if you use the setGestureInterrupterToNode API to reset the gesture interruption callback to undefined or use the dispose API to dispose of the gesture that is about to be triggered, the callback will still respond when the trigger condition is met. If the object used in the callback has been released before the callback is triggered, you need to protect the object.

Return value

Type Description
int32_t Error code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.