MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / handle_long_press

Method handle_long_press

source/MaaFramework/Controller/ControllerAgent.cpp:463–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463bool ControllerAgent::handle_long_press(const LongPressParam& param)
464{
465 if (!control_unit_) {
466 LogError << "control_unit_ is nullptr";
467 return false;
468 }
469
470 cv::Point point = preproc_touch_point(param.point);
471
472 bool ret = true;
473 if (control_unit_->get_features() & MaaControllerFeature_UseMouseDownAndUpInsteadOfClick) {
474 ret &= control_unit_->touch_down(param.contact, point.x, point.y, param.pressure);
475 std::this_thread::sleep_for(std::chrono::milliseconds(param.duration));
476 ret &= control_unit_->touch_up(param.contact);
477 }
478 else {
479 LogWarn << "long press not supported, use click instead";
480 ret &= control_unit_->click(point.x, point.y);
481 }
482
483 return ret;
484}
485
486bool ControllerAgent::handle_swipe(const SwipeParam& param)
487{

Callers

nothing calls this directly

Calls 4

get_featuresMethod · 0.65
touch_downMethod · 0.65
touch_upMethod · 0.65
clickMethod · 0.65

Tested by

no test coverage detected