GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(desktop): completely disable pinch to zoom · prashanthpai/opencode@8b37932

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/desktop
    • src-tauri
      • tauri.conf.json
    • src
      • index.tsx
      • webview-zoom.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/desktop/src-tauri/tauri.conf.json‎

Copy file name to clipboardExpand all lines: packages/desktop/src-tauri/tauri.conf.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"url": "/",
2020
"decorations": true,
2121
"dragDropEnabled": false,
22-
"zoomHotkeysEnabled": true,
22+
"zoomHotkeysEnabled": false,
2323
"titleBarStyle": "Overlay",
2424
"hiddenTitle": true,
2525
"trafficLightPosition": { "x": 12.0, "y": 18.0 }
Collapse file

‎packages/desktop/src/index.tsx‎

Copy file name to clipboardExpand all lines: packages/desktop/src/index.tsx
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @refresh reload
2+
import "./webview-zoom"
23
import { render } from "solid-js/web"
34
import { AppBaseProviders, AppInterface, PlatformProvider, Platform } from "@opencode-ai/app"
45
import { open, save } from "@tauri-apps/plugin-dialog"
@@ -303,11 +304,6 @@ const createPlatform = (password: Accessor<string | null>): Platform => ({
303304

304305
createMenu()
305306

306-
// Stops mousewheel events from reaching Tauri's pinch-to-zoom handler
307-
root?.addEventListener("mousewheel", (e) => {
308-
e.stopPropagation()
309-
})
310-
311307
render(() => {
312308
const [serverPassword, setServerPassword] = createSignal<string | null>(null)
313309
const platform = createPlatform(() => serverPassword())
Collapse file

‎packages/desktop/src/webview-zoom.ts‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
})

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.