123b3eb3cSopenharmony_ci/*
223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License.
523b3eb3cSopenharmony_ci * You may obtain a copy of the License at
623b3eb3cSopenharmony_ci *
723b3eb3cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
823b3eb3cSopenharmony_ci *
923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and
1323b3eb3cSopenharmony_ci * limitations under the License.
1423b3eb3cSopenharmony_ci */
1523b3eb3cSopenharmony_ci
1623b3eb3cSopenharmony_ci
1723b3eb3cSopenharmony_ci#include "node_model.h"
1823b3eb3cSopenharmony_ci#include "gesture_impl.h"
1923b3eb3cSopenharmony_ci
2023b3eb3cSopenharmony_ci#include "core/gestures/gesture_event.h"
2123b3eb3cSopenharmony_ci#include "interfaces/native/event/ui_input_event_impl.h"
2223b3eb3cSopenharmony_ci
2323b3eb3cSopenharmony_ci#ifdef __cplusplus
2423b3eb3cSopenharmony_ciextern "C" {
2523b3eb3cSopenharmony_ci#endif
2623b3eb3cSopenharmony_ci
2723b3eb3cSopenharmony_cistruct ArkUI_GestureRecognizer {
2823b3eb3cSopenharmony_ci    int32_t type = -1;
2923b3eb3cSopenharmony_ci    ArkUIGesture* gesture = nullptr;
3023b3eb3cSopenharmony_ci    void* extraData = nullptr;
3123b3eb3cSopenharmony_ci    void* attachNode = nullptr;
3223b3eb3cSopenharmony_ci    bool capi = true;
3323b3eb3cSopenharmony_ci    void* recognizer = nullptr;
3423b3eb3cSopenharmony_ci    ArkUIGestureEventTargetInfo targetInfo = {};
3523b3eb3cSopenharmony_ci};
3623b3eb3cSopenharmony_ci
3723b3eb3cSopenharmony_cistruct ArkUI_GestureEventTargetInfo {
3823b3eb3cSopenharmony_ci    void* uiNode = nullptr;
3923b3eb3cSopenharmony_ci};
4023b3eb3cSopenharmony_ci
4123b3eb3cSopenharmony_ci#ifdef __cplusplus
4223b3eb3cSopenharmony_ci};
4323b3eb3cSopenharmony_ci
4423b3eb3cSopenharmony_ci// the ArkUI_GestureEvent struct actually same as ArkUIAPIEventGestureAsyncEvent;
4523b3eb3cSopenharmony_cistruct ArkUI_GestureEvent {
4623b3eb3cSopenharmony_ci    ArkUIAPIEventGestureAsyncEvent eventData;
4723b3eb3cSopenharmony_ci    void* attachNode;
4823b3eb3cSopenharmony_ci};
4923b3eb3cSopenharmony_ci
5023b3eb3cSopenharmony_cistruct ArkUI_GestureInterruptInfo {
5123b3eb3cSopenharmony_ci    ArkUIGestureInterruptInfo interruptData;
5223b3eb3cSopenharmony_ci};
5323b3eb3cSopenharmony_ci
5423b3eb3cSopenharmony_cistruct ArkUI_ParallelInnerGestureEvent {
5523b3eb3cSopenharmony_ci    ArkUIGestureRecognizer* current = nullptr;
5623b3eb3cSopenharmony_ci    ArkUIGestureRecognizer** responseLinkRecognizer = nullptr;
5723b3eb3cSopenharmony_ci    void* userData = nullptr;
5823b3eb3cSopenharmony_ci    int32_t count;
5923b3eb3cSopenharmony_ci};
6023b3eb3cSopenharmony_ci
6123b3eb3cSopenharmony_ci#endif
6223b3eb3cSopenharmony_ci
6323b3eb3cSopenharmony_ci
6423b3eb3cSopenharmony_ciArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event)
6523b3eb3cSopenharmony_ci{
6623b3eb3cSopenharmony_ci    ArkUI_GestureEventActionType ret;
6723b3eb3cSopenharmony_ci    switch (event->eventData.subKind) {
6823b3eb3cSopenharmony_ci        case ON_ACTION:
6923b3eb3cSopenharmony_ci        case ON_ACTION_START:
7023b3eb3cSopenharmony_ci            ret = GESTURE_EVENT_ACTION_ACCEPT;
7123b3eb3cSopenharmony_ci            break;
7223b3eb3cSopenharmony_ci        case ON_ACTION_UPDATE:
7323b3eb3cSopenharmony_ci            ret = GESTURE_EVENT_ACTION_UPDATE;
7423b3eb3cSopenharmony_ci            break;
7523b3eb3cSopenharmony_ci        case ON_ACTION_END:
7623b3eb3cSopenharmony_ci            ret = GESTURE_EVENT_ACTION_END;
7723b3eb3cSopenharmony_ci            break;
7823b3eb3cSopenharmony_ci        case ON_ACTION_CANCEL:
7923b3eb3cSopenharmony_ci            ret = GESTURE_EVENT_ACTION_CANCEL;
8023b3eb3cSopenharmony_ci            break;
8123b3eb3cSopenharmony_ci        default:
8223b3eb3cSopenharmony_ci            ret = GESTURE_EVENT_ACTION_ACCEPT;
8323b3eb3cSopenharmony_ci            break;
8423b3eb3cSopenharmony_ci    }
8523b3eb3cSopenharmony_ci    return ret;
8623b3eb3cSopenharmony_ci}
8723b3eb3cSopenharmony_ci
8823b3eb3cSopenharmony_ciconst ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event)
8923b3eb3cSopenharmony_ci{
9023b3eb3cSopenharmony_ci    if (!event) {
9123b3eb3cSopenharmony_ci        return nullptr;
9223b3eb3cSopenharmony_ci    }
9323b3eb3cSopenharmony_ci    return reinterpret_cast<ArkUI_UIInputEvent*>(event->eventData.rawPointerEvent);
9423b3eb3cSopenharmony_ci}
9523b3eb3cSopenharmony_ci
9623b3eb3cSopenharmony_ciint32_t OH_ArkUI_LongPress_GetRepeatCount(const ArkUI_GestureEvent* event)
9723b3eb3cSopenharmony_ci{
9823b3eb3cSopenharmony_ci    return event->eventData.repeat;
9923b3eb3cSopenharmony_ci}
10023b3eb3cSopenharmony_ci
10123b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event)
10223b3eb3cSopenharmony_ci{
10323b3eb3cSopenharmony_ci    return event->eventData.velocity;
10423b3eb3cSopenharmony_ci}
10523b3eb3cSopenharmony_ci
10623b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event)
10723b3eb3cSopenharmony_ci{
10823b3eb3cSopenharmony_ci    return event->eventData.velocityX;
10923b3eb3cSopenharmony_ci}
11023b3eb3cSopenharmony_ci
11123b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event)
11223b3eb3cSopenharmony_ci{
11323b3eb3cSopenharmony_ci    return event->eventData.velocityY;
11423b3eb3cSopenharmony_ci}
11523b3eb3cSopenharmony_ci
11623b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event)
11723b3eb3cSopenharmony_ci{
11823b3eb3cSopenharmony_ci    return event->eventData.x;
11923b3eb3cSopenharmony_ci}
12023b3eb3cSopenharmony_ci
12123b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event)
12223b3eb3cSopenharmony_ci{
12323b3eb3cSopenharmony_ci    return event->eventData.y;
12423b3eb3cSopenharmony_ci}
12523b3eb3cSopenharmony_ci
12623b3eb3cSopenharmony_cifloat OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event)
12723b3eb3cSopenharmony_ci{
12823b3eb3cSopenharmony_ci    return event->eventData.angle;
12923b3eb3cSopenharmony_ci}
13023b3eb3cSopenharmony_ci
13123b3eb3cSopenharmony_cifloat OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event)
13223b3eb3cSopenharmony_ci{
13323b3eb3cSopenharmony_ci    return event->eventData.speed;
13423b3eb3cSopenharmony_ci}
13523b3eb3cSopenharmony_ci
13623b3eb3cSopenharmony_cifloat OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event)
13723b3eb3cSopenharmony_ci{
13823b3eb3cSopenharmony_ci    return event->eventData.angle;
13923b3eb3cSopenharmony_ci}
14023b3eb3cSopenharmony_ci
14123b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event)
14223b3eb3cSopenharmony_ci{
14323b3eb3cSopenharmony_ci    return event->eventData.scale;
14423b3eb3cSopenharmony_ci}
14523b3eb3cSopenharmony_ci
14623b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event)
14723b3eb3cSopenharmony_ci{
14823b3eb3cSopenharmony_ci    return event->eventData.pinchCenterX;
14923b3eb3cSopenharmony_ci}
15023b3eb3cSopenharmony_ci
15123b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event)
15223b3eb3cSopenharmony_ci{
15323b3eb3cSopenharmony_ci    return event->eventData.pinchCenterY;
15423b3eb3cSopenharmony_ci}
15523b3eb3cSopenharmony_ci
15623b3eb3cSopenharmony_ciArkUI_NodeHandle OH_ArkUI_GestureEvent_GetNode(const ArkUI_GestureEvent* event)
15723b3eb3cSopenharmony_ci{
15823b3eb3cSopenharmony_ci    if (!event) {
15923b3eb3cSopenharmony_ci        return nullptr;
16023b3eb3cSopenharmony_ci    }
16123b3eb3cSopenharmony_ci    return reinterpret_cast<ArkUI_NodeHandle>(event->attachNode);
16223b3eb3cSopenharmony_ci}
16323b3eb3cSopenharmony_ci
16423b3eb3cSopenharmony_cibool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event)
16523b3eb3cSopenharmony_ci{
16623b3eb3cSopenharmony_ci    return event->interruptData.isSystemGesture;
16723b3eb3cSopenharmony_ci}
16823b3eb3cSopenharmony_ci
16923b3eb3cSopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event)
17023b3eb3cSopenharmony_ci{
17123b3eb3cSopenharmony_ci    return reinterpret_cast<ArkUI_GestureRecognizer *>(event->interruptData.userData);
17223b3eb3cSopenharmony_ci}
17323b3eb3cSopenharmony_ci
17423b3eb3cSopenharmony_ciArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event)
17523b3eb3cSopenharmony_ci{
17623b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(event, nullptr);
17723b3eb3cSopenharmony_ci    ArkUI_GestureEvent* gestureEvent = reinterpret_cast<ArkUI_GestureEvent*>(event->interruptData.gestureEvent);
17823b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(gestureEvent, nullptr);
17923b3eb3cSopenharmony_ci
18023b3eb3cSopenharmony_ci    ArkUI_UIInputEvent* uiEvent = reinterpret_cast<ArkUI_UIInputEvent*>(event->interruptData.inputEvent);
18123b3eb3cSopenharmony_ci    gestureEvent->eventData.rawPointerEvent = uiEvent;
18223b3eb3cSopenharmony_ci
18323b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUI_GestureRecognizer*>(event->interruptData.userData);
18423b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(gestureRecognizer, nullptr);
18523b3eb3cSopenharmony_ci    gestureEvent->attachNode = gestureRecognizer->attachNode;
18623b3eb3cSopenharmony_ci    return gestureEvent;
18723b3eb3cSopenharmony_ci}
18823b3eb3cSopenharmony_ci
18923b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType(const ArkUI_GestureInterruptInfo* event)
19023b3eb3cSopenharmony_ci{
19123b3eb3cSopenharmony_ci    if (event->interruptData.isSystemGesture) {
19223b3eb3cSopenharmony_ci        return event->interruptData.systemRecognizerType;
19323b3eb3cSopenharmony_ci    }
19423b3eb3cSopenharmony_ci    return -1;
19523b3eb3cSopenharmony_ci}
19623b3eb3cSopenharmony_ci
19723b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetResponseRecognizersFromInterruptInfo(
19823b3eb3cSopenharmony_ci    const ArkUI_GestureInterruptInfo* event, ArkUI_GestureRecognizerHandleArray* responseChain, int32_t* count)
19923b3eb3cSopenharmony_ci{
20023b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(responseChain, ARKUI_ERROR_CODE_PARAM_INVALID);
20123b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(count, ARKUI_ERROR_CODE_PARAM_INVALID);
20223b3eb3cSopenharmony_ci    *responseChain = reinterpret_cast<ArkUI_GestureRecognizer**>(event->interruptData.responseLinkRecognizer);
20323b3eb3cSopenharmony_ci    *count = event->interruptData.count;
20423b3eb3cSopenharmony_ci    return 0;
20523b3eb3cSopenharmony_ci}
20623b3eb3cSopenharmony_ci
20723b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer, bool enabled)
20823b3eb3cSopenharmony_ci{
20923b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
21023b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
21123b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
21223b3eb3cSopenharmony_ci    }
21323b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()
21423b3eb3cSopenharmony_ci        ->getNodeModifiers()
21523b3eb3cSopenharmony_ci        ->getGestureModifier()
21623b3eb3cSopenharmony_ci        ->setGestureRecognizerEnabled(gestureRecognizer, enabled);
21723b3eb3cSopenharmony_ci}
21823b3eb3cSopenharmony_ci
21923b3eb3cSopenharmony_cibool OH_ArkUI_GetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer)
22023b3eb3cSopenharmony_ci{
22123b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
22223b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
22323b3eb3cSopenharmony_ci        return false;
22423b3eb3cSopenharmony_ci    }
22523b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()
22623b3eb3cSopenharmony_ci        ->getNodeModifiers()
22723b3eb3cSopenharmony_ci        ->getGestureModifier()
22823b3eb3cSopenharmony_ci        ->getGestureRecognizerEnabled(gestureRecognizer);
22923b3eb3cSopenharmony_ci}
23023b3eb3cSopenharmony_ci
23123b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureRecognizerState(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerState* state)
23223b3eb3cSopenharmony_ci{
23323b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
23423b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
23523b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
23623b3eb3cSopenharmony_ci    }
23723b3eb3cSopenharmony_ci    ArkUIGestureRecognizerState recognizerState;
23823b3eb3cSopenharmony_ci    auto result =
23923b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->getGestureRecognizerState(
24023b3eb3cSopenharmony_ci            gestureRecognizer, &recognizerState);
24123b3eb3cSopenharmony_ci    *state = static_cast<ArkUI_GestureRecognizerState>(recognizerState);
24223b3eb3cSopenharmony_ci    return result;
24323b3eb3cSopenharmony_ci}
24423b3eb3cSopenharmony_ci
24523b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureEventTargetInfo(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventTargetInfo** info)
24623b3eb3cSopenharmony_ci{
24723b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
24823b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
24923b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
25023b3eb3cSopenharmony_ci    }
25123b3eb3cSopenharmony_ci    *info = reinterpret_cast<ArkUI_GestureEventTargetInfo*>(&gestureRecognizer->targetInfo);
25223b3eb3cSopenharmony_ci    return 0;
25323b3eb3cSopenharmony_ci}
25423b3eb3cSopenharmony_ci
25523b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollBegin(ArkUI_GestureEventTargetInfo* info, bool* ret)
25623b3eb3cSopenharmony_ci{
25723b3eb3cSopenharmony_ci    auto* targetInfo = reinterpret_cast<ArkUIGestureEventTargetInfo*>(info);
25823b3eb3cSopenharmony_ci    if (!targetInfo) {
25923b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
26023b3eb3cSopenharmony_ci    }
26123b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()
26223b3eb3cSopenharmony_ci        ->getNodeModifiers()
26323b3eb3cSopenharmony_ci        ->getGestureModifier()
26423b3eb3cSopenharmony_ci        ->gestureEventTargetInfoIsScrollBegin(targetInfo, ret);
26523b3eb3cSopenharmony_ci}
26623b3eb3cSopenharmony_ci
26723b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollEnd(ArkUI_GestureEventTargetInfo* info, bool* ret)
26823b3eb3cSopenharmony_ci{
26923b3eb3cSopenharmony_ci    auto* targetInfo = reinterpret_cast<ArkUIGestureEventTargetInfo*>(info);
27023b3eb3cSopenharmony_ci    if (!targetInfo) {
27123b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
27223b3eb3cSopenharmony_ci    }
27323b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()
27423b3eb3cSopenharmony_ci        ->getNodeModifiers()
27523b3eb3cSopenharmony_ci        ->getGestureModifier()
27623b3eb3cSopenharmony_ci        ->gestureEventTargetInfoIsScrollEnd(targetInfo, ret);
27723b3eb3cSopenharmony_ci}
27823b3eb3cSopenharmony_ci
27923b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetPanGestureDirectionMask(
28023b3eb3cSopenharmony_ci    ArkUI_GestureRecognizer* recognizer, ArkUI_GestureDirectionMask* directionMask)
28123b3eb3cSopenharmony_ci{
28223b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
28323b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
28423b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
28523b3eb3cSopenharmony_ci    }
28623b3eb3cSopenharmony_ci    ArkUIGestureDirection direction = ArkUIGestureDirection::ArkUI_GESTURE_DIRECTION_ALL;
28723b3eb3cSopenharmony_ci    auto result =
28823b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->getPanGestureDirectionMask(
28923b3eb3cSopenharmony_ci            gestureRecognizer, &direction);
29023b3eb3cSopenharmony_ci    *directionMask = static_cast<ArkUI_GestureDirectionMask>(direction);
29123b3eb3cSopenharmony_ci    return result;
29223b3eb3cSopenharmony_ci}
29323b3eb3cSopenharmony_ci
29423b3eb3cSopenharmony_cibool OH_ArkUI_IsBuiltInGesture(ArkUI_GestureRecognizer* recognizer)
29523b3eb3cSopenharmony_ci{
29623b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
29723b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
29823b3eb3cSopenharmony_ci        return false;
29923b3eb3cSopenharmony_ci    }
30023b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->isBuiltInGesture(
30123b3eb3cSopenharmony_ci        gestureRecognizer);
30223b3eb3cSopenharmony_ci}
30323b3eb3cSopenharmony_ci
30423b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureTag(ArkUI_GestureRecognizer* recognizer, char* buffer, int32_t bufferSize, int32_t* result)
30523b3eb3cSopenharmony_ci{
30623b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
30723b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
30823b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
30923b3eb3cSopenharmony_ci    }
31023b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->getGestureTag(
31123b3eb3cSopenharmony_ci        gestureRecognizer, buffer, bufferSize, result);
31223b3eb3cSopenharmony_ci}
31323b3eb3cSopenharmony_ci
31423b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureBindNodeId(ArkUI_GestureRecognizer* recognizer, char* nodeId, int32_t size, int32_t* result)
31523b3eb3cSopenharmony_ci{
31623b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
31723b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
31823b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
31923b3eb3cSopenharmony_ci    }
32023b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->getGestureBindNodeId(
32123b3eb3cSopenharmony_ci        gestureRecognizer, nodeId, size, result);
32223b3eb3cSopenharmony_ci}
32323b3eb3cSopenharmony_ci
32423b3eb3cSopenharmony_cibool OH_ArkUI_IsGestureRecognizerValid(ArkUI_GestureRecognizer* recognizer)
32523b3eb3cSopenharmony_ci{
32623b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
32723b3eb3cSopenharmony_ci    if (!gestureRecognizer) {
32823b3eb3cSopenharmony_ci        return false;
32923b3eb3cSopenharmony_ci    }
33023b3eb3cSopenharmony_ci    return OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->isGestureRecognizerValid(
33123b3eb3cSopenharmony_ci        gestureRecognizer);
33223b3eb3cSopenharmony_ci}
33323b3eb3cSopenharmony_ci
33423b3eb3cSopenharmony_civoid* OH_ArkUI_ParallelInnerGestureEvent_GetUserData(ArkUI_ParallelInnerGestureEvent* event)
33523b3eb3cSopenharmony_ci{
33623b3eb3cSopenharmony_ci    return event->userData;
33723b3eb3cSopenharmony_ci}
33823b3eb3cSopenharmony_ci
33923b3eb3cSopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_ParallelInnerGestureEvent_GetCurrentRecognizer(ArkUI_ParallelInnerGestureEvent* event)
34023b3eb3cSopenharmony_ci{
34123b3eb3cSopenharmony_ci    return reinterpret_cast<ArkUI_GestureRecognizer*>(event->current);
34223b3eb3cSopenharmony_ci}
34323b3eb3cSopenharmony_ci
34423b3eb3cSopenharmony_ciint32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(
34523b3eb3cSopenharmony_ci    ArkUI_ParallelInnerGestureEvent* event, ArkUI_GestureRecognizerHandleArray* array, int32_t* size)
34623b3eb3cSopenharmony_ci{
34723b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(array, ARKUI_ERROR_CODE_PARAM_INVALID);
34823b3eb3cSopenharmony_ci    CHECK_NULL_RETURN(size, ARKUI_ERROR_CODE_PARAM_INVALID);
34923b3eb3cSopenharmony_ci    *array = reinterpret_cast<ArkUI_GestureRecognizer**>(event->responseLinkRecognizer);
35023b3eb3cSopenharmony_ci    *size = event->count;
35123b3eb3cSopenharmony_ci    return 0;
35223b3eb3cSopenharmony_ci}
35323b3eb3cSopenharmony_ci
35423b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(
35523b3eb3cSopenharmony_ci    ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData)
35623b3eb3cSopenharmony_ci{
35723b3eb3cSopenharmony_ci    auto* gestureRecognizer = reinterpret_cast<ArkUIGestureRecognizer*>(recognizer);
35823b3eb3cSopenharmony_ci    if (!gestureRecognizer || gestureRecognizer->capi) {
35923b3eb3cSopenharmony_ci        return ARKUI_ERROR_CODE_PARAM_INVALID;
36023b3eb3cSopenharmony_ci    }
36123b3eb3cSopenharmony_ci    auto disposeCallback = reinterpret_cast<void (*)(ArkUIGestureRecognizer * recognizer, void* userData)>(callback);
36223b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()
36323b3eb3cSopenharmony_ci        ->getNodeModifiers()
36423b3eb3cSopenharmony_ci        ->getGestureModifier()
36523b3eb3cSopenharmony_ci        ->setArkUIGestureRecognizerDisposeNotify(gestureRecognizer, userData, disposeCallback);
36623b3eb3cSopenharmony_ci    return 0;
36723b3eb3cSopenharmony_ci}
36823b3eb3cSopenharmony_ci
36923b3eb3cSopenharmony_cinamespace OHOS::Ace::GestureModel {
37023b3eb3cSopenharmony_ci
37123b3eb3cSopenharmony_ciconstexpr int32_t DEFAULT_PAN_FINGERS = 1;
37223b3eb3cSopenharmony_ciconstexpr int32_t MAX_PAN_FINGERS = 10;
37323b3eb3cSopenharmony_ciconstexpr double DEFAULT_PINCH_DISTANCE = 5.0f;
37423b3eb3cSopenharmony_ciconstexpr double DEFAULT_SWIPE_SPEED = 100.0f;
37523b3eb3cSopenharmony_ciconstexpr int32_t DEFAULT_TAP_COUNT = 1;
37623b3eb3cSopenharmony_ciconstexpr int32_t DEFAULT_TAP_FINGERS = 1;
37723b3eb3cSopenharmony_ciconstexpr int32_t MAX_TAP_FINGERS = 10;
37823b3eb3cSopenharmony_ci
37923b3eb3cSopenharmony_cistruct GestureInnerData {
38023b3eb3cSopenharmony_ci    void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParam);
38123b3eb3cSopenharmony_ci    void* extraParam;
38223b3eb3cSopenharmony_ci    void* gesture;
38323b3eb3cSopenharmony_ci};
38423b3eb3cSopenharmony_ci
38523b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateTapGesture(int32_t count, int32_t fingers)
38623b3eb3cSopenharmony_ci{
38723b3eb3cSopenharmony_ci    count = std::max(count, DEFAULT_TAP_COUNT);
38823b3eb3cSopenharmony_ci    fingers = std::clamp(fingers, DEFAULT_TAP_FINGERS, MAX_TAP_FINGERS);
38923b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ TAP_GESTURE, nullptr, nullptr, nullptr };
39023b3eb3cSopenharmony_ci    auto* gesture = OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createTapGesture(
39123b3eb3cSopenharmony_ci        count, fingers, ndkGesture);
39223b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
39323b3eb3cSopenharmony_ci    return ndkGesture;
39423b3eb3cSopenharmony_ci}
39523b3eb3cSopenharmony_ci
39623b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateTapGestureWithDistanceThreshold(int32_t count, int32_t fingers, double distanceThreshold)
39723b3eb3cSopenharmony_ci{
39823b3eb3cSopenharmony_ci    count = std::max(count, DEFAULT_TAP_COUNT);
39923b3eb3cSopenharmony_ci    fingers = std::clamp(fingers, DEFAULT_TAP_FINGERS, MAX_TAP_FINGERS);
40023b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ TAP_GESTURE, nullptr, nullptr, nullptr };
40123b3eb3cSopenharmony_ci    auto* gesture = OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->
40223b3eb3cSopenharmony_ci        createTapGestureWithDistanceThreshold(count, fingers, distanceThreshold, ndkGesture);
40323b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
40423b3eb3cSopenharmony_ci    return ndkGesture;
40523b3eb3cSopenharmony_ci}
40623b3eb3cSopenharmony_ci
40723b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateLongPressGesture(int32_t fingers, bool repeatResult, int32_t duration)
40823b3eb3cSopenharmony_ci{
40923b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ LONG_PRESS_GESTURE, nullptr, nullptr, nullptr };
41023b3eb3cSopenharmony_ci    auto* gesture =
41123b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createLongPressGesture(fingers,
41223b3eb3cSopenharmony_ci        repeatResult, duration, ndkGesture);
41323b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
41423b3eb3cSopenharmony_ci    return ndkGesture;
41523b3eb3cSopenharmony_ci}
41623b3eb3cSopenharmony_ci
41723b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreatePinchGesture(int32_t fingers, double distance)
41823b3eb3cSopenharmony_ci{
41923b3eb3cSopenharmony_ci    if (LessOrEqual(distance, 0.0f)) {
42023b3eb3cSopenharmony_ci        distance = DEFAULT_PINCH_DISTANCE;
42123b3eb3cSopenharmony_ci    }
42223b3eb3cSopenharmony_ci    double distanceNum = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
42323b3eb3cSopenharmony_ci        distance, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP));
42423b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ PINCH_GESTURE, nullptr, nullptr, nullptr };
42523b3eb3cSopenharmony_ci    auto* gesture =
42623b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createPinchGesture(fingers,
42723b3eb3cSopenharmony_ci        distanceNum, ndkGesture);
42823b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
42923b3eb3cSopenharmony_ci    return ndkGesture;
43023b3eb3cSopenharmony_ci}
43123b3eb3cSopenharmony_ci
43223b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateRotationGesture(int32_t fingers, double angle)
43323b3eb3cSopenharmony_ci{
43423b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ ROTATION_GESTURE, nullptr, nullptr, nullptr };
43523b3eb3cSopenharmony_ci    auto* gesture =
43623b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createRotationGesture(fingers,
43723b3eb3cSopenharmony_ci        angle, ndkGesture);
43823b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
43923b3eb3cSopenharmony_ci    return ndkGesture;
44023b3eb3cSopenharmony_ci}
44123b3eb3cSopenharmony_ci
44223b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateSwipeGesture(int32_t fingers, ArkUI_GestureDirectionMask directions, double speed)
44323b3eb3cSopenharmony_ci{
44423b3eb3cSopenharmony_ci    if (LessOrEqual(speed, 0.0f)) {
44523b3eb3cSopenharmony_ci        speed = DEFAULT_SWIPE_SPEED;
44623b3eb3cSopenharmony_ci    }
44723b3eb3cSopenharmony_ci    double speedNum = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
44823b3eb3cSopenharmony_ci        speed, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP));
44923b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ SWIPE_GESTURE, nullptr, nullptr, nullptr };
45023b3eb3cSopenharmony_ci    auto* gesture =
45123b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createSwipeGesture(fingers,
45223b3eb3cSopenharmony_ci        directions, speedNum, ndkGesture);
45323b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
45423b3eb3cSopenharmony_ci    return ndkGesture;
45523b3eb3cSopenharmony_ci}
45623b3eb3cSopenharmony_ci
45723b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreatePanGesture(int32_t fingersNum, ArkUI_GestureDirectionMask mask, double distanceNum)
45823b3eb3cSopenharmony_ci{
45923b3eb3cSopenharmony_ci    int32_t fingers = DEFAULT_PAN_FINGERS;
46023b3eb3cSopenharmony_ci    if (fingersNum < DEFAULT_PAN_FINGERS || fingersNum > MAX_PAN_FINGERS) {
46123b3eb3cSopenharmony_ci        fingers = DEFAULT_PAN_FINGERS;
46223b3eb3cSopenharmony_ci    } else {
46323b3eb3cSopenharmony_ci        fingers = fingersNum;
46423b3eb3cSopenharmony_ci    }
46523b3eb3cSopenharmony_ci    auto* ndkGesture = new ArkUI_GestureRecognizer{ PAN_GESTURE, nullptr, nullptr, nullptr };
46623b3eb3cSopenharmony_ci    auto* gesture = OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createPanGesture(
46723b3eb3cSopenharmony_ci        fingers, mask, distanceNum, ndkGesture);
46823b3eb3cSopenharmony_ci    ndkGesture->gesture = gesture;
46923b3eb3cSopenharmony_ci    return ndkGesture;
47023b3eb3cSopenharmony_ci}
47123b3eb3cSopenharmony_ci
47223b3eb3cSopenharmony_civoid DisposeGesture(ArkUI_GestureRecognizer* recognizer)
47323b3eb3cSopenharmony_ci{
47423b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->dispose(recognizer->gesture);
47523b3eb3cSopenharmony_ci    delete reinterpret_cast<GestureInnerData*>(recognizer->extraData);
47623b3eb3cSopenharmony_ci    recognizer->extraData = nullptr;
47723b3eb3cSopenharmony_ci    delete recognizer;
47823b3eb3cSopenharmony_ci    recognizer = nullptr;
47923b3eb3cSopenharmony_ci}
48023b3eb3cSopenharmony_ci
48123b3eb3cSopenharmony_ciint32_t SetGestureEventTarget(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventActionTypeMask mask,
48223b3eb3cSopenharmony_ci    void* extraParam, void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParam))
48323b3eb3cSopenharmony_ci{
48423b3eb3cSopenharmony_ci    // 手势事件通过通用的异步事件接口进行处理。(HandleGestureEvent)
48523b3eb3cSopenharmony_ci    // 把回调函数和上下文都封装到内部结构体中。
48623b3eb3cSopenharmony_ci    if (recognizer->extraData) {
48723b3eb3cSopenharmony_ci        delete reinterpret_cast<GestureInnerData*>(recognizer->extraData);
48823b3eb3cSopenharmony_ci        recognizer->extraData = nullptr;
48923b3eb3cSopenharmony_ci    }
49023b3eb3cSopenharmony_ci    recognizer->extraData = new GestureInnerData { targetReceiver, extraParam, recognizer };
49123b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->registerGestureEvent(
49223b3eb3cSopenharmony_ci        recognizer->gesture, mask, recognizer->extraData);
49323b3eb3cSopenharmony_ci    return 0;
49423b3eb3cSopenharmony_ci}
49523b3eb3cSopenharmony_ci
49623b3eb3cSopenharmony_ciint32_t AddGestureToNode(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer, ArkUI_GesturePriority priorityNum,
49723b3eb3cSopenharmony_ci    ArkUI_GestureMask mask)
49823b3eb3cSopenharmony_ci{
49923b3eb3cSopenharmony_ci    recognizer->attachNode = node;
50023b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->addGestureToNode(
50123b3eb3cSopenharmony_ci        node->uiNodeHandle, recognizer->gesture, priorityNum, mask);
50223b3eb3cSopenharmony_ci    recognizer->targetInfo.uiNode = reinterpret_cast<void*>(node->uiNodeHandle);
50323b3eb3cSopenharmony_ci    return 0;
50423b3eb3cSopenharmony_ci}
50523b3eb3cSopenharmony_ci
50623b3eb3cSopenharmony_ciint32_t RemoveGestureFromNode(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer)
50723b3eb3cSopenharmony_ci{
50823b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->removeGestureFromNode(
50923b3eb3cSopenharmony_ci        node->uiNodeHandle, recognizer->gesture);
51023b3eb3cSopenharmony_ci    recognizer->targetInfo.uiNode = nullptr;
51123b3eb3cSopenharmony_ci    return 0;
51223b3eb3cSopenharmony_ci}
51323b3eb3cSopenharmony_ci
51423b3eb3cSopenharmony_ciArkUI_GestureRecognizerType GetGestureType(ArkUI_GestureRecognizer* recognizer)
51523b3eb3cSopenharmony_ci{
51623b3eb3cSopenharmony_ci    return static_cast<ArkUI_GestureRecognizerType>(recognizer->type);
51723b3eb3cSopenharmony_ci}
51823b3eb3cSopenharmony_ci
51923b3eb3cSopenharmony_ciArkUI_GestureRecognizer* CreateGroupGesture(ArkUI_GroupGestureMode gestureMode)
52023b3eb3cSopenharmony_ci{
52123b3eb3cSopenharmony_ci    auto* gesture =
52223b3eb3cSopenharmony_ci        OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createGestureGroup(gestureMode);
52323b3eb3cSopenharmony_ci    return new ArkUI_GestureRecognizer { GROUP_GESTURE, gesture, nullptr };
52423b3eb3cSopenharmony_ci}
52523b3eb3cSopenharmony_ci
52623b3eb3cSopenharmony_ciint32_t AddChildGesture(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child)
52723b3eb3cSopenharmony_ci{
52823b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->addGestureToGestureGroup(
52923b3eb3cSopenharmony_ci        group->gesture, child->gesture);
53023b3eb3cSopenharmony_ci    return 0;
53123b3eb3cSopenharmony_ci}
53223b3eb3cSopenharmony_ci
53323b3eb3cSopenharmony_ciint32_t RemoveChildGesture(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child)
53423b3eb3cSopenharmony_ci{
53523b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->removeGestureFromGestureGroup(
53623b3eb3cSopenharmony_ci        group->gesture, child->gesture);
53723b3eb3cSopenharmony_ci    return 0;
53823b3eb3cSopenharmony_ci}
53923b3eb3cSopenharmony_ci
54023b3eb3cSopenharmony_civoid HandleGestureEvent(ArkUINodeEvent* event)
54123b3eb3cSopenharmony_ci{
54223b3eb3cSopenharmony_ci    if (event == nullptr) {
54323b3eb3cSopenharmony_ci        return;
54423b3eb3cSopenharmony_ci    }
54523b3eb3cSopenharmony_ci    auto* extraData = reinterpret_cast<GestureInnerData*>(event->extraParam);
54623b3eb3cSopenharmony_ci    if (extraData == nullptr) {
54723b3eb3cSopenharmony_ci        return;
54823b3eb3cSopenharmony_ci    }
54923b3eb3cSopenharmony_ci    ArkUI_GestureEvent* gestureEvent = reinterpret_cast<ArkUI_GestureEvent *>(&event->gestureAsyncEvent);
55023b3eb3cSopenharmony_ci    if (gestureEvent == nullptr || extraData->targetReceiver == nullptr) {
55123b3eb3cSopenharmony_ci        return;
55223b3eb3cSopenharmony_ci    }
55323b3eb3cSopenharmony_ci    ArkUI_UIInputEvent uiEvent;
55423b3eb3cSopenharmony_ci    if (gestureEvent->eventData.inputEventType == static_cast<int32_t>(ARKUI_UIINPUTEVENT_TYPE_MOUSE)) {
55523b3eb3cSopenharmony_ci        uiEvent.eventTypeId = C_MOUSE_EVENT_ID;
55623b3eb3cSopenharmony_ci        uiEvent.inputType = ARKUI_UIINPUTEVENT_TYPE_MOUSE;
55723b3eb3cSopenharmony_ci    } else if (gestureEvent->eventData.inputEventType == static_cast<int32_t>(ARKUI_UIINPUTEVENT_TYPE_AXIS)) {
55823b3eb3cSopenharmony_ci        uiEvent.eventTypeId = C_AXIS_EVENT_ID;
55923b3eb3cSopenharmony_ci        uiEvent.inputType = ARKUI_UIINPUTEVENT_TYPE_AXIS;
56023b3eb3cSopenharmony_ci    } else {
56123b3eb3cSopenharmony_ci        uiEvent.eventTypeId = C_TOUCH_EVENT_ID;
56223b3eb3cSopenharmony_ci        uiEvent.inputType = ARKUI_UIINPUTEVENT_TYPE_TOUCH;
56323b3eb3cSopenharmony_ci    }
56423b3eb3cSopenharmony_ci    uiEvent.inputEvent = gestureEvent->eventData.rawPointerEvent;
56523b3eb3cSopenharmony_ci    gestureEvent->eventData.rawPointerEvent = &uiEvent;
56623b3eb3cSopenharmony_ci    if (extraData->gesture) {
56723b3eb3cSopenharmony_ci        ArkUI_GestureRecognizer* recognizer = reinterpret_cast<ArkUI_GestureRecognizer*>(extraData->gesture);
56823b3eb3cSopenharmony_ci        gestureEvent->attachNode = recognizer->attachNode;
56923b3eb3cSopenharmony_ci    }
57023b3eb3cSopenharmony_ci    extraData->targetReceiver(gestureEvent, extraData->extraParam);
57123b3eb3cSopenharmony_ci}
57223b3eb3cSopenharmony_ci
57323b3eb3cSopenharmony_ciint32_t SetGestureInterrupterToNode(
57423b3eb3cSopenharmony_ci    ArkUI_NodeHandle node,  ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info))
57523b3eb3cSopenharmony_ci{
57623b3eb3cSopenharmony_ci    auto callback = reinterpret_cast<int32_t (*)(ArkUIGestureInterruptInfo*)>(interrupter);
57723b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->setGestureInterrupterToNode(
57823b3eb3cSopenharmony_ci        node->uiNodeHandle, callback);
57923b3eb3cSopenharmony_ci    return 0;
58023b3eb3cSopenharmony_ci}
58123b3eb3cSopenharmony_ci
58223b3eb3cSopenharmony_ciint32_t SetInnerGestureParallelTo(ArkUI_NodeHandle node, void* userData,
58323b3eb3cSopenharmony_ci    ArkUI_GestureRecognizer* (*parallelInnerGesture)(ArkUI_ParallelInnerGestureEvent* event))
58423b3eb3cSopenharmony_ci{
58523b3eb3cSopenharmony_ci    auto callback =
58623b3eb3cSopenharmony_ci        reinterpret_cast<ArkUIGestureRecognizer* (*)(ArkUIParallelInnerGestureEvent * current)>(parallelInnerGesture);
58723b3eb3cSopenharmony_ci    OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->setInnerGestureParallelTo(
58823b3eb3cSopenharmony_ci        node->uiNodeHandle, userData, callback);
58923b3eb3cSopenharmony_ci    return 0;
59023b3eb3cSopenharmony_ci}
59123b3eb3cSopenharmony_ci
59223b3eb3cSopenharmony_ci}; // namespace OHOS::Ace::GestureModel