修复 macOS Retina 下窗口尺寸异常与默认窗口过小问题

This commit is contained in:
JSR
2026-03-19 21:28:02 +08:00
parent 13c9dcaa61
commit a782da9037
3 changed files with 9 additions and 6 deletions
+4 -1
View File
@@ -126,7 +126,10 @@ pub async fn window_resize(
#[cfg(desktop)]
if let Some(window) = app.get_webview_window("main") {
window
.set_size(tauri::Size::Physical(tauri::PhysicalSize { width, height }))
.set_size(tauri::Size::Logical(tauri::LogicalSize {
width: width as f64,
height: height as f64,
}))
.map_err(|e| e.to_string())?;
}
Ok(())
+3 -3
View File
@@ -298,9 +298,9 @@ 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") {
let _ = window.set_size(tauri::Size::Physical(tauri::PhysicalSize {
width: 1180,
height: 680,
let _ = window.set_size(tauri::Size::Logical(tauri::LogicalSize {
width: 1180.0,
height: 680.0,
}));
let _ = window.center();
+2 -2
View File
@@ -15,8 +15,8 @@
"windows": [
{
"title": "SecScore",
"width": 10000,
"height": 10000,
"width": 1180,
"height": 680,
"resizable": true,
"fullscreen": false,
"decorations": false,