[NDK] fix gesture c-api

Signed-off-by:lisitaolisitao3@huawei.com

Signed-off-by: lisitao <lisitao3@huawei.com>
Change-Id: I06cab2f035618c3d32c9d7817615692e284f9838
This commit is contained in:
lisitao 2024-07-26 08:02:20 +00:00
parent 23032a7a79
commit 081ddba57c

View File

@ -191,6 +191,9 @@ constexpr int32_t DEFAULT_PAN_FINGERS = 1;
constexpr int32_t MAX_PAN_FINGERS = 10;
constexpr double DEFAULT_PINCH_DISTANCE = 5.0f;
constexpr double DEFAULT_SWIPE_SPEED = 100.0f;
constexpr int32_t DEFAULT_TAP_COUNT = 1;
constexpr int32_t DEFAULT_TAP_FINGERS = 1;
constexpr int32_t MAX_TAP_FINGERS = 10;
struct GestureInnerData {
void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParam);
@ -200,6 +203,8 @@ struct GestureInnerData {
ArkUI_GestureRecognizer* CreateTapGesture(int32_t count, int32_t fingers)
{
count = std::max(count, DEFAULT_TAP_COUNT);
fingers = std::clamp(fingers, DEFAULT_TAP_FINGERS, MAX_TAP_FINGERS);
auto* ndkGesture = new ArkUI_GestureRecognizer{ TAP_GESTURE, nullptr, nullptr, nullptr };
auto* gesture = OHOS::Ace::NodeModel::GetFullImpl()->getNodeModifiers()->getGestureModifier()->createTapGesture(
count, fingers, ndkGesture);