| 461 | } |
| 462 | |
| 463 | bool 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 | |
| 486 | bool ControllerAgent::handle_swipe(const SwipeParam& param) |
| 487 | { |
nothing calls this directly
no test coverage detected