Compare commits

...
Author SHA1 Message Date
Connor Yoh 3426f5c26a fix(desktop): enable trackpad pinch-zoom in PDF viewer on Windows
WebView2 ships with IsPinchZoomEnabled=true, which intercepts trackpad
pinches as a compositor-level "Page Scale" zoom in a post-render step and
never dispatches the synthetic ctrl+wheel event the PDF viewer's
useWheelZoom hook relies on. Chrome/Firefox fire that event so pinch-zoom
works there but not in the Tauri desktop app.

Add the --disable-pinch WebView2 browser arg so Chromium reverts to its
standard ctrl+wheel dispatch, which the existing zoom handler consumes.
Applied in both the main window (tauri.conf.json) and spawned windows
(window.rs) since WebView2 requires byte-for-byte identical browser args
to share one user-data folder.
2026-06-01 16:00:46 +01:00
2 changed files with 8 additions and 3 deletions
@@ -47,9 +47,14 @@ fn build_window(app: &AppHandle, label: &str, url: &str) -> Result<WebviewWindow
// nothing more. We mirror that string byte-for-byte so windows share one data
// dir (and thus IndexedDB / localStorage / cookies). macOS (WKWebView) and
// Linux (WebKitGTK) don't have this constraint, so the arg is Windows-only.
//
// `--disable-pinch` turns off WebView2's built-in "Page Scale" pinch zoom,
// which otherwise intercepts trackpad pinches as a post-render compositor step
// and never dispatches the synthetic ctrl+wheel event the PDF viewer relies on
// for zoom. Must stay byte-for-byte in sync with tauri.conf.json.
#[cfg(target_os = "windows")]
let builder =
builder.additional_browser_args("--enable-features=CertVerifierBuiltinFeature");
let builder = builder
.additional_browser_args("--enable-features=CertVerifierBuiltinFeature --disable-pinch");
builder.build().map_err(|e| e.to_string())
}
+1 -1
View File
@@ -17,7 +17,7 @@
"height": 800,
"resizable": true,
"fullscreen": false,
"additionalBrowserArgs": "--enable-features=CertVerifierBuiltinFeature"
"additionalBrowserArgs": "--enable-features=CertVerifierBuiltinFeature --disable-pinch"
}
]
},