Files
orca/src/shared/ui-zoom-level.ts
Brennan Benson e09ed30a0b fix(dashboard-popout): zoom the pop-out window, not the main window behind it (#9769)
* fix(dashboard-popout): zoom the pop-out window, not the main window behind it

The View menu's zoom handlers always sent terminal:zoom to the main
window, so zooming while the dashboard pop-out was focused zoomed the
window behind it. The pop-out also never applied the persisted
uiZoomLevel, so it always rendered at 100% in a zoomed app.

The pop-out now applies uiZoomLevel on dom-ready and follows app-zoom
changes while open (main-window zoom, settings control, mobile ui.set).
Menu zoom routes to the pop-out when it is the focused window, stepping
its own webContents zoom, and a narrow before-input-event handler
resolves the zoom.in/out/reset chords (honoring keybinding overrides)
since the pop-out has no renderer-side shortcut plumbing. The step/clamp
constants move to shared/ui-zoom-level.ts so main and renderer share one
definition.

* fix(dashboard-popout): isolate window zoom

* fix(dashboard-popout): deny unused permissions

* docs(dashboard-popout): clarify wheel zoom path
2026-07-21 14:55:14 -07:00

16 lines
574 B
TypeScript

export const UI_ZOOM_STEP = 0.5
export const UI_ZOOM_MIN = -3
export const UI_ZOOM_MAX = 5
export type UIZoomDirection = 'in' | 'out' | 'reset'
/** Step an Electron zoom level one increment in the given direction, clamped
* to the app's supported range. 'reset' returns the 100% level. */
export function stepUIZoomLevel(current: number, direction: UIZoomDirection): number {
if (direction === 'reset') {
return 0
}
const next = direction === 'in' ? current + UI_ZOOM_STEP : current - UI_ZOOM_STEP
return Math.max(UI_ZOOM_MIN, Math.min(UI_ZOOM_MAX, next))
}