Merge pull request #45 from AkiChase/dev

Scrcpy Mask v0.4.4
This commit is contained in:
如初 2024-05-23 19:27:45 +08:00 committed by GitHub
commit fea30b480e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 59 additions and 29 deletions

View File

@ -61,7 +61,24 @@ jobs:
with: with:
tagName: "v__VERSION__" tagName: "v__VERSION__"
releaseName: "Scrcpy Mask v__VERSION__" releaseName: "Scrcpy Mask v__VERSION__"
releaseBody: "Add release notes here." releaseBody: |
## 更新说明
本次更新主要新增了...
本次更新主要修复了...
---
## Update Notice
...
---
## Commits
...
releaseDraft: true releaseDraft: true
prerelease: false prerelease: false
args: ${{ matrix.args }} args: ${{ matrix.args }}

View File

@ -1,7 +1,7 @@
{ {
"name": "scrcpy-mask", "name": "scrcpy-mask",
"private": true, "private": true,
"version": "0.4.3", "version": "0.4.4",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "scrcpy-mask" name = "scrcpy-mask"
version = "0.4.3" version = "0.4.4"
description = "A Tauri App" description = "A Tauri App"
authors = ["AkiChase"] authors = ["AkiChase"]
edition = "2021" edition = "2021"

View File

@ -94,6 +94,7 @@ impl Adb {
cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
return cmd; return cmd;
} }
#[cfg(not(target_os = "windows"))]
Command::new(adb_path) Command::new(adb_path)
} }

View File

@ -207,19 +207,27 @@ async fn main() {
// restore window position and size // restore window position and size
match store.get("maskArea") { match store.get("maskArea") {
Some(value) => { Some(value) => {
let pos_x = value["posX"].as_i64().unwrap_or(100); let pos_x = value["posX"].as_i64();
let pos_y = value["posY"].as_i64().unwrap_or(100); let pos_y = value["posY"].as_i64();
let size_w = value["sizeW"].as_i64().unwrap_or(800); let size_w = value["sizeW"].as_i64().unwrap_or(800);
let size_h = value["sizeH"].as_i64().unwrap_or(600); let size_h = value["sizeH"].as_i64().unwrap_or(600);
let main_window: tauri::WebviewWindow = let main_window: tauri::WebviewWindow =
app.get_webview_window("main").unwrap(); app.get_webview_window("main").unwrap();
main_window.set_zoom(1.).unwrap_or(()); main_window.set_zoom(1.).unwrap_or(());
main_window
.set_position(tauri::Position::Logical(tauri::LogicalPosition { if pos_x.is_none() || pos_y.is_none() {
x: (pos_x - 70) as f64, main_window.center().unwrap_or(());
y: (pos_y - 30) as f64, } else {
})) main_window
.unwrap(); .set_position(tauri::Position::Logical(tauri::LogicalPosition {
x: (pos_x.unwrap() - 70) as f64,
y: (pos_y.unwrap() - 30) as f64,
}))
.unwrap();
}
main_window main_window
.set_size(tauri::Size::Logical(tauri::LogicalSize { .set_size(tauri::Size::Logical(tauri::LogicalSize {
width: (size_w + 70) as f64, width: (size_w + 70) as f64,
@ -230,23 +238,15 @@ async fn main() {
None => { None => {
let main_window: tauri::WebviewWindow = let main_window: tauri::WebviewWindow =
app.get_webview_window("main").unwrap(); app.get_webview_window("main").unwrap();
main_window.center().unwrap_or(());
main_window main_window
.set_size(tauri::Size::Logical(tauri::LogicalSize { .set_size(tauri::Size::Logical(tauri::LogicalSize {
width: (800 + 70) as f64, width: (800 + 70) as f64,
height: (600 + 30) as f64, height: (600 + 30) as f64,
})) }))
.unwrap(); .unwrap();
store
.insert(
"maskArea".to_string(),
serde_json::json!({
"posX": 0,
"posY": 0,
"sizeW": 800,
"sizeH": 600
}),
)
.unwrap();
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"productName": "scrcpy-mask", "productName": "scrcpy-mask",
"version": "0.4.3", "version": "0.4.4",
"identifier": "com.akichase.mask", "identifier": "com.akichase.mask",
"build": { "build": {
"beforeDevCommand": "pnpm dev", "beforeDevCommand": "pnpm dev",

View File

@ -13,7 +13,8 @@ async function maximizeOrRestore() {
</script> </script>
<template> <template>
<div data-tauri-drag-region class="header"> <div class="header">
<div data-tauri-drag-region class="drag"></div>
<NButtonGroup> <NButtonGroup>
<NButton quaternary :focusable="false" @click="getCurrent().minimize()"> <NButton quaternary :focusable="false" @click="getCurrent().minimize()">
<template #icon> <template #icon>
@ -49,6 +50,15 @@ async function maximizeOrRestore() {
align-items: center; align-items: center;
border-radius: 0 10px 0 0; border-radius: 0 10px 0 0;
.n-button-group{
flex-shrink: 0;
}
.drag{
flex-grow: 1;
height: 100%;
}
.close { .close {
border-radius: 0 10px 0 0; border-radius: 0 10px 0 0;
&:hover { &:hover {

View File

@ -55,7 +55,7 @@ async function changeScreenPowerMode() {
</script> </script>
<template> <template>
<div data-tauri-drag-region class="sidebar"> <div class="sidebar">
<div data-tauri-drag-region class="logo">S M</div> <div data-tauri-drag-region class="logo">S M</div>
<div class="module"> <div class="module">
<div :class="{ active: route.name == 'mask' }" @click="nav('mask')"> <div :class="{ active: route.name == 'mask' }" @click="nav('mask')">
@ -82,7 +82,7 @@ async function changeScreenPowerMode() {
</NIcon> </NIcon>
</div> </div>
</div> </div>
<div data-tauri-drag-region class="drag"></div>
<div class="nav"> <div class="nav">
<div @click="changeScreenPowerMode"> <div @click="changeScreenPowerMode">
<NIcon> <NIcon>
@ -142,11 +142,13 @@ async function changeScreenPowerMode() {
cursor: pointer; cursor: pointer;
} }
.drag{
flex-grow: 1;
width: 100%;
}
.module { .module {
display: flex; display: flex;
flex: 1;
min-height: 0;
flex-direction: column; flex-direction: column;
& > div { & > div {