fix(macos): merge duplicate platform detection and remove non-passive wheel listener

This commit is contained in:
Afonso Jorge Ramos committed 2026-03-20 01:14:27 +01:00
1 parent ebe555b7ca
commit 7dca962080
1 file changed
+3 -8
+3 -8
View File
@@ -23,19 +23,14 @@
html[data-no-titlebar] .titlebar { display: none !important; }
</style>
<script>
// Detect macOS for platform-specific CSS and behavior
// Detect macOS for platform-specific CSS and behavior.
// Prevent trackpad pinch-to-zoom and Cmd+scroll zoom in WKWebView —
// this is a desktop app, not a web page, so accidental zoom breaks the UI.
if (/Mac/.test(navigator.platform)) {
document.documentElement.classList.add('macos');
}
// Prevent macOS trackpad pinch-to-zoom and Cmd+scroll zoom in WKWebView.
// This is a desktop app, not a web page — accidental zoom breaks the UI.
if (/Mac/.test(navigator.platform)) {
document.addEventListener('gesturestart', function(e) { e.preventDefault(); });
document.addEventListener('gesturechange', function(e) { e.preventDefault(); });
document.addEventListener('gestureend', function(e) { e.preventDefault(); });
document.addEventListener('wheel', function(e) {
if (e.ctrlKey) e.preventDefault();
}, { passive: false });
}
</script>
<div style="display: contents">%sveltekit.body%</div>