mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!39643 修改OH_ArkUI_DragEvent_GetUdmfData接口不能获取数据的问题
Merge pull request !39643 from Zhang Jinyu/0805
This commit is contained in:
commit
189536e4e7
@ -225,6 +225,7 @@ struct ArkUIMouseEvent {
|
||||
struct ArkUIDragEvent {
|
||||
void* unifiedData;
|
||||
void* unifiedDataSummary;
|
||||
bool isSuitGetData;
|
||||
ArkUI_Int32 dragResult;
|
||||
ArkUI_Float64 touchPointX;
|
||||
ArkUI_Float64 touchPointY;
|
||||
|
@ -135,6 +135,7 @@ void SetOnDragDrop(ArkUINodeHandle node, void* extraParam)
|
||||
std::vector<std::string> keepStr(summary.size());
|
||||
|
||||
SetDragEventProperty(info, event, strList, keepStr);
|
||||
event.dragEvent.isSuitGetData = true;
|
||||
|
||||
auto unifiedData = UdmfClient::GetInstance()->TransformUnifiedDataPtr(info->GetData());
|
||||
|
||||
@ -167,6 +168,7 @@ void SetOnDragStart(ArkUINodeHandle node, void* extraParam)
|
||||
std::vector<std::string> keepStr(summary.size());
|
||||
|
||||
SetDragEventProperty(info, event, strList, keepStr);
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
SendArkUIAsyncEvent(&event);
|
||||
@ -201,6 +203,7 @@ void SetOnDragEnter(ArkUINodeHandle node, void* extraParam)
|
||||
auto unifiedData = UdmfClient::GetInstance()->TransformUnifiedDataPtr(info->GetData());
|
||||
event.dragEvent.dragBehavior = static_cast<ArkUI_Int32>(DragBehavior::UNKNOWN);
|
||||
event.dragEvent.unifiedData = unifiedData;
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
SendArkUIAsyncEvent(&event);
|
||||
@ -231,6 +234,8 @@ void SetOnDragMove(ArkUINodeHandle node, void* extraParam)
|
||||
auto unifiedData = UdmfClient::GetInstance()->TransformUnifiedDataPtr(info->GetData());
|
||||
event.dragEvent.dragBehavior = static_cast<ArkUI_Int32>(DragBehavior::UNKNOWN);
|
||||
event.dragEvent.unifiedData = unifiedData;
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
SendArkUIAsyncEvent(&event);
|
||||
info->SetResult(static_cast<DragRet>(event.dragEvent.dragResult));
|
||||
@ -261,6 +266,8 @@ void SetOnDragLeave(ArkUINodeHandle node, void* extraParam)
|
||||
auto unifiedData = UdmfClient::GetInstance()->TransformUnifiedDataPtr(info->GetData());
|
||||
event.dragEvent.dragBehavior = static_cast<ArkUI_Int32>(DragBehavior::UNKNOWN);
|
||||
event.dragEvent.unifiedData = unifiedData;
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
SendArkUIAsyncEvent(&event);
|
||||
info->SetResult(static_cast<DragRet>(event.dragEvent.dragResult));
|
||||
@ -301,6 +308,7 @@ void SetOnDragEnd(ArkUINodeHandle node, void* extraParam)
|
||||
auto unifiedData = UdmfClient::GetInstance()->TransformUnifiedDataPtr(info->GetData());
|
||||
|
||||
event.dragEvent.unifiedData = unifiedData;
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
// Did NOT define pressCode, so will NOT pass presscode to UI.
|
||||
event.dragEvent.dragResult = static_cast<ArkUI_Int32>(info->GetResult());
|
||||
@ -326,6 +334,8 @@ void SetOnPreDrag(ArkUINodeHandle node, void* extraParam)
|
||||
|
||||
// Did NOT define pressCode, so will NOT pass presscode to UI.
|
||||
event.componentAsyncEvent.data[0].i32 = static_cast<ArkUI_Int32>(preDragStatus);
|
||||
event.dragEvent.isSuitGetData = false;
|
||||
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
SendArkUIAsyncEvent(&event);
|
||||
};
|
||||
|
@ -70,9 +70,8 @@ int32_t OH_ArkUI_DragEvent_GetUdmfData(ArkUI_DragEvent* event, OH_UdmfData* data
|
||||
if (!event || !dragEvent || (dragEvent->unifiedData == nullptr) || !data) {
|
||||
return ARKUI_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
auto rawData = reinterpret_cast<OH_UdmfData*>(dragEvent->unifiedData);
|
||||
auto raw = dynamic_cast<OH_UdmfData*>(rawData);
|
||||
if (raw) {
|
||||
|
||||
if (!(dragEvent->isSuitGetData)) {
|
||||
return ARKUI_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
auto unifiedData =
|
||||
|
Loading…
Reference in New Issue
Block a user