From db3f5e76f49d06ae034c5fbc6edda0e5744c9fd3 Mon Sep 17 00:00:00 2001 From: zhou-chaobo Date: Mon, 4 Aug 2025 19:23:57 +0800 Subject: [PATCH] CAPI:add hasAxis interface Signed-off-by: zhou-chaobo --- arkui/ace_engine/native/libace.ndk.json | 4 ++++ arkui/ace_engine/native/ui_input_event.h | 25 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3c739a283..b9e75ed95 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -171,6 +171,10 @@ "first_introduced": "15", "name": "OH_ArkUI_AxisEvent_GetAxisAction" }, + { + "first_introduced": "21", + "name": "OH_ArkUI_AxisEvent_HasAxis" + }, { "first_introduced": "12", "name": "OH_ArkUI_GetNodeHandleFromNapiValue" diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index a13728fe5..2e1ca6407 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -37,6 +37,7 @@ #define _ARKUI_UI_INPUT_EVENT_H_ #include "native_type.h" +#include #include #ifdef __cplusplus @@ -247,6 +248,20 @@ enum { UI_FOCUS_AXIS_EVENT_ABS_HAT0Y = 7, }; +/** + * @brief Defines an enum for the axis types for axis events. + * + * @since 21 + */ +enum { + /** Vertical scroll axis. */ + UI_AXIS_TYPE_VERTICAL_AXIS = 0, + /** Horizontal scroll axis. */ + UI_AXIS_TYPE_HORIZONTAL_AXIS = 1, + /** Pinch axis. */ + UI_AXIS_TYPE_PINCH_AXIS = 2, +}; + /** * @brief Defines whether the touch event is from the left or right hand. * @@ -992,6 +1007,16 @@ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event */ int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event); +/** + * @brief Checks whether this event contains a specified axis type. + * + * @param event Indicates the pointer to the current UI input event. + * @param axis Axis type of the axis event. + * @return Returns true if the event contains the specified axis type; returns false otherwise. + * @since 21 + */ +int32_t OH_ArkUI_AxisEvent_HasAxis(const ArkUI_UIInputEvent* event, int32_t axis); + /** * @brief Sets the hit testing mode, that is, how the component behaves during hit testing. * This API only applies to scenarios raw input events are received, such as when {@link NODE_ON_TOUCH} is used for -- Gitee