fix: 修复minitouch竖屏下的操作错误

fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/2794
This commit is contained in:
MistEO
2022-11-18 21:38:20 +08:00
parent 35eb427a83
commit 88c2e5c691
5 changed files with 51 additions and 4 deletions

View File

@@ -681,6 +681,7 @@ void asst::Controller::clear_info() noexcept
m_control_scale = 1.0;
m_minitouch_avaiable = false;
m_scale_size = { WindowWidthDefault, WindowHeightDefault };
m_minitouch_props = decltype(m_minitouch_props)();
}
void asst::Controller::close_socket() noexcept
@@ -1401,6 +1402,7 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
}
}
Log.info("The optimal abi is", optimal_abi);
auto minitouch_cmd_rep = [&](const std::string& cfg_cmd) -> std::string {
using namespace asst::utils::path_literals;
return utils::string_replace_all(
@@ -1417,6 +1419,13 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
call_and_hup_minitouch(minitouch_cmd_rep(adb_cfg.call_minitouch));
std::string orientation_str = call_command(cmd_replace(adb_cfg.orientation)).value_or("0");
auto [beg, end] = ranges::remove_if(orientation_str, [](char ch) -> bool { return !std::isdigit(ch); });
orientation_str.erase(beg, end);
if (!orientation_str.empty()) {
m_minitouch_props.orientation = std::stoi(orientation_str);
}
// try to find the fastest way
if (!screencap()) {
Log.error("Cannot find a proper way to screencap!");