mirror of
https://github.com/openharmony/accessibility.git
synced 2026-08-24 22:11:28 -04:00
@@ -1030,7 +1030,7 @@ bool ConvertEventInfoJSToNAPI(napi_env env, napi_value object, AccessibilityEven
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ConvertGesturePointJSToNAPI(
|
||||
static bool ConvertGesturePointJSToNAPI(
|
||||
napi_env env, napi_value object, AccessibilityGesturePosition& gesturePathPosition)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
@@ -1045,6 +1045,8 @@ static void ConvertGesturePointJSToNAPI(
|
||||
napi_get_property(env, object, propertyNameValue, &valueX);
|
||||
napi_get_value_double(env, valueX, &position);
|
||||
gesturePathPosition.positionX_ = static_cast<float>(position);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "positionY", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
@@ -1054,7 +1056,10 @@ static void ConvertGesturePointJSToNAPI(
|
||||
napi_get_property(env, object, propertyNameValue, &valueY);
|
||||
napi_get_value_double(env, valueY, &position);
|
||||
gesturePathPosition.positionY_ = static_cast<float>(position);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ConvertGesturePathJSToNAPI(napi_env env, napi_value object,
|
||||
@@ -1087,8 +1092,10 @@ static void ConvertGesturePathJSToNAPI(napi_env env, napi_value object,
|
||||
HILOG_ERROR("get element of paths failed and i = %{public}d", i);
|
||||
return;
|
||||
}
|
||||
ConvertGesturePointJSToNAPI(env, jsValue, path);
|
||||
gesturePath->AddPosition(path);
|
||||
bool result = ConvertGesturePointJSToNAPI(env, jsValue, path);
|
||||
if (result) {
|
||||
gesturePath->AddPosition(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ bool AccessibilityGestureRecognizer::StandardGestureRecognizer(MMI::PointerEvent
|
||||
case MMI::PointerEvent::POINTER_ACTION_DOWN:
|
||||
if (event.GetPointersIdList().size() == POINTER_COUNT_1) {
|
||||
if (pCurDown_ && pPreUp_ && isDoubleTap(event)) {
|
||||
HILOG_DEBUG("Double tap is recognized");
|
||||
isDoubleTapdetecting_ = true;
|
||||
isDoubleTap_ = true;
|
||||
} else {
|
||||
@@ -421,6 +422,7 @@ bool AccessibilityGestureRecognizer::isDoubleTap(MMI::PointerEvent &event)
|
||||
HILOG_DEBUG();
|
||||
int64_t durationTime = event.GetActionTime() - pPreUp_->GetActionTime();
|
||||
if (!(durationTime <= DOUBLE_TAP_TIMEOUT && durationTime >= MIN_DOUBLE_TAP_TIME)) {
|
||||
HILOG_WARN("durationTime[%{public}" PRId64 "] is wrong", durationTime);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void TouchEventInjector::ParseTapsEvents(int64_t startTime)
|
||||
}
|
||||
int64_t perDurationTime = static_cast<int64_t>(static_cast<uint64_t>(durationTime) / positionSize);
|
||||
int64_t downTime = startTime;
|
||||
int64_t nowTime = startTime;
|
||||
int64_t upTime = 0;
|
||||
for (size_t i = 0; i < positionSize; i++) {
|
||||
std::shared_ptr<MMI::PointerEvent> event;
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
@@ -231,12 +231,11 @@ void TouchEventInjector::ParseTapsEvents(int64_t startTime)
|
||||
injectedEvents_.push_back(event);
|
||||
|
||||
// Append up event
|
||||
nowTime += perDurationTime * MS_TO_US;
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, pointer, nowTime);
|
||||
upTime = downTime + perDurationTime * MS_TO_US;
|
||||
event = obtainTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, pointer, upTime);
|
||||
HILOG_DEBUG("append up event");
|
||||
injectedEvents_.push_back(event);
|
||||
nowTime += DOUBLE_TAP_MIN_TIME;
|
||||
downTime += DOUBLE_TAP_MIN_TIME;
|
||||
downTime = upTime + DOUBLE_TAP_MIN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ void TouchGuider::ElementOperatorCallbackImpl::SetFocusMoveSearchResult(const Ac
|
||||
|
||||
void TouchGuider::ElementOperatorCallbackImpl::SetExecuteActionResult(const bool succeeded, const int32_t requestId)
|
||||
{
|
||||
HILOG_DEBUG("Response [requestId:%{public}d]", requestId);
|
||||
HILOG_DEBUG("Response [result:%{public}d, requestId:%{public}d]", succeeded, requestId);
|
||||
executeActionResult_ = succeeded;
|
||||
promise_.set_value();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user