GeezerVison is showing github.com — fix(desktop): completely disable pinch to zoom · prashanthpai/opencode@8b37932
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/desktop/src-tauri/tauri.conf.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | "url": "/", | 20 | 20 | "decorations": true, | 21 | 21 | "dragDropEnabled": false, | 22 | | - "zoomHotkeysEnabled": true, | | 22 | + "zoomHotkeysEnabled": false, | 23 | 23 | "titleBarStyle": "Overlay", | 24 | 24 | "hiddenTitle": true, | 25 | 25 | "trafficLightPosition": { "x": 12.0, "y": 18.0 } | |
Collapse file Copy file name to clipboardExpand all lines: packages/desktop/src/index.tsx +1-5Lines changed: 1 addition & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // @refresh reload | | 2 | +import "./webview-zoom" | 2 | 3 | import { render } from "solid-js/web" | 3 | 4 | import { AppBaseProviders, AppInterface, PlatformProvider, Platform } from "@opencode-ai/app" | 4 | 5 | import { open, save } from "@tauri-apps/plugin-dialog" | @@ -303,11 +304,6 @@ const createPlatform = (password: Accessor<string | null>): Platform => ({ | 303 | 304 |
| 304 | 305 | createMenu() | 305 | 306 |
| 306 | | -// Stops mousewheel events from reaching Tauri's pinch-to-zoom handler | 307 | | -root?.addEventListener("mousewheel", (e) => { | 308 | | - e.stopPropagation() | 309 | | -}) | 310 | | - | 311 | 307 | render(() => { | 312 | 308 | const [serverPassword, setServerPassword] = createSignal<string | null>(null) | 313 | 309 | const platform = createPlatform(() => serverPassword()) | |
Collapse file Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// Copyright 2019-2024 Tauri Programme within The Commons Conservancy | | 2 | +// SPDX-License-Identifier: Apache-2.0 | | 3 | +// SPDX-License-Identifier: MIT | | 4 | + | | 5 | +import { invoke } from "@tauri-apps/api/core" | | 6 | +import { type as ostype } from "@tauri-apps/plugin-os" | | 7 | + | | 8 | +const OS_NAME = ostype() | | 9 | + | | 10 | +let zoomLevel = 1 | | 11 | + | | 12 | +const MAX_ZOOM_LEVEL = 10 | | 13 | +const MIN_ZOOM_LEVEL = 0.2 | | 14 | + | | 15 | +window.addEventListener("keydown", (event) => { | | 16 | + if (OS_NAME === "macos" ? event.metaKey : event.ctrlKey) { | | 17 | + if (event.key === "-") { | | 18 | + zoomLevel -= 0.2 | | 19 | + } else if (event.key === "=" || event.key === "+") { | | 20 | + zoomLevel += 0.2 | | 21 | + } else if (event.key === "0") { | | 22 | + zoomLevel = 1 | | 23 | + } else { | | 24 | + return | | 25 | + } | | 26 | + zoomLevel = Math.min(Math.max(zoomLevel, MIN_ZOOM_LEVEL), MAX_ZOOM_LEVEL) | | 27 | + invoke("plugin:webview|set_webview_zoom", { | | 28 | + value: zoomLevel, | | 29 | + }) | | 30 | + } | | 31 | +}) |
|