fix(macos): merge duplicate platform detection and remove non-passive wheel listener
This commit is contained in:
1 file changed
+3
-8
+3
-8
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user