From 25784493045fe91c9de7260740cfead1be17ded2 Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Tue, 16 Apr 2024 17:07:25 +0800 Subject: [PATCH 01/50] feat(device): add screen size input --- src-tauri/src/adb.rs | 26 ---------------------- src-tauri/src/client.rs | 5 ----- src-tauri/src/main.rs | 11 ---------- src/components/Device.vue | 46 +++++++++++++++++++++++++++++---------- src/components/Mask.vue | 8 ++----- src/hotkey.ts | 2 ++ src/invoke.ts | 4 ---- src/store/global.ts | 8 +++++-- 8 files changed, 44 insertions(+), 66 deletions(-) diff --git a/src-tauri/src/adb.rs b/src-tauri/src/adb.rs index 8e9edc0..5d9a6d9 100644 --- a/src-tauri/src/adb.rs +++ b/src-tauri/src/adb.rs @@ -58,32 +58,6 @@ impl Device { .spawn() .context("Failed to execute 'adb shell'")?) } - - pub fn cmd_screen_size(res_dir: &PathBuf, id: &str) -> Result<(u16, u16)> { - let mut adb_command = Adb::cmd_base(res_dir); - let output = adb_command - .args(&["-s", id, "shell", "wm", "size"]) - .output() - .context("Failed to execute 'adb shell wm size'")?; - let lines = output.stdout.lines(); - let mut size = (0, 0); - for line in lines { - if let std::result::Result::Ok(s) = line { - println!("{}", s); - if s.starts_with("Physical size:") { - let mut iter = s.split_whitespace(); - iter.next(); - iter.next(); - let mut size_str = iter.next().unwrap().split('x'); - let width = size_str.next().unwrap().parse::().unwrap(); - let height = size_str.next().unwrap().parse::().unwrap(); - size = (width, height); - break; - } - } - } - Ok(size) - } } pub struct Adb; diff --git a/src-tauri/src/client.rs b/src-tauri/src/client.rs index 0f8f521..27a0ba2 100644 --- a/src-tauri/src/client.rs +++ b/src-tauri/src/client.rs @@ -40,11 +40,6 @@ impl ScrcpyClient { Adb::cmd_forward_remove(res_dir) } - /// get the screen size of the device - pub fn get_screen_size(res_dir: &PathBuf, id: &str) -> Result<(u16, u16)> { - Device::cmd_screen_size(res_dir, id) - } - /// push server file to current device pub fn push_server_file(res_dir: &PathBuf, id: &str) -> Result<()> { let info = Device::cmd_push( diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c3fb2a3..97d9a5a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -20,16 +20,6 @@ fn adb_devices(app: tauri::AppHandle) -> Result, String> { } } -#[tauri::command] -/// get screen size of the device -fn get_screen_size(id: String, app: tauri::AppHandle) -> Result<(u16, u16), String> { - let dir = app.path().resource_dir().unwrap().join("resource"); - match ScrcpyClient::get_screen_size(&dir, &id) { - Ok(size) => Ok(size), - Err(e) => Err(e.to_string()), - } -} - #[tauri::command] /// forward local port to the device port fn forward_server_port( @@ -170,7 +160,6 @@ async fn main() { .plugin(tauri_plugin_os::init()) .invoke_handler(tauri::generate_handler![ adb_devices, - get_screen_size, forward_server_port, push_server_file, start_scrcpy_server diff --git a/src/components/Device.vue b/src/components/Device.vue index b03d4bd..8b2276c 100644 --- a/src/components/Device.vue +++ b/src/components/Device.vue @@ -15,7 +15,6 @@ import { pushServerFile, forwardServerPort, startScrcpyServer, - getScreenSize, } from "../invoke"; import { NH4, @@ -26,11 +25,13 @@ import { NEmpty, NTooltip, NFlex, + NFormItem, NIcon, NSpin, DataTableColumns, DropdownOption, useDialog, + useMessage, } from "naive-ui"; import { CloseCircle, InformationCircle } from "@vicons/ionicons5"; import { Refresh } from "@vicons/ionicons5"; @@ -40,6 +41,7 @@ import { useGlobalStore } from "../store/global"; const dialog = useDialog(); const store = useGlobalStore(); +const message = useMessage(); const port = ref(27183); @@ -168,14 +170,21 @@ async function onMenuSelect(key: string) { if (!port.value) { port.value = 27183; } + + if (!(store.screenSizeW > 0) || !(store.screenSizeH > 0)) { + message.error("请正确输入当前控制设备的屏幕尺寸"); + store.screenSizeW = 0; + store.screenSizeH = 0; + store.hideLoading(); + return; + } + let device = devices.value[rowIndex]; let scid = ( "00000000" + Math.floor(Math.random() * 100000).toString(16) ).slice(-8); - let screenSize = await getScreenSize(device.id); - await pushServerFile(device.id); await forwardServerPort(device.id, scid, port.value); await startScrcpyServer(device.id, scid, `127.0.0.1:${port.value}`); @@ -186,7 +195,6 @@ async function onMenuSelect(key: string) { scid, deviceName, device, - screenSize, }; nextTick(() => { store.hideLoading(); @@ -202,13 +210,6 @@ async function refreshDevices() { devices.value = await adbDevices(); store.hideLoading(); } - -const screenSizeInfo = computed(() => { - if (store.controledDevice) { - return `${store.controledDevice.screenSize[0]} x ${store.controledDevice.screenSize[1]}`; - } - return ""; -}); scid: {{ store.controledDevice.scid }}
status: {{ store.controledDevice.device.status }}
screen: - {{ screenSizeInfo }} diff --git a/src/store/global.ts b/src/store/global.ts index 82960d3..b0a3039 100644 --- a/src/store/global.ts +++ b/src/store/global.ts @@ -17,8 +17,8 @@ export const useGlobalStore = defineStore("counter", () => { device: Device; } - const screenSizeW: Ref = ref(1280); - const screenSizeH: Ref = ref(720); + const screenSizeW: Ref = ref(0); + const screenSizeH: Ref = ref(0); const controledDevice: Ref = ref(null); From 3088ebe5de83692f72dba87b8e53b3d5bf2efb42 Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Tue, 16 Apr 2024 22:38:07 +0800 Subject: [PATCH 05/50] feat(hotkey): convert coordinates according to mask and screen size --- src/components/Mask.vue | 20 ++++++++++++++++++-- src/hotkey.ts | 20 ++++++++++++++------ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/components/Mask.vue b/src/components/Mask.vue index f2e7cc7..1223f31 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -3,7 +3,13 @@ import { onActivated, ref } from "vue"; import { NDialog } from "naive-ui"; import { useGlobalStore } from "../store/global"; import { onBeforeRouteLeave, useRouter } from "vue-router"; -import { initShortcuts, listenToKeyEvent, unlistenToKeyEvent } from "../hotkey"; +import { + initShortcuts, + listenToKeyEvent, + unlistenToKeyEvent, + updateScreenSizeAndMaskArea, +} from "../hotkey"; +import { getCurrent } from "@tauri-apps/api/window"; const maskRef = ref(null); @@ -29,7 +35,17 @@ onActivated(async () => { } if (store.controledDevice) { if (maskRef.value) { - initShortcuts([store.screenSizeW, store.screenSizeH], maskRef.value); + const mt = 30; + const ml = 70; + const appWindow = getCurrent(); + const size = (await appWindow.outerSize()).toLogical( + await appWindow.scaleFactor() + ); + updateScreenSizeAndMaskArea( + [store.screenSizeW, store.screenSizeH], + [size.width - ml, size.height - mt] + ); + initShortcuts(maskRef.value); listenToKeyEvent(); isShortcutInited = true; } diff --git a/src/hotkey.ts b/src/hotkey.ts index 7e17bdd..3031603 100644 --- a/src/hotkey.ts +++ b/src/hotkey.ts @@ -6,14 +6,16 @@ import { touch, } from "./frontcommand/scrcpyMaskCmd"; - -// TODO 根据当前蒙版的尺寸换算屏幕尺寸 function clientxToPosx(clientx: number) { - return clientx < 70 ? 0 : Math.floor(clientx - 70); + return clientx < 70 + ? 0 + : Math.floor((clientx - 70) * (screenSizeW / maskSizeW)); } function clientyToPosy(clienty: number) { - return clienty < 30 ? 0 : Math.floor(clienty - 30); + return clienty < 30 + ? 0 + : Math.floor((clienty - 30) * (screenSizeH / maskSizeH)); } function clientxToPosOffsetx(clientx: number, posx: number, scale: number) { @@ -567,6 +569,8 @@ function addClickShortcuts(key: string, pointerId: number) { let screenSizeW: number; let screenSizeH: number; +let maskSizeW: number; +let maskSizeH: number; let mouseX = 0; let mouseY = 0; @@ -816,13 +820,17 @@ export function unlistenToKeyEvent() { loopFlag = false; } -export function initShortcuts( +export function updateScreenSizeAndMaskArea( screenSize: [number, number], - element: HTMLElement + maskArea: [number, number] ) { screenSizeW = screenSize[0]; screenSizeH = screenSize[1]; + maskSizeW = maskArea[0]; + maskSizeH = maskArea[1]; +} +export function initShortcuts(element: HTMLElement) { element.addEventListener("mousedown", handleMouseDown); element.addEventListener("mousemove", handleMouseMove); element.addEventListener("mouseup", handleMouseUp); From b332c60eeab03c75ae091d1b7bd8002fbab54099 Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Tue, 16 Apr 2024 22:50:21 +0800 Subject: [PATCH 06/50] feat(KeyBoard): add mouse event listener --- src/components/Mask.vue | 4 ++-- src/components/keyboard/KeyBoard.vue | 27 +++++++++++++++++++++++++-- src/styles.css | 15 +++++++-------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/components/Mask.vue b/src/components/Mask.vue index 1223f31..7e79409 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -83,12 +83,12 @@ function toStartServer() { diff --git a/src/styles.css b/src/styles.css index 1c38148..2bce007 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1,12 +1,12 @@ :root { - --primary-color: #63E2B7; - --primary-hover-color: #7FE7C4; - --primary-pressed-color: #5ACEA7; + --primary-color: #63e2b7; + --primary-hover-color: #7fe7c4; + --primary-pressed-color: #5acea7; + --bg-color: #101014; - --content-bg-color: #18181C; - --content-hl-color: #26262A; - - --light-color: rgba(255, 255, 255, 0.9); + --content-bg-color: #18181c; + --content-hl-color: #26262a; + --light-color: rgba(255, 255, 255, 0.82); --gray-color: #6b6e76; --red-color: #fc5185; --red-pressed-color: #f4336d; @@ -24,4 +24,3 @@ div#app { height: 100%; box-sizing: border-box; } - From 0f5f6a44bb2964a05c974cb52af08b8314c776da Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 17 Apr 2024 10:17:39 +0800 Subject: [PATCH 07/50] feat(hotkey): add shortcut relative size args --- src-tauri/src/main.rs | 9 +- src/App.vue | 4 + src/components/setting/Mask.vue | 8 +- src/components/setting/Setting.vue | 2 +- src/hotkey.ts | 141 ++++++++++++++++++++--------- 5 files changed, 112 insertions(+), 52 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 506873d..3ce670a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -121,12 +121,13 @@ async fn main() { // restore window position and size match store.get("maskArea") { Some(value) => { - let pos_x = value["posX"].as_i64().unwrap(); - let pos_y = value["posY"].as_i64().unwrap(); - let size_w = value["sizeW"].as_i64().unwrap(); - let size_h = value["sizeH"].as_i64().unwrap(); + let pos_x = value["posX"].as_i64().unwrap_or(100); + let pos_y = value["posY"].as_i64().unwrap_or(100); + let size_w = value["sizeW"].as_i64().unwrap_or(800); + let size_h = value["sizeH"].as_i64().unwrap_or(600); let main_window: tauri::WebviewWindow = app.get_webview_window("main").unwrap(); + main_window.set_zoom(1.).unwrap(); main_window .set_position(tauri::Position::Logical(tauri::LogicalPosition { x: (pos_x - 70) as f64, diff --git a/src/App.vue b/src/App.vue index 6faf855..59efc40 100644 --- a/src/App.vue +++ b/src/App.vue @@ -37,6 +37,10 @@ import { "sidebar content"; } +.n-scrollbar-container{ + background-color: var(--bg-color); +} + .n-scrollbar-content { height: 100%; } diff --git a/src/components/setting/Mask.vue b/src/components/setting/Mask.vue index afa0f2c..500c351 100644 --- a/src/components/setting/Mask.vue +++ b/src/components/setting/Mask.vue @@ -84,12 +84,12 @@ async function refreshAreaModel(size?: PhysicalSize, pos?: PhysicalPosition) { // use logical position and size if (lSize !== undefined) { - areaModel.value.sizeW = lSize.width - ml; - areaModel.value.sizeH = lSize.height - mt; + areaModel.value.sizeW = Math.round(lSize.width) - ml; + areaModel.value.sizeH = Math.round(lSize.height) - mt; } if (lPos !== undefined) { - areaModel.value.posX = lPos.x + ml; - areaModel.value.posY = lPos.y + mt; + areaModel.value.posX = Math.round(lPos.x) + ml; + areaModel.value.posY = Math.round(lPos.y) + mt; } } diff --git a/src/components/setting/Setting.vue b/src/components/setting/Setting.vue index 8f8311d..fa4a7cf 100644 --- a/src/components/setting/Setting.vue +++ b/src/components/setting/Setting.vue @@ -35,7 +35,7 @@ import { NTabs, NTabPane, NScrollbar } from "naive-ui"; overflow-y: auto; display: flex; - .NTabPane { + .n-tab-pane { padding: 0; } diff --git a/src/hotkey.ts b/src/hotkey.ts index 3031603..0b40b0d 100644 --- a/src/hotkey.ts +++ b/src/hotkey.ts @@ -46,30 +46,42 @@ async function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } -function calculateMacroPosX(pos: [string, number] | number): number { - if (typeof pos === "number") { - return pos; +function calculateMacroPosX( + posX: [string, number] | number, + relativeSizeW: number +): number { + if (typeof posX === "number") { + return Math.round(posX * (screenSizeW / relativeSizeW)); } - if (typeof pos === "string") { + if (typeof posX === "string") { return clientxToPosx(mouseX); } else { - if (pos[0] === "mouse") { - return clientxToPosx(mouseX) + pos[1]; + if (posX[0] === "mouse") { + return ( + clientxToPosx(mouseX) + + Math.round(posX[1] * (screenSizeW / relativeSizeW)) + ); } else { throw new Error("Invalid pos"); } } } -function calculateMacroPosY(pos: [string, number] | number): number { - if (typeof pos === "number") { - return pos; +function calculateMacroPosY( + posY: [string, number] | number, + relativeSizeH: number +): number { + if (typeof posY === "number") { + return Math.round(posY * (screenSizeH / relativeSizeH)); } - if (typeof pos === "string") { + if (typeof posY === "string") { return clientyToPosy(mouseY); } else { - if (pos[0] === "mouse") { - return clientyToPosy(mouseY) + pos[1]; + if (posY[0] === "mouse") { + return ( + clientyToPosy(mouseY) + + Math.round(posY[1] * (screenSizeH / relativeSizeH)) + ); } else { throw new Error("Invalid pos"); } @@ -77,12 +89,13 @@ function calculateMacroPosY(pos: [string, number] | number): number { } function calculateMacroPosList( - posList: [[string, number] | number, [string, number] | number][] + posList: [[string, number] | number, [string, number] | number][], + relativeSize: { w: number; h: number } ): { x: number; y: number }[] { return posList.map((posPair) => { return { - x: calculateMacroPosX(posPair[0]), - y: calculateMacroPosY(posPair[1]), + x: calculateMacroPosX(posPair[0], relativeSize.w), + y: calculateMacroPosY(posPair[1], relativeSize.h), }; }); } @@ -92,6 +105,7 @@ function calculateMacroPosList( // add shortcuts for observation function addObservationShortcuts( key: string, + relativeSize: { w: number; h: number }, posX: number, posY: number, scale: number, @@ -99,6 +113,8 @@ function addObservationShortcuts( ) { let observationMouseX = 0; let observationMouseY = 0; + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, async () => { @@ -151,10 +167,13 @@ function addObservationShortcuts( // add shortcuts for simple tap (touch for 100 ms when pressed) function addTapShortcuts( key: string, + relativeSize: { w: number; h: number }, posX: number, posY: number, pointerId: number ) { + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, async () => { @@ -179,10 +198,13 @@ function addTapShortcuts( // add shortcuts for cancel skill function addCancelSkillShortcuts( key: string, + relativeSize: { w: number; h: number }, posX: number, posY: number, pointerId: number ) { + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, async () => { @@ -230,6 +252,7 @@ function addCancelSkillShortcuts( // add shortcuts for trigger when pressed skill function addTriggerWhenPressedSkillShortcuts( key: string, + relativeSize: { w: number; h: number }, // pos relative to the device posX: number, posY: number, @@ -239,6 +262,8 @@ function addTriggerWhenPressedSkillShortcuts( pointerId: number ) { if (directional) { + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, // down @@ -264,18 +289,21 @@ function addTriggerWhenPressedSkillShortcuts( undefined ); } else { - addTapShortcuts(key, posX, posY, pointerId); + addTapShortcuts(key, relativeSize, posX, posY, pointerId); } } // add shortcuts for directionless skill (cancelable) function addDirectionlessSkillShortcuts( key: string, + relativeSize: { w: number; h: number }, // pos relative to the device posX: number, posY: number, pointerId: number ) { + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, // down @@ -317,12 +345,15 @@ function addDirectionlessSkillShortcuts( // add shortcuts for directional skill (cancelable) function addDirectionalSkillShortcuts( key: string, + relativeSize: { w: number; h: number }, // pos relative to the device posX: number, posY: number, range: number, pointerId: number ) { + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); addShortcut( key, // down @@ -381,6 +412,7 @@ function addDirectionalSkillShortcuts( // add shortcuts for steering wheel function addSteeringWheelKeyboardShortcuts( key: wheelKey, + relativeSize: { w: number; h: number }, // pos relative to the device posX: number, posY: number, @@ -390,6 +422,8 @@ function addSteeringWheelKeyboardShortcuts( let loopFlag = false; let curPosX = 0; let curPosY = 0; + posX = Math.round((posX / relativeSize.w) * screenSizeW); + posY = Math.round((posY / relativeSize.h) * screenSizeH); // calculate the end coordinates of the eight directions of the direction wheel let offsetHalf = Math.round(offset / 1.414); @@ -717,7 +751,8 @@ function addShortcut( * }, * ]); */ -async function execMacro(macro: any[]) { + +async function execMacro(relativeSize: { w: number; h: number }, macro: any[]) { for (const cmd of macro) { if (!cmd.hasOwnProperty("type") || !cmd.hasOwnProperty("args")) { console.error("Invalid command: ", cmd); @@ -755,8 +790,8 @@ async function execMacro(macro: any[]) { h: screenSizeH, }, pos: { - x: calculateMacroPosX(cmd.args[2]), - y: calculateMacroPosY(cmd.args[3]), + x: calculateMacroPosX(cmd.args[2], relativeSize.w), + y: calculateMacroPosY(cmd.args[3], relativeSize.h), }, }); break; @@ -783,7 +818,7 @@ async function execMacro(macro: any[]) { w: screenSizeW, h: screenSizeH, }, - pos: calculateMacroPosList(cmd.args[2]), + pos: calculateMacroPosList(cmd.args[2], relativeSize), intervalBetweenPos: cmd.args[3], }); break; @@ -836,6 +871,9 @@ export function initShortcuts(element: HTMLElement) { element.addEventListener("mouseup", handleMouseUp); element.addEventListener("mouseout", handleMouseUp); // mouse out of the element as mouse up + // 读取按键配置文件时获取 + const relativeSize = { w: 1280, h: 720 }; + addClickShortcuts("M0", 0); addSteeringWheelKeyboardShortcuts( { @@ -844,36 +882,53 @@ export function initShortcuts(element: HTMLElement) { up: "KeyW", down: "KeyS", }, + relativeSize, 180, 560, 100, 1 ); - addDirectionalSkillShortcuts("KeyQ", 950, 610, 200, 2); // skill 1 - addDirectionalSkillShortcuts("AltLeft", 1025, 500, 200, 2); // skill 2 - addDirectionalSkillShortcuts("KeyE", 1160, 420, 200, 2); // skill 3 - addTriggerWhenPressedSkillShortcuts("M4", 1160, 420, false, 0, 2); // skill 3 (no direction and trigger when pressed) - addDirectionlessSkillShortcuts("M1", 1150, 280, 2); // equipment skill (middle mouse click) - addCancelSkillShortcuts("Space", 1160, 140, 2); // cancel skill + addDirectionalSkillShortcuts("KeyQ", relativeSize, 950, 610, 200, 2); // skill 1 + addDirectionalSkillShortcuts("AltLeft", relativeSize, 1025, 500, 200, 2); // skill 2 + addDirectionalSkillShortcuts("KeyE", relativeSize, 1160, 420, 200, 2); // skill 3 + addTriggerWhenPressedSkillShortcuts( + "M4", + relativeSize, + 1160, + 420, + false, + 0, + 2 + ); // skill 3 (no direction and trigger when pressed) + addDirectionlessSkillShortcuts("M1", relativeSize, 1150, 280, 2); // equipment skill (middle mouse click) + addCancelSkillShortcuts("Space", relativeSize, 1160, 140, 2); // cancel skill - addTapShortcuts("KeyB", 650, 650, 3); // home - addTapShortcuts("KeyC", 740, 650, 3); // recover - addDirectionalSkillShortcuts("KeyF", 840, 650, 200, 2); // summoner skills - addTriggerWhenPressedSkillShortcuts("ControlLeft", 840, 650, false, 0, 3); // summoner skills (no direction and trigger when pressed) - addTapShortcuts("M2", 1165, 620, 3); // attack (right click) - addTapShortcuts("Digit1", 880, 560, 3); // skill 1 upgrade - addTapShortcuts("Digit2", 960, 430, 3); // skill 2 upgrade - addTapShortcuts("Digit3", 1090, 350, 3); // skill 3 upgrade - addTapShortcuts("Digit5", 130, 300, 3); // quick buy 1 - addTapShortcuts("Digit6", 130, 370, 3); // quick buy 2 + addTapShortcuts("KeyB", relativeSize, 650, 650, 3); // home + addTapShortcuts("KeyC", relativeSize, 740, 650, 3); // recover + addDirectionalSkillShortcuts("KeyF", relativeSize, 840, 650, 200, 2); // summoner skills + addTriggerWhenPressedSkillShortcuts( + "ControlLeft", + relativeSize, + 840, + 650, + false, + 0, + 3 + ); // summoner skills (no direction and trigger when pressed) + addTapShortcuts("M2", relativeSize, 1165, 620, 3); // attack (right click) + addTapShortcuts("Digit1", relativeSize, 880, 560, 3); // skill 1 upgrade + addTapShortcuts("Digit2", relativeSize, 960, 430, 3); // skill 2 upgrade + addTapShortcuts("Digit3", relativeSize, 1090, 350, 3); // skill 3 upgrade + addTapShortcuts("Digit5", relativeSize, 130, 300, 3); // quick buy 1 + addTapShortcuts("Digit6", relativeSize, 130, 370, 3); // quick buy 2 - addObservationShortcuts("M3", 1000, 200, 0.5, 4); // observation + addObservationShortcuts("M3", relativeSize, 1000, 200, 0.5, 4); // observation // panel addShortcut( "Tab", async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 1185, 40], @@ -882,7 +937,7 @@ export function initShortcuts(element: HTMLElement) { }, undefined, async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 1220, 100], @@ -895,7 +950,7 @@ export function initShortcuts(element: HTMLElement) { addShortcut( "ShiftLeft", async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 40, 300], @@ -904,7 +959,7 @@ export function initShortcuts(element: HTMLElement) { }, undefined, async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 1200, 60], @@ -917,7 +972,7 @@ export function initShortcuts(element: HTMLElement) { addShortcut( "KeyZ", async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 250, 230], @@ -926,7 +981,7 @@ export function initShortcuts(element: HTMLElement) { }, undefined, async () => { - await execMacro([ + await execMacro(relativeSize, [ { type: "touch", args: ["default", 5, 640, 150], From 93389f825b2487fe9a65b51f8d443fa37d3b001c Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 17 Apr 2024 11:01:42 +0800 Subject: [PATCH 08/50] docs(all): adjust TODO --- src/components/Mask.vue | 3 +-- src/components/keyboard/KeyBoard.vue | 4 ++-- src/hotkey.ts | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Mask.vue b/src/components/Mask.vue index 7e79409..1674d72 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -56,8 +56,7 @@ function toStartServer() { router.replace({ name: "device" }); } -// TODO 按键设置 -// TODO 渲染按钮 +// TODO 3. 根据配置渲染按钮