diff --git a/arkui/ace_engine/native/drag_and_drop.h b/arkui/ace_engine/native/drag_and_drop.h index a006c72b7f750430aeb26d114416923ab9fa4c2b..1930df2fa53bb22cbe6ba6a778f085a3acab58f9 100644 --- a/arkui/ace_engine/native/drag_and_drop.h +++ b/arkui/ace_engine/native/drag_and_drop.h @@ -391,6 +391,26 @@ float OH_ArkUI_DragEvent_GetTouchPointXToDisplay(ArkUI_DragEvent* event); */ float OH_ArkUI_DragEvent_GetTouchPointYToDisplay(ArkUI_DragEvent* event); +/** + * @brief Obtains the global display X coordinate of the touch point from an ArkUI_DragEvent object. + * + * @param event Pointer to an ArkUI_DragEvent object. + * @return float Global display X coordinate of the touch point, in px. + * If the input parameter is invalid, the default value 0 is returned. + * @since 20 + */ +float OH_ArkUI_DragEvent_GetTouchPointXToGlobalDisplay(ArkUI_DragEvent* event); + +/** + * @brief Obtains the global display Y coordinate of the touch point from an ArkUI_DragEvent object. + * + * @param event Pointer to an ArkUI_DragEvent object. + * @return float Global display Y coordinate of the touch point, in px. + * If the input parameter is invalid, the default value 0 is returned. + * @since 20 + */ +float OH_ArkUI_DragEvent_GetTouchPointYToGlobalDisplay(ArkUI_DragEvent* event); + /** * @brief Obtains the dragging velocity along the x-axis. * diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index a8f6e0e5c514bee1691e8509bc922d97cb2bb12b..af73b4039ab0e19fe7ee129ee4aab9500e82fe7a 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3423,6 +3423,38 @@ "first_introduced": "20", "name": "OH_ArkUI_SurfaceCallback_SetSurfaceShowEvent" }, + { + "first_introduced": "20", + "name": "OH_ArkUI_DragEvent_GetTouchPointXToGlobalDisplay" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_DragEvent_GetTouchPointYToGlobalDisplay" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetGlobalDisplayX" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetGlobalDisplayY" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetGlobalDisplayXByIndex" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetGlobalDisplayYByIndex" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayX" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayY" + }, { "first_introduced": "20", "name": "OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent" diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index fac4d040d1a31ca20eb17f5dc256ca37526d3917..0f7d3fb738278c7703276d6e6f341966a2e9c7b6 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -526,6 +526,48 @@ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); +/** + * @brief Obtains the global display X coordinate from a pointer event (such as a touch, mouse, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @return float Global display X coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetGlobalDisplayX(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the global display X coordinate of a specific contact point from a pointer event + * (such as a touch, mouse, or axis event). + * For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0. + * + * @param event Pointer to the current UI input event. + * @param pointerIndex Index of the target contact point in the contact point list. + * @return float Global display X coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetGlobalDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the global display Y coordinate from a pointer event (such as a touch, mouse, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @return float Global display Y coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetGlobalDisplayY(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the global display Y coordinate of a specific contact point from a pointer event + * (such as a touch, mouse, or axis event). + * For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0. + * + * @param event Pointer to the current UI input event. + * @param pointerIndex Index of the target contact point in the contact point list. + * @return float Global display Y coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetGlobalDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event). * @@ -758,6 +800,32 @@ float OH_ArkUI_PointerEvent_GetHistoryDisplayX( float OH_ArkUI_PointerEvent_GetHistoryDisplayY( const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); +/** + * @brief Obtains the global display X coordinate of a specific touch point in a historical event from a pointer event + * (such as a touch, mouse, or axis event). + * + * @param event Pointer to the current UI input event. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @param historyIndex Index of the target historical event. + * @return float Global display X coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayX( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the global display Y coordinate of a specific touch point in a historical event from a pointer event + * (such as a touch, mouse, or axis event). + * + * @param event Pointer to the current UI input event. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @param historyIndex Index of the target historical event. + * @return float Global display Y coordinate; 0.0f if any parameter error occurs. + * @since 20 + */ +float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayY( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + /** * @brief Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event * (for example, a touch event)..