mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
!39094 修改主动发起拖拽的capi接口
Merge pull request !39094 from Zhang Jinyu/ptrnull
This commit is contained in:
commit
aad6a4075a
@ -35,11 +35,6 @@ static void DragActionConvert(
|
||||
{
|
||||
internalDragAction->pointer = dragAction->pointerId;
|
||||
internalDragAction->size = dragAction->size;
|
||||
auto* pixelMapTemp = reinterpret_cast<std::shared_ptr<void*>*>(dragAction->pixelmapArray);
|
||||
for (int index = 0; index < dragAction->size; index++) {
|
||||
auto pixelMap = PixelMap::CreatePixelMap(&pixelMapTemp[index]);
|
||||
internalDragAction->pixelMapList.push_back(pixelMap);
|
||||
}
|
||||
internalDragAction->previewOption.isScaleEnabled = dragAction->dragPreviewOption.isScaleEnabled;
|
||||
if (!internalDragAction->previewOption.isScaleEnabled) {
|
||||
internalDragAction->previewOption.isDefaultShadowEnabled = dragAction->dragPreviewOption.isDefaultShadowEnabled;
|
||||
@ -88,6 +83,11 @@ ArkUI_Int32 StartDrag(ArkUIDragAction* dragAction)
|
||||
CHECK_NULL_VOID(listener);
|
||||
listener(&outInfo, userData);
|
||||
};
|
||||
auto* pixelMapTemp = reinterpret_cast<std::shared_ptr<void*>*>(dragAction->pixelmapArray);
|
||||
for (int index = 0; index < dragAction->size; index++) {
|
||||
auto pixelMap = PixelMap::CreatePixelMap(&pixelMapTemp[index]);
|
||||
internalDragAction->pixelMapList.push_back(pixelMap);
|
||||
}
|
||||
internalDragAction->callback = callbacks;
|
||||
DragActionConvert(dragAction, internalDragAction);
|
||||
OHOS::Ace::NG::DragDropFuncWrapper::StartDragAction(internalDragAction);
|
||||
|
@ -178,14 +178,17 @@ int32_t OH_ArkUI_DragAction_SetPixelMaps(ArkUI_DragAction* dragAction, OH_Pixelm
|
||||
if (!dragActions) {
|
||||
return ARKUI_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
std::vector<std::shared_ptr<OHOS::Media::PixelMap>> pixelMapList;
|
||||
int32_t count = 0;
|
||||
for (int32_t index = 0; index < size; index++) {
|
||||
if (!pixelmapArray[index]) {
|
||||
continue;
|
||||
}
|
||||
pixelMapList.push_back(pixelmapArray[index]->GetInnerPixelmap());
|
||||
count++;
|
||||
}
|
||||
dragActions->pixelmapArray = reinterpret_cast<void**>(pixelMapList.data());
|
||||
if (count < size || size < 0) {
|
||||
return ARKUI_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
dragActions->pixelmapArray = reinterpret_cast<void**>(pixelmapArray);
|
||||
dragActions->size = size;
|
||||
return ARKUI_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
@ -297,6 +300,15 @@ int32_t OH_ArkUI_StartDrag(ArkUI_DragAction* dragAction)
|
||||
if (!dragActions || !impl) {
|
||||
return ARKUI_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
std::vector<std::shared_ptr<OHOS::Media::PixelMap>> pixelMapList;
|
||||
auto pixelmapArray = reinterpret_cast<OH_PixelmapNative**>(dragActions->pixelmapArray);
|
||||
for (int32_t index = 0; index < dragActions->size; index++) {
|
||||
if (!pixelmapArray[index]) {
|
||||
continue;
|
||||
}
|
||||
pixelMapList.push_back(pixelmapArray[index]->GetInnerPixelmap());
|
||||
}
|
||||
dragActions->pixelmapArray = reinterpret_cast<void**>(pixelMapList.data());
|
||||
impl->getDragAdapterAPI()->startDrag(dragActions);
|
||||
return ARKUI_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user