mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
修复 macOS 窗口圆角显示异常
This commit is contained in:
@@ -14,7 +14,7 @@ crate-type = ["staticlib", "cdylib", "lib"]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = ["tray-icon", "image-png", "protocol-asset"] }
|
||||
tauri = { version = "2", features = ["macos-private-api", "tray-icon", "image-png", "protocol-asset"] }
|
||||
tauri-plugin-shell = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
||||
@@ -298,6 +298,11 @@ fn setup_tray(_app: &mut App) -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[cfg(desktop)]
|
||||
fn setup_window_events(app: &mut App) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let _ = window.set_shadow(true);
|
||||
}
|
||||
|
||||
let window_clone = window.clone();
|
||||
window.on_window_event(move |event| {
|
||||
if let WindowEvent::CloseRequested { api, .. } = event {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"app": {
|
||||
"withGlobalTauri": true,
|
||||
"macOSPrivateApi": true,
|
||||
"windows": [
|
||||
{
|
||||
"title": "SecScore",
|
||||
@@ -19,7 +20,7 @@
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"decorations": false,
|
||||
"transparent": false,
|
||||
"transparent": true,
|
||||
"center": true,
|
||||
"minWidth": 800,
|
||||
"minHeight": 600
|
||||
|
||||
@@ -102,3 +102,13 @@ select {
|
||||
.ss-operation-drawer .ant-drawer-header button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
html.platform-macos,
|
||||
html.platform-macos body {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
html.platform-macos #root {
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,11 @@ const disableTouchZoom = () => {
|
||||
}
|
||||
disableTouchZoom()
|
||||
|
||||
const platform = navigator.userAgent.toLowerCase()
|
||||
if (platform.includes("mac")) {
|
||||
document.documentElement.classList.add("platform-macos")
|
||||
}
|
||||
|
||||
window.addEventListener("error", (e: any) => {
|
||||
const error = e?.error
|
||||
safeWriteLog({
|
||||
|
||||
Reference in New Issue
Block a user