feat: 添加adb触控兼容模式

This commit is contained in:
MistEO
2022-11-21 23:25:27 +08:00
parent 1879848120
commit 01346f0613
18 changed files with 291 additions and 58 deletions

View File

@@ -1202,14 +1202,15 @@ bool asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int
return toucher.up();
}
else {
std::string cur_cmd =
utils::string_replace_all(m_adb.swipe, {
{ "[x1]", std::to_string(x1) },
{ "[y1]", std::to_string(y1) },
{ "[x2]", std::to_string(x2) },
{ "[y2]", std::to_string(y2) },
{ "[duration]", duration <= 0 ? "" : std::to_string(duration) },
});
std::string duration_str =
duration <= 0 ? "" : std::to_string(static_cast<int>(duration * opt.adb_swipe_duration_multiplier));
std::string cur_cmd = utils::string_replace_all(m_adb.swipe, {
{ "[x1]", std::to_string(x1) },
{ "[y1]", std::to_string(y1) },
{ "[x2]", std::to_string(x2) },
{ "[y2]", std::to_string(y2) },
{ "[duration]", duration_str },
});
bool ret = call_command(cur_cmd).has_value();
// 额外的滑动adb有bug同样的参数偶尔会划得非常远。额外做一个短程滑动把之前的停下来