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:
tagName: "v__VERSION__"
releaseName: "Scrcpy Mask v__VERSION__"
releaseBody: "Add release notes here."
releaseBody: |
## 更新说明
本次更新主要新增了...
本次更新主要修复了...
---
## Update Notice
...
---
## Commits
...
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}

View File

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

View File

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

View File

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

View File

@ -207,19 +207,27 @@ async fn main() {
// restore window position and size
match store.get("maskArea") {
Some(value) => {
let pos_x = value["posX"].as_i64().unwrap_or(100);
let pos_y = value["posY"].as_i64().unwrap_or(100);
let pos_x = value["posX"].as_i64();
let pos_y = value["posY"].as_i64();
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_or(());
main_window
.set_position(tauri::Position::Logical(tauri::LogicalPosition {
x: (pos_x - 70) as f64,
y: (pos_y - 30) as f64,
}))
.unwrap();
if pos_x.is_none() || pos_y.is_none() {
main_window.center().unwrap_or(());
} else {
main_window
.set_position(tauri::Position::Logical(tauri::LogicalPosition {
x: (pos_x.unwrap() - 70) as f64,
y: (pos_y.unwrap() - 30) as f64,
}))
.unwrap();
}
main_window
.set_size(tauri::Size::Logical(tauri::LogicalSize {
width: (size_w + 70) as f64,
@ -230,23 +238,15 @@ async fn main() {
None => {
let main_window: tauri::WebviewWindow =
app.get_webview_window("main").unwrap();
main_window.center().unwrap_or(());
main_window
.set_size(tauri::Size::Logical(tauri::LogicalSize {
width: (800 + 70) as f64,
height: (600 + 30) as f64,
}))
.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",
"version": "0.4.3",
"version": "0.4.4",
"identifier": "com.akichase.mask",
"build": {
"beforeDevCommand": "pnpm dev",

View File

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

View File

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