mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-02-22 23:12:16 +08:00
commit
05609843f2
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "scrcpy-mask",
|
||||
"private": true,
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scrcpy-mask"
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
description = "A Tauri App"
|
||||
authors = ["AkiChase"]
|
||||
edition = "2021"
|
||||
|
BIN
src-tauri/resource/adb-linux
Normal file
BIN
src-tauri/resource/adb-linux
Normal file
Binary file not shown.
@ -28,9 +28,11 @@ impl ResHelper {
|
||||
pub fn get_file_path(dir: &PathBuf, file_name: ResourceName) -> PathBuf {
|
||||
match file_name {
|
||||
#[cfg(target_os = "windows")]
|
||||
ResourceName::Adb => dir.join("adb.exe"),
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
ResourceName::Adb => dir.join("adb"),
|
||||
ResourceName::Adb => dir.join("adb-win.exe"),
|
||||
#[cfg(target_os = "linux")]
|
||||
ResourceName::Adb => dir.join("adb-linux"),
|
||||
#[cfg(target_os = "macos")]
|
||||
ResourceName::Adb => dir.join("adb-mac"),
|
||||
|
||||
ResourceName::ScrcpyServer => dir.join("scrcpy-server-v2.4"),
|
||||
ResourceName::DefaultKeyConfig => dir.join("default-key-config.json"),
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"productName": "scrcpy-mask",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"identifier": "com.akichase.mask",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
@ -30,11 +30,6 @@
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [
|
||||
"resource/default-key-config.json",
|
||||
"resource/scrcpy-server-v2.4",
|
||||
"resource/adb"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
9
src-tauri/tauri.linux.conf.json.json
Normal file
9
src-tauri/tauri.linux.conf.json.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"bundle": {
|
||||
"resources": [
|
||||
"resource/default-key-config.json",
|
||||
"resource/scrcpy-server-v2.4",
|
||||
"resource/adb-linux"
|
||||
]
|
||||
}
|
||||
}
|
9
src-tauri/tauri.macos.conf.json
Normal file
9
src-tauri/tauri.macos.conf.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"bundle": {
|
||||
"resources": [
|
||||
"resource/default-key-config.json",
|
||||
"resource/scrcpy-server-v2.4",
|
||||
"resource/adb-mac"
|
||||
]
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
"resources": [
|
||||
"resource/default-key-config.json",
|
||||
"resource/scrcpy-server-v2.4",
|
||||
"resource/adb.exe",
|
||||
"resource/adb-win.exe",
|
||||
"resource/AdbWinApi.dll",
|
||||
"resource/AdbWinUsbApi.dll"
|
||||
]
|
||||
|
@ -308,19 +308,15 @@ function addTriggerWhenPressedSkillShortcuts(
|
||||
rangeOrTime: number,
|
||||
pointerId: number
|
||||
) {
|
||||
posX = Math.round((posX / relativeSize.w) * screenSizeW);
|
||||
posY = Math.round((posY / relativeSize.h) * screenSizeH);
|
||||
if (directional) {
|
||||
posX = Math.round((posX / relativeSize.w) * screenSizeW);
|
||||
posY = Math.round((posY / relativeSize.h) * screenSizeH);
|
||||
addShortcut(
|
||||
key,
|
||||
// down
|
||||
async () => {
|
||||
// up doublepress skill
|
||||
for (const [key, val] of doublePressedDownKey) {
|
||||
if (val) {
|
||||
downKeyCBMap.get(key)?.();
|
||||
}
|
||||
}
|
||||
await upDoublePressedKey();
|
||||
const skillOffset = clientPosToSkillOffset(
|
||||
{ x: mouseX, y: mouseY },
|
||||
rangeOrTime
|
||||
@ -346,7 +342,27 @@ function addTriggerWhenPressedSkillShortcuts(
|
||||
undefined
|
||||
);
|
||||
} else {
|
||||
addTapShortcuts(key, relativeSize, rangeOrTime, posX, posY, pointerId);
|
||||
addShortcut(
|
||||
key,
|
||||
async () => {
|
||||
await upDoublePressedKey();
|
||||
await touch({
|
||||
action: TouchAction.Default,
|
||||
pointerId,
|
||||
screen: {
|
||||
w: screenSizeW,
|
||||
h: screenSizeH,
|
||||
},
|
||||
pos: {
|
||||
x: posX,
|
||||
y: posY,
|
||||
},
|
||||
time: rangeOrTime,
|
||||
});
|
||||
},
|
||||
undefined,
|
||||
undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,11 +472,7 @@ function addDirectionlessSkillShortcuts(
|
||||
// down
|
||||
async () => {
|
||||
// up doublepress skill
|
||||
for (const [key, val] of doublePressedDownKey) {
|
||||
if (val) {
|
||||
downKeyCBMap.get(key)?.();
|
||||
}
|
||||
}
|
||||
await upDoublePressedKey();
|
||||
await touch({
|
||||
action: TouchAction.Down,
|
||||
pointerId,
|
||||
@ -495,6 +507,15 @@ function addDirectionlessSkillShortcuts(
|
||||
);
|
||||
}
|
||||
|
||||
// up all double pressed key
|
||||
async function upDoublePressedKey() {
|
||||
for (const [key, val] of doublePressedDownKey) {
|
||||
if (val) {
|
||||
await downKeyCBMap.get(key)?.();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add shortcuts for directional skill (cancelable)
|
||||
function addDirectionalSkillShortcuts(
|
||||
key: string,
|
||||
@ -512,11 +533,7 @@ function addDirectionalSkillShortcuts(
|
||||
// down
|
||||
async () => {
|
||||
// up doublepress skill
|
||||
for (const [key, val] of doublePressedDownKey) {
|
||||
if (val) {
|
||||
downKeyCBMap.get(key)?.();
|
||||
}
|
||||
}
|
||||
await upDoublePressedKey();
|
||||
const skillOffset = clientPosToSkillOffset(
|
||||
{ x: mouseX, y: mouseY },
|
||||
range
|
||||
@ -787,8 +804,8 @@ const upKeyCBMap: Map<string, () => Promise<void>> = new Map();
|
||||
const cancelAbleKeyList: string[] = [];
|
||||
|
||||
function keydownHandler(event: KeyboardEvent) {
|
||||
if (event.repeat) return;
|
||||
event.preventDefault();
|
||||
if (event.repeat) return;
|
||||
if (downKeyMap.has(event.code)) {
|
||||
downKeyMap.set(event.code, true);
|
||||
// execute the down callback (if there is) asyncily
|
||||
|
Loading…
Reference in New Issue
Block a user