From fc912212403cbdcdbbc6ff515bafbf06db830288 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Thu, 3 Aug 2023 00:51:21 +0800 Subject: [PATCH] Fix: No orientation handle in MaaTouch --- module/device/method/maatouch.py | 2 +- module/device/method/minitouch.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/module/device/method/maatouch.py b/module/device/method/maatouch.py index 7ac656b96..24056a58f 100644 --- a/module/device/method/maatouch.py +++ b/module/device/method/maatouch.py @@ -94,7 +94,7 @@ class MaaTouch(Connection): @cached_property def maatouch_builder(self): self.maatouch_init() - return CommandBuilder(self) + return CommandBuilder(self, handle_orientation=False) def maatouch_init(self): logger.hr('MaaTouch init') diff --git a/module/device/method/minitouch.py b/module/device/method/minitouch.py index d6397fe76..70abd1a1c 100644 --- a/module/device/method/minitouch.py +++ b/module/device/method/minitouch.py @@ -1,5 +1,6 @@ import asyncio import json +import re import socket import time from functools import wraps @@ -183,7 +184,7 @@ class CommandBuilder: max_x = 1280 max_y = 720 - def __init__(self, device): + def __init__(self, device, handle_orientation=True): """ Args: device: @@ -191,10 +192,18 @@ class CommandBuilder: self.device = device self.commands = [] self.delay = 0 + self.handle_orientation = handle_orientation + + @property + def orientation(self): + if self.handle_orientation: + return self.device.orientation + else: + return 0 def convert(self, x, y): max_x, max_y = self.device.max_x, self.device.max_y - orientation = self.device.orientation + orientation = self.orientation if orientation == 0: pass