diff --git a/adapter/ohos/entrance/ace_container.cpp b/adapter/ohos/entrance/ace_container.cpp index 242381cd11808be9e20ca1e02815ee8edf789f82..a464d93344c1e8f9ccd2905f86c0b5b6338201ed 100644 --- a/adapter/ohos/entrance/ace_container.cpp +++ b/adapter/ohos/entrance/ace_container.cpp @@ -3781,6 +3781,8 @@ bool AceContainer::GetCurPointerEventInfo(DragPointerEvent& dragPointerEvent, St dragPointerEvent.displayY = pointerItem.GetDisplayY(); dragPointerEvent.windowX = pointerItem.GetWindowX(); dragPointerEvent.windowY = pointerItem.GetWindowY(); + dragPointerEvent.globalDisplayX = pointerItem.GetGlobalX(); + dragPointerEvent.globalDisplayY = pointerItem.GetGlobalY(); dragPointerEvent.deviceId = pointerItem.GetDeviceId(); dragPointerEvent.sourceTool = static_cast(pointerItem.GetToolType()); dragPointerEvent.displayId = currentPointerEvent->GetTargetDisplayId(); @@ -3829,6 +3831,8 @@ bool AceContainer::GetLastMovingPointerPosition(DragPointerEvent& dragPointerEve dragPointerEvent.displayY = pointerItem.GetDisplayY(); dragPointerEvent.windowX = pointerItem.GetWindowX(); dragPointerEvent.windowY = pointerItem.GetWindowY(); + dragPointerEvent.globalDisplayX = pointerItem.GetGlobalX(); + dragPointerEvent.globalDisplayY = pointerItem.GetGlobalY(); return true; } diff --git a/adapter/ohos/entrance/mmi_event_convertor.cpp b/adapter/ohos/entrance/mmi_event_convertor.cpp index 5fac041735d1c3f5b854d35ca31002b62ef386de..f9318a77e538903bd9e005aedc5df03a61f79472 100644 --- a/adapter/ohos/entrance/mmi_event_convertor.cpp +++ b/adapter/ohos/entrance/mmi_event_convertor.cpp @@ -779,6 +779,8 @@ void ConvertPointerEvent(const std::shared_ptr& pointerEvent, event.windowY = pointerItem.GetWindowY(); event.displayX = pointerItem.GetDisplayX(); event.displayY = pointerItem.GetDisplayY(); + event.globalDisplayX = pointerItem.GetGlobalX(); + event.globalDisplayY = pointerItem.GetGlobalY(); event.displayId = pointerEvent->GetTargetDisplayId(); event.size = std::max(pointerItem.GetWidth(), pointerItem.GetHeight()) / SIZE_DIVIDE; event.force = static_cast(pointerItem.GetPressure()); diff --git a/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.cpp b/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.cpp index 2705e43c5e65129226d4592dd82dc4e98946d128..04a4385c1d90c22248684ffdaaf12efafff90a2c 100644 --- a/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.cpp +++ b/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.cpp @@ -107,6 +107,8 @@ void JsDragEvent::JSBind(BindingTarget globalObj) JSClass::CustomMethod("getPasteData", &JsDragEvent::GetJsPasteData); JSClass::CustomMethod("getDisplayX", &JsDragEvent::GetScreenX); JSClass::CustomMethod("getDisplayY", &JsDragEvent::GetScreenY); + JSClass::CustomMethod("getGlobalDisplayX", &JsDragEvent::GetGlobalDisplayX); + JSClass::CustomMethod("getGlobalDisplayY", &JsDragEvent::GetGlobalDisplayY); JSClass::CustomMethod("getDragSource", &JsDragEvent::GetDragSource); JSClass::CustomMethod("isRemote", &JsDragEvent::IsRemote); JSClass::CustomMethod("getWindowX", &JsDragEvent::GetX); @@ -168,6 +170,20 @@ void JsDragEvent::GetScreenY(const JSCallbackInfo& args) args.SetReturnValue(yValueRef); } +void JsDragEvent::GetGlobalDisplayX(const JSCallbackInfo& args) +{ + auto xValue = JSVal(ToJSValue(PipelineBase::Px2VpWithCurrentDensity(dragEvent_->GetGlobalDisplayX()))); + auto xValueRef = JSRef::Make(xValue); + args.SetReturnValue(xValueRef); +} + +void JsDragEvent::GetGlobalDisplayY(const JSCallbackInfo& args) +{ + auto yValue = JSVal(ToJSValue(PipelineBase::Px2VpWithCurrentDensity(dragEvent_->GetGlobalDisplayY()))); + auto yValueRef = JSRef::Make(yValue); + args.SetReturnValue(yValueRef); +} + void JsDragEvent::GetDragSource(const JSCallbackInfo& args) { JSRef dragSource = JSRef::Make(ToJSValue(dragEvent_->GetDragSource())); diff --git a/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.h b/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.h index 2693fede315e456dd88252b27c33496901814bc8..2dd55561fb1e096d107f552a95adbbb8ade31b71 100644 --- a/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.h +++ b/frameworks/bridge/declarative_frontend/engine/functions/js_drag_function.h @@ -54,6 +54,8 @@ public: void GetJsPasteData(const JSCallbackInfo& args); void GetScreenX(const JSCallbackInfo& args); void GetScreenY(const JSCallbackInfo& args); + void GetGlobalDisplayX(const JSCallbackInfo& args); + void GetGlobalDisplayY(const JSCallbackInfo& args); void GetDisplayId(const JSCallbackInfo& args); void GetX(const JSCallbackInfo& args); void GetY(const JSCallbackInfo& args); diff --git a/frameworks/core/components_ng/event/gesture_event_hub_drag.cpp b/frameworks/core/components_ng/event/gesture_event_hub_drag.cpp index d51b30e5e7ece38764328626803f24c66a073f4c..236bcee598638ff285af0eb9eec9ddf86fe6d925 100644 --- a/frameworks/core/components_ng/event/gesture_event_hub_drag.cpp +++ b/frameworks/core/components_ng/event/gesture_event_hub_drag.cpp @@ -1189,6 +1189,8 @@ void GestureEventHub::HandleOnDragEnd(const GestureEvent& info) } event->SetScreenX(info.GetScreenLocation().GetX()); event->SetScreenY(info.GetScreenLocation().GetY()); + event->SetGlobalDisplayX(info.GetGlobalDisplayLocation().GetX()); + event->SetGlobalDisplayY(info.GetGlobalDisplayLocation().GetY()); event->SetPressedKeyCodes(info.GetPressedKeyCodes()); eventHub->FireCustomerOnDragFunc(DragFuncType::DRAG_DROP, event); eventHub->HandleInternalOnDrop(event, ""); @@ -1820,6 +1822,8 @@ RefPtr GestureEventHub::CreateDragEvent(const GestureEvent event->SetScreenY(info.GetScreenLocation().GetY()); event->SetDisplayX(info.GetScreenLocation().GetX()); event->SetDisplayY(info.GetScreenLocation().GetY()); + event->SetGlobalDisplayX(info.GetGlobalDisplayLocation().GetX()); + event->SetGlobalDisplayY(info.GetGlobalDisplayLocation().GetY()); event->SetSourceTool(info.GetSourceTool()); auto container = Container::Current(); CHECK_NULL_RETURN(container, event); diff --git a/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp b/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp index 83267fa966917480082d5991df3f9abe14c556c3..e23921c44c8e535198fc81cb793d9ad41a9ba5c0 100644 --- a/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp +++ b/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp @@ -488,6 +488,7 @@ GestureEvent ClickRecognizer::GetGestureEventInfo() info.SetTimeStamp(touchPoint.time); info.SetScreenLocation(touchPoint.GetScreenOffset()); info.SetGlobalLocation(touchPoint.GetOffset()).SetLocalLocation(Offset(localPoint.GetX(), localPoint.GetY())); + info.SetGlobalDisplayLocation(touchPoint.GetGlobalDisplayOffset()); info.SetSourceDevice(deviceType_); info.SetDeviceId(deviceId_); info.SetTarget(GetEventTarget().value_or(EventTarget())); diff --git a/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp b/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp index e4e198a86616c900427cc46e9e0f7ca38573cc99..a0f120e82623e7363e9d6f29f4f2fed77a9605dc 100644 --- a/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp +++ b/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp @@ -410,6 +410,7 @@ void LongPressRecognizer::SendCallbackMsg( info.SetScreenLocation(lastTouchEvent_.GetScreenOffset()); info.SetGlobalLocation(lastTouchEvent_.GetOffset()) .SetLocalLocation(lastTouchEvent_.GetOffset() - coordinateOffset_); + info.SetGlobalDisplayLocation(lastTouchEvent_.GetGlobalDisplayOffset()); info.SetTarget(GetEventTarget().value_or(EventTarget())); info.SetForce(lastTouchEvent_.force); if (lastTouchEvent_.tiltX.has_value()) { diff --git a/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp b/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp index 0d1641baebbee1e87e0218a0d307e0fd2756cba1..fabfd0a7d5f946d9a1ecf960c98b2702497e6d47 100644 --- a/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp +++ b/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp @@ -776,6 +776,7 @@ GestureEvent PanRecognizer::GetGestureEventInfo() info.SetMainDelta(mainDelta_ / static_cast(touchPoints_.size())); if (inputEventType_ == InputEventType::AXIS) { info.SetScreenLocation(lastAxisEvent_.GetScreenOffset()); + info.SetGlobalDisplayLocation(lastAxisEvent_.GetGlobalDisplayOffset()); info.SetSourceTool(lastAxisEvent_.sourceTool); info.SetVerticalAxis(lastAxisEvent_.verticalAxis); info.SetHorizontalAxis(lastAxisEvent_.horizontalAxis); @@ -784,6 +785,7 @@ GestureEvent PanRecognizer::GetGestureEventInfo() info.CopyConvertInfoFrom(lastAxisEvent_.convertInfo); } else { info.SetScreenLocation(lastTouchEvent_.GetScreenOffset()); + info.SetGlobalDisplayLocation(lastTouchEvent_.GetGlobalDisplayOffset()); info.SetSourceTool(lastTouchEvent_.sourceTool); info.SetPressedKeyCodes(lastTouchEvent_.pressedKeyCodes_); info.SetPointerEventId(lastTouchEvent_.touchEventId); diff --git a/frameworks/core/components_ng/manager/drag_drop/drag_drop_func_wrapper.cpp b/frameworks/core/components_ng/manager/drag_drop/drag_drop_func_wrapper.cpp index 8336d9e53a7d0dfb6ddd925a1aaae28dd18b0e6b..81b06a591219e1f2de23bb4ecd46a3061e8574ea 100644 --- a/frameworks/core/components_ng/manager/drag_drop/drag_drop_func_wrapper.cpp +++ b/frameworks/core/components_ng/manager/drag_drop/drag_drop_func_wrapper.cpp @@ -724,6 +724,8 @@ void DragDropFuncWrapper::ConvertPointerEvent(const TouchEvent& touchPoint, Drag event.windowY = touchPoint.y; event.displayX = touchPoint.screenX; event.displayY = touchPoint.screenY; + event.globalDisplayX = touchPoint.globalDisplayX; + event.globalDisplayY = touchPoint.globalDisplayY; event.deviceId = touchPoint.deviceId; event.displayId = touchPoint.targetDisplayId; event.x = event.windowX; diff --git a/frameworks/core/components_ng/manager/drag_drop/drag_drop_manager.cpp b/frameworks/core/components_ng/manager/drag_drop/drag_drop_manager.cpp index fcc20c0c396430a6e060863cf32fca681b1e069f..c7f47cd6a3c68788f8514c4d4cb870cc872b5fc1 100644 --- a/frameworks/core/components_ng/manager/drag_drop/drag_drop_manager.cpp +++ b/frameworks/core/components_ng/manager/drag_drop/drag_drop_manager.cpp @@ -2053,6 +2053,8 @@ void DragDropManager::UpdateNotifyDragEvent( notifyEvent->SetY((double)point.GetY()); notifyEvent->SetScreenX((double)point.GetScreenX()); notifyEvent->SetScreenY((double)point.GetScreenY()); + notifyEvent->SetGlobalDisplayX((double)point.GetGlobalDisplayX()); + notifyEvent->SetGlobalDisplayY((double)point.GetGlobalDisplayY()); if (dragEventType != DragEventType::START) { if (dragEventType != DragEventType::DROP) { notifyEvent->SetVelocity(velocityTracker_.GetVelocity()); @@ -2072,6 +2074,8 @@ void DragDropManager::UpdateDragEvent( event->SetScreenY(point.GetScreenY()); event->SetDisplayX((double)pointerEvent.GetDisplayX()); event->SetDisplayY((double)pointerEvent.GetDisplayY()); + event->SetGlobalDisplayX(pointerEvent.GetGlobalDisplayX()); + event->SetGlobalDisplayY(pointerEvent.GetGlobalDisplayY()); event->SetVelocity(velocityTracker_.GetVelocity()); event->SetSummary(summaryMap_); event->SetPreviewRect(GetDragWindowRect(point)); @@ -2448,11 +2452,13 @@ void DragDropManager::InitDragAnimationPointerEvent(const GestureEvent& event, b if (isDragStartPending) { auto dragMoveLastPoint = GetDragMoveLastPointByCurrentPointer(event.GetPointerId()); dragAnimationPointerEvent_ = DragPointerEvent(dragMoveLastPoint.GetX(), - dragMoveLastPoint.GetY(), dragMoveLastPoint.GetScreenX(), dragMoveLastPoint.GetScreenY()); + dragMoveLastPoint.GetY(), dragMoveLastPoint.GetScreenX(), dragMoveLastPoint.GetScreenY(), + dragMoveLastPoint.GetGlobalDisplayX(), dragMoveLastPoint.GetGlobalDisplayY()); return; } dragAnimationPointerEvent_ = DragPointerEvent(event.GetGlobalLocation().GetX(), - event.GetGlobalLocation().GetY(), event.GetScreenLocation().GetX(), event.GetScreenLocation().GetY()); + event.GetGlobalLocation().GetY(), event.GetScreenLocation().GetX(), event.GetScreenLocation().GetY(), + event.GetGlobalDisplayLocation().GetX(), event.GetGlobalDisplayLocation().GetY()); } void DragDropManager::DoDragStartAnimation(const RefPtr& overlayManager, const GestureEvent& event, @@ -3241,7 +3247,7 @@ void DragDropManager::HandleTouchEvent(const TouchEvent& event) if (!IsDragging() || !IsSameDraggingPointer(event.id)) { return; } - auto pointerEvent = DragPointerEvent(event.x, event.y, event.screenX, event.screenY); + auto pointerEvent = DragPointerEvent(event.x, event.y, event.screenX, event.screenY, event.globalDisplayX, event.globalDisplayX); SetDragAnimationPointerEvent(pointerEvent); } else if ((event.type == TouchType::UP) || (event.type == TouchType::CANCEL)) { ResetDraggingStatus(event); diff --git a/frameworks/core/components_ng/manager/drag_drop/drag_drop_proxy.cpp b/frameworks/core/components_ng/manager/drag_drop/drag_drop_proxy.cpp index fc48d5ab1897b63a79d608d0e0a43e7e6f6a5014..cc125cf260d5a5a783fb759f5c26e6ef3d141d6d 100644 --- a/frameworks/core/components_ng/manager/drag_drop/drag_drop_proxy.cpp +++ b/frameworks/core/components_ng/manager/drag_drop/drag_drop_proxy.cpp @@ -47,7 +47,7 @@ void HandleExtraDragMoveReporting(const RefPtr& frameNode, const std: CHECK_NULL_VOID(dragDropManager); auto touchDownPoint = actuator->GetTouchDownPoint(); auto pointerEvent = DragPointerEvent(touchDownPoint.x, touchDownPoint.y, - touchDownPoint.screenX, touchDownPoint.screenY); + touchDownPoint.screenX, touchDownPoint.screenY, touchDownPoint.globalDisplayX, touchDownPoint.globalDisplayY); dragDropManager->OnDragMove(pointerEvent, extraInfo); } @@ -63,7 +63,8 @@ void DragDropProxy::OnDragStart( auto point = Point(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(), info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()); auto pointerEvent = DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(), - info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()); + info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY(), + info.GetGlobalDisplayLocation().GetX(), info.GetGlobalDisplayLocation().GetY()); pointerEvent.UpdatePressedKeyCodes(info.GetPressedKeyCodes()); manager->OnDragStart(point, frameNode); manager->SetExtraInfo(extraInfo); @@ -84,7 +85,8 @@ void DragDropProxy::OnDragMove(const GestureEvent& info) std::string extraInfo = manager->GetExtraInfo(); manager->OnDragMove(DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(), - info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()), extraInfo); + info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY(), + info.GetGlobalDisplayLocation().GetX(), info.GetGlobalDisplayLocation().GetY()), extraInfo); } void DragDropProxy::OnDragEnd(const GestureEvent& info, bool isTextDragEnd) @@ -100,7 +102,8 @@ void DragDropProxy::OnDragEnd(const GestureEvent& info, bool isTextDragEnd) static_cast(info.GetGlobalPoint().GetY()), extraInfo); } else { manager->OnDragEnd(DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(), - info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()), extraInfo); + info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY(), + info.GetGlobalDisplayLocation().GetX(), info.GetGlobalDisplayLocation().GetY()), extraInfo); } } diff --git a/frameworks/core/event/pointer_event.h b/frameworks/core/event/pointer_event.h index 490c1719e4459eb0543feeed2f0e197bda7d5c5a..443c650f7a2dcd4883c22a2560eebef29928697e 100644 --- a/frameworks/core/event/pointer_event.h +++ b/frameworks/core/event/pointer_event.h @@ -66,6 +66,8 @@ struct DragPointerEvent final : public PointerEvent { int32_t windowY = 0; int32_t displayX = 0; int32_t displayY = 0; + double globalDisplayX = 0.0; + double globalDisplayY = 0.0; double size = 0.0; float force = 0.0f; int32_t deviceId = 0; @@ -90,6 +92,13 @@ struct DragPointerEvent final : public PointerEvent { DragPointerEvent(int32_t pointerEventId, int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY) : pointerEventId(pointerEventId), windowX(windowX), windowY(windowY), displayX(displayX), displayY(displayY) {} + DragPointerEvent(int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY, double globalDisplayX, double globalDisplayY) + : windowX(windowX), windowY(windowY), displayX(displayX), displayY(displayY), globalDisplayX(globalDisplayX), globalDisplayY(globalDisplayY) + {} + DragPointerEvent(int32_t pointerEventId, int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY, + double globalDisplayX, double globalDisplayY) : pointerEventId(pointerEventId), windowX(windowX), windowY(windowY), + displayX(displayX), displayY(displayY), globalDisplayX(globalDisplayX), globalDisplayY(globalDisplayY) + {} Point GetPoint() const { @@ -110,6 +119,16 @@ struct DragPointerEvent final : public PointerEvent { return displayY; } + double GetGlobalDisplayX() const + { + return globalDisplayX; + } + + double GetGlobalDisplayY() const + { + return globalDisplayY; + } + int32_t GetDisplayId() const { return displayId; diff --git a/frameworks/core/gestures/drag_event.h b/frameworks/core/gestures/drag_event.h index 303308c38674c0e904d230b5579bc1feb9239223..a7ad9373f5ec33f213e4a75522c3b50eede78ca1 100644 --- a/frameworks/core/gestures/drag_event.h +++ b/frameworks/core/gestures/drag_event.h @@ -173,6 +173,26 @@ public: displayY_ = y; } + double GetGlobalDisplayX() const + { + return globalDisplayX_; + } + + double GetGlobalDisplayY() const + { + return globalDisplayY_; + } + + void SetGlobalDisplayX(double x) + { + globalDisplayX_ = x; + } + + void SetGlobalDisplayY(double y) + { + globalDisplayY_ = y; + } + void SetDescription(const std::string& description) { description_ = description; @@ -397,6 +417,8 @@ private: double y_ = 0.0; double displayX_ = 0.0; double displayY_ = 0.0; + double globalDisplayX_ = 0.0; + double globalDisplayY_ = 0.0; std::string description_; RefPtr pixelMap_; std::map summary_; diff --git a/frameworks/core/gestures/gesture_event.h b/frameworks/core/gestures/gesture_event.h index cb6b9205623af8ee7b8ce509396b77d4b204a3f6..acfe457781b795d2c890f52e935fa9975850ea2a 100644 --- a/frameworks/core/gestures/gesture_event.h +++ b/frameworks/core/gestures/gesture_event.h @@ -126,6 +126,17 @@ public: return globalLocation_; } + GestureEvent& SetGlobalDisplayLocation(const Offset& globalDisplayLocation) + { + globalDisplayLocation_ = globalDisplayLocation; + return *this; + } + + const Offset& GetGlobalDisplayLocation() const + { + return globalDisplayLocation_; + } + const Offset& GetPinchCenter() const { return pinchCenter_; @@ -364,6 +375,7 @@ private: Offset localLocation_; // Will be used in drag. Offset screenLocation_; + Offset globalDisplayLocation_; // Raw last touchPoint global location. Offset rawGlobalLocation_; Offset pinchCenter_; diff --git a/frameworks/core/gestures/long_press_recognizer.cpp b/frameworks/core/gestures/long_press_recognizer.cpp index 14c253a47288cf40d906302179b4bf56a284f20e..ded228592d32e8aedebe5b0ab55f58e234ebe2a0 100644 --- a/frameworks/core/gestures/long_press_recognizer.cpp +++ b/frameworks/core/gestures/long_press_recognizer.cpp @@ -245,6 +245,7 @@ void LongPressRecognizer::SendCallbackMsg(const std::unique_ptr& info, ArkUINodeEve event.dragEvent.displayY = info->GetDisplayY(); event.dragEvent.screenX = info->GetScreenX(); event.dragEvent.screenY = info->GetScreenY(); + event.dragEvent.globalDisplayX = info->GetGlobalDisplayX(); + event.dragEvent.globalDisplayY = info->GetGlobalDisplayY(); event.dragEvent.previewRectWidth = info->GetPreviewRect().Width(); event.dragEvent.previewRectHeight = info->GetPreviewRect().Height(); diff --git a/interfaces/native/drag_and_drop.h b/interfaces/native/drag_and_drop.h index 8f1724100191ae0ae49b88378e626b864c70835b..7543724d4c491ca9188e905f5898f682d0a28edd 100644 --- a/interfaces/native/drag_and_drop.h +++ b/interfaces/native/drag_and_drop.h @@ -414,6 +414,9 @@ float OH_ArkUI_DragEvent_GetTouchPointXToDisplay(ArkUI_DragEvent* event); */ float OH_ArkUI_DragEvent_GetTouchPointYToDisplay(ArkUI_DragEvent* event); +float OH_ArkUI_DragEvent_GetTouchPointXToGlobalDisplay(ArkUI_DragEvent* event); +float OH_ArkUI_DragEvent_GetTouchPointYToGlobalDisplay(ArkUI_DragEvent* event); + /** * @brief Obtains the dragging velocity along the x-axis. * diff --git a/interfaces/native/event/drag_and_drop_impl.cpp b/interfaces/native/event/drag_and_drop_impl.cpp index 5e8227e475e0f8eed8c95d6afe3464f7c3b6662d..978cf5ee04d519e525cea024763cac7d5dfbbc43 100644 --- a/interfaces/native/event/drag_and_drop_impl.cpp +++ b/interfaces/native/event/drag_and_drop_impl.cpp @@ -687,6 +687,26 @@ float OH_ArkUI_DragEvent_GetTouchPointYToDisplay(ArkUI_DragEvent* event) return result; } +float OH_ArkUI_DragEvent_GetTouchPointXToGllobalDisplay(ArkUI_DragEvent* event) +{ + if (!event) { + return 0.0f; + } + auto* dragEvent = reinterpret_cast(event); + auto result = static_cast(dragEvent->globalDisplayX); + return result; +} + +float OH_ArkUI_DragEvent_GetTouchPointYToGlobalDisplay(ArkUI_DragEvent* event) +{ + if (!event) { + return 0.0f; + } + auto* dragEvent = reinterpret_cast(event); + auto result = static_cast(dragEvent->globalDisplayY); + return result; +} + float OH_ArkUI_DragEvent_GetVelocityX(ArkUI_DragEvent* event) { if (!event) {