diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index 35dac3924d75d777b705ff8a71685073e42edfd6..03b43b1d24db640ee85e4a79d8bd5d0469b3781b 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -625,6 +625,31 @@ typedef struct { * @return Returns the gesture type. */ ArkUI_GestureRecognizerType (*getGestureType)(ArkUI_GestureRecognizer* recognizer); + + /** + * @brief Creates a tap gesture that is subject to distance restrictions. + * + * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n + * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n + * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, + * gesture recognition fails. \n + * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers + * touching the screen within 300 ms of the first finger touch 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. \n + * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n + * 6. If the finger moves beyond the preset distance limit, gesture recognition fails. \n + * + * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default + * value 1 is used. + * @param fingersNum Indicates the 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 1 is used. + * @param distanceThreshold Indicates the allowed moving distance of a finger. + * If the value is less than 0 or is not set, it will be converted to the default value of infinity. + * @return Returns the pointer to the created gesture. + */ + ArkUI_GestureRecognizer* (*createTapGestureWithDistanceThreshold)( + int32_t countNum, int32_t fingersNum, double distanceThreshold); } ArkUI_NativeGestureAPI_1; #ifdef __cplusplus diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index c6028a28799b427b958b166933fba803de963965..f707e5c419e2ea6766a76c325605c5a8b31c41c9 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -1796,6 +1796,16 @@ typedef enum { */ NODE_UNIQUE_ID = 95, + /** + * @brief Defines the moving distance limit for the component-bound tap gesture. + * This attribute can be set as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: allowed moving distance of a finger, in vp. \n + * + */ + NODE_CLICK_DISTANCE = 96, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. *