!44168 拖拽代码规范整改

Merge pull request !44168 from liukaii/gitee_0921
This commit is contained in:
openharmony_ci 2024-09-29 03:28:30 +00:00 committed by Gitee
commit 094dcf8710
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 73 additions and 68 deletions

View File

@ -249,7 +249,6 @@ void DragEventActuator::OnCollectTouchTarget(const OffsetF& coordinateOffset, co
CHECK_NULL_VOID(gestureHub);
auto frameNode = gestureHub->GetFrameNode();
CHECK_NULL_VOID(frameNode);
auto renderContext = frameNode->GetRenderContext();
if (info.GetSourceDevice() != SourceType::MOUSE) {
if (gestureHub->GetTextDraggable()) {
auto pattern = frameNode->GetPattern<TextBase>();
@ -267,15 +266,9 @@ void DragEventActuator::OnCollectTouchTarget(const OffsetF& coordinateOffset, co
}
} else {
HideEventColumn();
if (gestureHub->GetTextDraggable()) {
HideTextAnimation(true, info.GetGlobalLocation().GetX(), info.GetGlobalLocation().GetY());
} else {
HideFilter();
RecordMenuWrapperNodeForDrag(frameNode->GetId());
SubwindowManager::GetInstance()->HideMenuNG(false, true);
}
}
if (!gestureHub->GetTextDraggable()) {
HideFilter();
RecordMenuWrapperNodeForDrag(frameNode->GetId());
SubwindowManager::GetInstance()->HideMenuNG(false, true);
frameNode->SetOptionsAfterApplied(actuator->GetOptionsAfterApplied());
}
}

View File

@ -160,7 +160,7 @@ void EventHub::SetCustomerOnDragFunc(DragFuncType dragFuncType, OnDragFunc&& onD
customerOnDrop_ = std::move(onDragFunc);
break;
default:
LOGW("unsuport dragFuncType");
TAG_LOGW(AceLogTag::ACE_DRAG, "Unsupported DragFuncType");
break;
}
}
@ -213,7 +213,7 @@ void EventHub::FireCustomerOnDragFunc(DragFuncType dragFuncType, const RefPtr<OH
break;
}
default:
LOGW("unsuport DragFuncType");
TAG_LOGW(AceLogTag::ACE_DRAG, "Unsupported DragFuncType");
break;
}
}
@ -276,6 +276,7 @@ bool EventHub::IsFireOnDrop(const RefPtr<OHOS::Ace::DragEvent>& info)
void EventHub::HandleInternalOnDrop(const RefPtr<OHOS::Ace::DragEvent>& info, const std::string& extraParams)
{
CHECK_NULL_VOID(info);
if (IsFireOnDrop(info)) {
FireOnDrop(info, extraParams);
} else {

View File

@ -223,6 +223,7 @@ int32_t CheckStartAction(std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction>
int32_t DragDropFuncWrapper::StartDragAction(std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction> dragAction)
{
CHECK_NULL_RETURN(dragAction, -1);
auto pipelineContext = PipelineContext::GetContextByContainerId(dragAction->instanceId);
CHECK_NULL_RETURN(pipelineContext, -1);
auto manager = pipelineContext->GetDragDropManager();
@ -266,7 +267,6 @@ int32_t DragDropFuncWrapper::StartDragAction(std::shared_ptr<OHOS::Ace::NG::ArkU
if (dragAction->dragState == DragAdapterState::SENDING) {
dragAction->dragState = DragAdapterState::SUCCESS;
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
auto pipelineContext = container->GetPipelineContext();
pipelineContext->OnDragEvent(
{ dragAction->x, dragAction->y }, DragEventAction::DRAG_EVENT_START_FOR_CONTROLLER);
NG::DragDropFuncWrapper::DecideWhetherToStopDragging(

View File

@ -519,6 +519,7 @@ void DragDropManager::UpdateDragStyle(const DragCursorStyleCore& dragStyle, int3
bool CheckParentVisible(const RefPtr<FrameNode>& frameNode)
{
CHECK_NULL_RETURN(frameNode, false);
bool isVisible = frameNode->IsVisible();
if (!isVisible) {
return false;
@ -576,6 +577,7 @@ void DragDropManager::UpdateDragListener(const Point& point)
}
}
RefPtr<NotifyDragEvent> notifyEvent = AceType::MakeRefPtr<NotifyDragEvent>();
CHECK_NULL_VOID(notifyEvent);
UpdateNotifyDragEvent(notifyEvent, point, DragEventType::MOVE);
NotifyDragRegisterFrameNode(dragMoveNodes, DragEventType::MOVE, notifyEvent);
@ -608,6 +610,7 @@ void DragDropManager::NotifyDragFrameNode(
const Point& point, const DragEventType& dragEventType, const DragRet& dragRet)
{
RefPtr<NotifyDragEvent> notifyEvent = AceType::MakeRefPtr<NotifyDragEvent>();
CHECK_NULL_VOID(notifyEvent);
UpdateNotifyDragEvent(notifyEvent, point, dragEventType);
notifyEvent->SetResult(dragRet);
NotifyDragRegisterFrameNode(nodesForDragNotify_, dragEventType, notifyEvent);
@ -936,6 +939,7 @@ void DragDropManager::OnDragEnd(const PointerEvent& pointerEvent, const std::str
bool DragDropManager::IsDropAllowed(const RefPtr<FrameNode>& dragFrameNode)
{
CHECK_NULL_RETURN(dragFrameNode, false);
// application passed in null to indicate refusing all drag data forcedly
bool isDisallowDropForcedly = dragFrameNode->GetDisallowDropForcedly();
if (isDisallowDropForcedly) {
@ -976,6 +980,7 @@ void DragDropManager::DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const
const RefPtr<UnifiedData>& unifiedData, const std::string& udKey)
{
RefPtr<OHOS::Ace::DragEvent> event = AceType::MakeRefPtr<OHOS::Ace::DragEvent>();
CHECK_NULL_VOID(event);
if (!udKey.empty()) {
event->SetUdKey(udKey);
}
@ -985,7 +990,6 @@ void DragDropManager::DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const
event->SetData(unifiedData);
event->SetIsGetDataSuccess(true);
}
event->SetPressedKeyCodes(pointerEvent.pressedKeyCodes_);
OnDragDrop(event, dragFrameNode, pointerEvent);
}
@ -1062,6 +1066,7 @@ void DragDropManager::OnDragDrop(RefPtr<OHOS::Ace::DragEvent>& event, const RefP
const OHOS::Ace::PointerEvent& pointerEvent)
{
auto point = pointerEvent.GetPoint();
CHECK_NULL_VOID(dragFrameNode);
auto eventHub = dragFrameNode->GetEventHub<EventHub>();
CHECK_NULL_VOID(eventHub);
UpdateDragEvent(event, pointerEvent);
@ -1216,16 +1221,9 @@ void DragDropManager::FireOnDragEvent(
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent,
DragEventType type, const std::string& extraInfo)
{
CHECK_NULL_VOID(frameNode);
if (IsUIExtensionComponent(frameNode)) {
auto dragEvent = pointerEvent;
if (type == DragEventType::ENTER) {
dragEvent.action = PointerAction::PULL_IN_WINDOW;
} else if (type == DragEventType::LEAVE) {
dragEvent.action = PointerAction::PULL_OUT_WINDOW;
}
auto pattern = frameNode->GetPattern<Pattern>();
CHECK_NULL_VOID(pattern);
pattern->HandleDragEvent(dragEvent);
HandleUIExtensionDragEvent(frameNode, pointerEvent, type);
return;
}
auto eventHub = frameNode->GetEventHub<EventHub>();
@ -1238,16 +1236,8 @@ void DragDropManager::FireOnDragEvent(
auto point = pointerEvent.GetPoint();
auto extraParams = eventHub->GetDragExtraParams(extraInfo_.empty() ? extraInfo : extraInfo_, point, type);
RefPtr<OHOS::Ace::DragEvent> event = AceType::MakeRefPtr<OHOS::Ace::DragEvent>();
event->SetX((double)point.GetX());
event->SetY((double)point.GetY());
event->SetScreenX((double)point.GetScreenX());
event->SetScreenY((double)point.GetScreenY());
event->SetDisplayX((double)pointerEvent.GetDisplayX());
event->SetDisplayY((double)pointerEvent.GetDisplayY());
event->SetVelocity(velocityTracker_.GetVelocity());
event->SetSummary(summaryMap_);
event->SetPreviewRect(GetDragWindowRect(point));
event->SetPressedKeyCodes(pointerEvent.pressedKeyCodes_);
CHECK_NULL_VOID(event);
UpdateDragEvent(event, pointerEvent);
FireOnEditableTextComponent(frameNode, type);
FireOnDragEventWithDragType(eventHub, type, event, extraParams);
@ -1387,6 +1377,7 @@ void DragDropManager::onItemDragCancel()
void DragDropManager::FireOnItemDragEvent(const RefPtr<FrameNode>& frameNode, DragType dragType,
const OHOS::Ace::ItemDragInfo& itemDragInfo, DragEventType type, int32_t draggedIndex, int32_t insertIndex)
{
CHECK_NULL_VOID(frameNode);
if (dragType == DragType::GRID) {
auto eventHub = frameNode->GetEventHub<GridEventHub>();
CHECK_NULL_VOID(eventHub);
@ -1425,6 +1416,7 @@ void DragDropManager::FireOnItemDragEvent(const RefPtr<FrameNode>& frameNode, Dr
bool DragDropManager::FireOnItemDropEvent(const RefPtr<FrameNode>& frameNode, DragType dragType,
const OHOS::Ace::ItemDragInfo& itemDragInfo, int32_t draggedIndex, int32_t insertIndex, bool isSuccess)
{
CHECK_NULL_RETURN(frameNode, false);
if (dragType == DragType::GRID) {
auto eventHub = frameNode->GetEventHub<GridEventHub>();
CHECK_NULL_RETURN(eventHub, false);
@ -1597,6 +1589,7 @@ RefPtr<DragDropProxy> DragDropManager::CreateFrameworkDragDropProxy()
void DragDropManager::UpdateNotifyDragEvent(
RefPtr<NotifyDragEvent>& notifyEvent, const Point& point, const DragEventType dragEventType)
{
CHECK_NULL_VOID(notifyEvent);
notifyEvent->SetX((double)point.GetX());
notifyEvent->SetY((double)point.GetY());
notifyEvent->SetScreenX((double)point.GetScreenX());
@ -1622,6 +1615,7 @@ void DragDropManager::UpdateDragEvent(RefPtr<OHOS::Ace::DragEvent>& event, const
event->SetVelocity(velocityTracker_.GetVelocity());
event->SetSummary(summaryMap_);
event->SetPreviewRect(GetDragWindowRect(point));
event->SetPressedKeyCodes(pointerEvent.pressedKeyCodes_);
}
std::string DragDropManager::GetExtraInfo()
@ -1662,6 +1656,7 @@ void DragDropManager::UpdateVelocityTrackerPoint(const Point& point, bool isEnd)
bool DragDropManager::GetDragPreviewInfo(const RefPtr<OverlayManager>& overlayManager,
DragPreviewInfo& dragPreviewInfo, const RefPtr<GestureEventHub>& gestureHub)
{
CHECK_NULL_RETURN(overlayManager, false);
if (!overlayManager->GetHasDragPixelMap()) {
return false;
}
@ -1673,6 +1668,7 @@ bool DragDropManager::GetDragPreviewInfo(const RefPtr<OverlayManager>& overlayMa
}
CHECK_NULL_RETURN(gestureHub, false);
auto frameNode = gestureHub->GetFrameNode();
CHECK_NULL_RETURN(frameNode, false);
double maxWidth = DragDropManager::GetMaxWidthBaseOnGridSystem(frameNode->GetContextRefPtr());
auto width = imageNode->GetGeometryNode()->GetFrameRect().Width();
auto previewOption = imageNode->GetDragPreviewOption();
@ -2229,6 +2225,22 @@ bool DragDropManager::IsUIExtensionComponent(const RefPtr<NG::UINode>& node)
(!IsUIExtensionShowPlaceholder(node));
}
void DragDropManager::HandleUIExtensionDragEvent(
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent, DragEventType type)
{
CHECK_NULL_VOID(frameNode);
auto pattern = frameNode->GetPattern<Pattern>();
CHECK_NULL_VOID(pattern);
auto dragEvent = pointerEvent;
if (type == DragEventType::ENTER) {
dragEvent.action = PointerAction::PULL_IN_WINDOW;
} else if (type == DragEventType::LEAVE) {
dragEvent.action = PointerAction::PULL_OUT_WINDOW;
}
pattern->HandleDragEvent(dragEvent);
}
RectF DragDropManager::GetMenuPreviewRect()
{
auto pipelineContext = PipelineContext::GetCurrentContext();

View File

@ -518,6 +518,8 @@ private:
bool ReachMoveLimit(const PointerEvent& pointerEvent, const Point& point);
bool IsUIExtensionShowPlaceholder(const RefPtr<NG::UINode>& node);
bool IsUIExtensionComponent(const RefPtr<NG::UINode>& node);
void HandleUIExtensionDragEvent(
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent, DragEventType type);
int32_t GetWindowId();
void AddItemDrag(const RefPtr<FrameNode>& frameNode, const RefPtr<EventHub>& eventHub);
void RemoveItemDrag();

View File

@ -90,10 +90,12 @@ void DragAnimationHelper::PlayGatherNodeTranslateAnimation(const RefPtr<DragEven
const RefPtr<OverlayManager>& overlayManager)
{
CHECK_NULL_VOID(actuator);
CHECK_NULL_VOID(overlayManager);
AnimationOption option;
option.SetDuration(BEFORE_LIFTING_TIME);
option.SetCurve(Curves::SHARP);
auto frameNode = actuator->GetFrameNode();
CHECK_NULL_VOID(frameNode);
auto gatherNodeCenter = frameNode->GetPaintRectCenter();
auto gatherNodeChildrenInfo = overlayManager->GetGatherNodeChildrenInfo();

View File

@ -36,8 +36,8 @@ using PreviewType = Msdp::DeviceStatus::PreviewType;
using PreviewStyle = Msdp::DeviceStatus::PreviewStyle;
using PreviewAnimation = Msdp::DeviceStatus::PreviewAnimation;
namespace {
constexpr int32_t argCount1 = 1;
constexpr int32_t argCount2 = 2;
constexpr int32_t ARG_COUNT_1 = 1;
constexpr int32_t ARG_COUNT_2 = 2;
constexpr int32_t DEFAULT_DURATION_VALUE = 1000;
} // namespace
@ -51,12 +51,12 @@ public:
napi_handle_scope scope = nullptr;
napi_open_handle_scope(env, &scope);
CHECK_NULL_RETURN(scope, nullptr);
size_t argc = argCount1;
napi_value argv[argCount1] = { 0 };
size_t argc = ARG_COUNT_1;
napi_value argv[ARG_COUNT_1] = { 0 };
napi_value result = nullptr;
void* data = nullptr;
napi_get_cb_info(env, info, &argc, argv, &result, &data);
NAPI_ASSERT(env, argc == argCount1, "require 1 parameter");
NAPI_ASSERT(env, argc == ARG_COUNT_1, "require 1 parameter");
Color foregroundColor;
if (!ParseColor(env, argv[0], foregroundColor)) {
@ -99,12 +99,12 @@ public:
napi_handle_scope scope = nullptr;
napi_open_handle_scope(env, &scope);
CHECK_NULL_RETURN(scope, nullptr);
size_t argc = argCount2;
napi_value argv[argCount2] = { 0 };
size_t argc = ARG_COUNT_2;
napi_value argv[ARG_COUNT_2] = { 0 };
napi_value result = nullptr;
void* data = nullptr;
napi_get_cb_info(env, info, &argc, argv, &result, &data);
NAPI_ASSERT(env, argc == argCount2, "require 2 parameter");
NAPI_ASSERT(env, argc == ARG_COUNT_2, "require 2 parameter");
DragPreview* dragPreview = nullptr;
napi_unwrap(env, result, (void**)&dragPreview);

View File

@ -59,7 +59,7 @@ constexpr float PIXELMAP_WIDTH_RATE = -0.5f;
constexpr float PIXELMAP_HEIGHT_RATE = -0.2f;
constexpr size_t STR_BUFFER_SIZE = 1024;
constexpr int32_t PARAMETER_NUM = 2;
constexpr int32_t argCount3 = 3;
constexpr int32_t ARG_COUNT_3 = 3;
constexpr int32_t SOURCE_TYPE_MOUSE = 1;
constexpr int32_t MOUSE_POINTER_ID = 1001;
constexpr int32_t SOURCE_TOOL_PEN = 1;
@ -79,8 +79,8 @@ enum class ParameterType { CUSTOMBUILDER, DRAGITEMINFO, DRAGITEMINFO_ARRAY, MIX,
// the context of drag controller
struct DragControllerAsyncCtx {
napi_env env = nullptr;
size_t argc = 3;
napi_value argv[3] { nullptr };
size_t argc = ARG_COUNT_3;
napi_value argv[ARG_COUNT_3] { nullptr };
napi_ref callbackRef = nullptr;
napi_deferred deferred = nullptr;
std::shared_ptr<Media::PixelMap> pixelMap = nullptr;
@ -194,16 +194,13 @@ public:
static napi_value On(napi_env env, napi_callback_info info)
{
TAG_LOGI(AceLogTag::ACE_DRAG, "drag action On function called.");
auto jsEngine = EngineHelper::GetCurrentEngineSafely();
CHECK_NULL_RETURN(jsEngine, nullptr);
napi_handle_scope scope = nullptr;
napi_open_handle_scope(env, &scope);
CHECK_NULL_RETURN(scope, nullptr);
napi_value thisVar = nullptr;
napi_value cb = nullptr;
size_t argc = ParseArgs(env, info, thisVar, cb);
NAPI_ASSERT(env, (argc == 2 && thisVar != nullptr && cb != nullptr), "Invalid arguments");
NAPI_ASSERT(env, (argc == ARG_COUNT_2 && thisVar != nullptr && cb != nullptr), "Invalid arguments");
napi_valuetype valueType = napi_undefined;
napi_typeof(env, cb, &valueType);
if (valueType != napi_function) {
@ -233,6 +230,9 @@ public:
static napi_value Off(napi_env env, napi_callback_info info)
{
TAG_LOGI(AceLogTag::ACE_DRAG, "drag action Off function called.");
napi_handle_scope scope = nullptr;
napi_open_handle_scope(env, &scope);
CHECK_NULL_RETURN(scope, nullptr);
napi_value thisVar = nullptr;
napi_value cb = nullptr;
size_t argc = ParseArgs(env, info, thisVar, cb);
@ -244,11 +244,12 @@ public:
}
dragAction->cbList_.clear();
} else {
NAPI_ASSERT(env, (argc == 2 && dragAction != nullptr && cb != nullptr), "Invalid arguments");
NAPI_ASSERT(env, (argc == ARG_COUNT_2 && dragAction != nullptr && cb != nullptr), "Invalid arguments");
napi_valuetype valueType = napi_undefined;
napi_typeof(env, cb, &valueType);
if (valueType != napi_function) {
NapiThrow(env, "Check param failed", ERROR_CODE_PARAM_INVALID);
napi_close_handle_scope(env, scope);
return nullptr;
}
auto iter = dragAction->FindCbList(cb);
@ -257,15 +258,13 @@ public:
dragAction->cbList_.erase(iter);
}
}
napi_close_handle_scope(env, scope);
return nullptr;
}
static napi_value StartDrag(napi_env env, napi_callback_info info)
{
TAG_LOGI(AceLogTag::ACE_DRAG, "drag action StartDrag function called.");
auto jsEngine = EngineHelper::GetCurrentEngineSafely();
CHECK_NULL_RETURN(jsEngine, nullptr);
napi_escapable_handle_scope scope = nullptr;
napi_open_escapable_handle_scope(env, &scope);
CHECK_NULL_RETURN(scope, nullptr);
@ -318,8 +317,8 @@ private:
static size_t ParseArgs(napi_env& env, napi_callback_info& info, napi_value& thisVar, napi_value& cb)
{
size_t argc = 2;
napi_value argv[argCount2] = { 0 };
size_t argc = ARG_COUNT_2;
napi_value argv[ARG_COUNT_2] = { 0 };
void* data = nullptr;
napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
if (argc == 0) {
@ -388,7 +387,7 @@ DragControllerAsyncCtx::~DragControllerAsyncCtx()
bool IsExecutingWithDragAction(std::shared_ptr<DragControllerAsyncCtx> asyncCtx)
{
CHECK_NULL_RETURN(asyncCtx, false);
return (asyncCtx->isArray && asyncCtx->argc == 2);
return (asyncCtx->isArray && asyncCtx->argc == ARG_COUNT_2);
}
napi_value CreateCallbackErrorValue(napi_env env, int32_t errCode, const std::string& errMsg = "")
@ -496,13 +495,14 @@ void CallBackForJs(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, napi_value
}
void GetCallBackDataForJs(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, const DragNotifyMsg& dragNotifyMsg,
const DragStatus dragStatus, napi_value& result)
const DragStatus dragStatus)
{
CHECK_NULL_VOID(asyncCtx);
napi_handle_scope scope = nullptr;
napi_open_handle_scope(asyncCtx->env, &scope);
napi_get_undefined(asyncCtx->env, &result);
auto resultCode = dragNotifyMsg.result;
napi_value result = nullptr;
napi_get_undefined(asyncCtx->env, &result);
napi_create_object(asyncCtx->env, &result);
napi_value eventNapi = nullptr;
napi_value globalObj = nullptr;
@ -601,8 +601,7 @@ void HandleSuccess(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, const DragN
taskExecutor->PostSyncTask(
[asyncCtx, dragNotifyMsg, dragStatus]() {
CHECK_NULL_VOID(asyncCtx);
napi_value dragAndDropInfoValue;
GetCallBackDataForJs(asyncCtx, dragNotifyMsg, dragStatus, dragAndDropInfoValue);
GetCallBackDataForJs(asyncCtx, dragNotifyMsg, dragStatus);
},
TaskExecutor::TaskType::JS, "ArkUIDragHandleSuccess");
}
@ -619,14 +618,14 @@ void HandleFail(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, int32_t errorC
if (hasHandle) {
return;
}
napi_value result[2] = { nullptr };
napi_value result[PARAMETER_NUM] = { nullptr };
result[0] = CreateCallbackErrorValue(asyncCtx->env, errorCode, errMsg);
if (asyncCtx->callbackRef) {
napi_value ret = nullptr;
napi_value napiCallback = nullptr;
napi_get_reference_value(asyncCtx->env, asyncCtx->callbackRef, &napiCallback);
napi_create_object(asyncCtx->env, &result[1]);
napi_call_function(asyncCtx->env, nullptr, napiCallback, 2, result, &ret);
napi_call_function(asyncCtx->env, nullptr, napiCallback, PARAMETER_NUM, result, &ret);
napi_delete_reference(asyncCtx->env, asyncCtx->callbackRef);
} else {
napi_reject_deferred(asyncCtx->env, asyncCtx->deferred, result[0]);
@ -647,8 +646,7 @@ void HandleDragEnd(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, const DragN
taskExecutor->PostSyncTask(
[asyncCtx, dragNotifyMsg]() {
CHECK_NULL_VOID(asyncCtx);
napi_value dragAndDropInfoValue;
GetCallBackDataForJs(asyncCtx, dragNotifyMsg, DragStatus::ENDED, dragAndDropInfoValue);
GetCallBackDataForJs(asyncCtx, dragNotifyMsg, DragStatus::ENDED);
},
TaskExecutor::TaskType::JS, "ArkUIDragHandleDragEnd");
}
@ -796,10 +794,7 @@ void StartDragService(std::shared_ptr<DragControllerAsyncCtx> asyncCtx)
napi_close_handle_scope(asyncCtx->env, scope);
return;
}
napi_handle_scope scope = nullptr;
napi_open_handle_scope(asyncCtx->env, &scope);
HandleSuccess(asyncCtx, DragNotifyMsg {}, DragStatus::STARTED);
napi_close_handle_scope(asyncCtx->env, scope);
auto container = AceEngine::Get().GetContainer(asyncCtx->instanceId);
SetIsDragging(container, true);
TAG_LOGI(AceLogTag::ACE_DRAG, "msdp start drag successfully");
@ -1490,7 +1485,7 @@ bool CheckAndParseParams(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, std::
{
// Check the number of the argument
CHECK_NULL_RETURN(asyncCtx, false);
if ((asyncCtx->argc != 2) && (asyncCtx->argc != argCount3)) {
if ((asyncCtx->argc != ARG_COUNT_2) && (asyncCtx->argc != ARG_COUNT_3)) {
errMsg = "The number of parameters must be 2 or 3.";
return false;
}
@ -1507,7 +1502,7 @@ bool CheckAndParseParams(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, std::
void CreateCallback(std::shared_ptr<DragControllerAsyncCtx> asyncCtx, napi_value* result)
{
CHECK_NULL_VOID(asyncCtx);
if (asyncCtx->argc == argCount3) {
if (asyncCtx->argc == ARG_COUNT_3) {
// Create the JsCallback
napi_create_reference(asyncCtx->env, asyncCtx->argv[2], 1, &asyncCtx->callbackRef);
}