mirror of
https://github.com/anomalyco/opencode.git
synced 2026-06-01 19:05:38 +00:00
fix(desktop): limit zoom handler to zoom keys (#25516)
This commit is contained in:
@@ -26,13 +26,20 @@ const applyZoom = (next: number) => {
|
|||||||
window.addEventListener("keydown", (event) => {
|
window.addEventListener("keydown", (event) => {
|
||||||
if (!(OS_NAME === "macos" ? event.metaKey : event.ctrlKey)) return
|
if (!(OS_NAME === "macos" ? event.metaKey : event.ctrlKey)) return
|
||||||
|
|
||||||
let newZoom = webviewZoom()
|
if (event.key === "-") {
|
||||||
|
event.preventDefault()
|
||||||
if (event.key === "-") newZoom -= 0.2
|
applyZoom(clamp(webviewZoom() - 0.2))
|
||||||
if (event.key === "=" || event.key === "+") newZoom += 0.2
|
return
|
||||||
if (event.key === "0") newZoom = 1
|
}
|
||||||
|
if (event.key === "=" || event.key === "+") {
|
||||||
applyZoom(clamp(newZoom))
|
event.preventDefault()
|
||||||
|
applyZoom(clamp(webviewZoom() + 0.2))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (event.key === "0") {
|
||||||
|
event.preventDefault()
|
||||||
|
applyZoom(1)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export { webviewZoom }
|
export { webviewZoom }
|
||||||
|
|||||||
Reference in New Issue
Block a user