mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-28 18:19:28 +00:00
feat(desktop): default UI zoom to Appearance 90% preset
Land on the exact 90% scale so the settings control shows a selection on fresh installs, instead of five Ctrl+- steps (~91%) between presets.
This commit is contained in:
parent
9ad400580c
commit
4a9754b3c3
5 changed files with 17 additions and 17 deletions
|
|
@ -121,10 +121,10 @@ export function createSandbox(prefix: string): Sandbox {
|
|||
)
|
||||
|
||||
// Pin Chromium actual-size zoom (level 0) for the suite. Fresh installs
|
||||
// ship DEFAULT_ZOOM_LEVEL ≈ -0.5 (~91%), but Playwright click hit-testing
|
||||
// and the committed visual baselines were calibrated at 100%. Without this
|
||||
// file every sandbox would inherit the product default and fail pointer
|
||||
// interception + snapshot diffs.
|
||||
// ship DEFAULT_ZOOM_LEVEL at the Appearance 90% preset, but Playwright
|
||||
// click hit-testing and the committed visual baselines were calibrated at
|
||||
// 100%. Without this file every sandbox would inherit the product default
|
||||
// and fail pointer interception + snapshot diffs.
|
||||
fs.writeFileSync(
|
||||
path.join(userDataDir, 'zoom-state.json'),
|
||||
JSON.stringify({ zoomLevel: 0 }, null, 2),
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ test('storage key stays stable so persisted zoom survives upgrades', () => {
|
|||
assert.equal(ZOOM_STORAGE_KEY, 'hermes:desktop:zoomLevel')
|
||||
})
|
||||
|
||||
test('default zoom is five Ctrl/Cmd+- steps out from Chromium 0', () => {
|
||||
test('default zoom matches the Appearance 90% preset', () => {
|
||||
assert.equal(ZOOM_STEP, 0.1)
|
||||
assert.equal(DEFAULT_ZOOM_LEVEL, -0.5)
|
||||
assert.equal(zoomLevelToPercent(DEFAULT_ZOOM_LEVEL), 91)
|
||||
assert.equal(zoomLevelToPercent(DEFAULT_ZOOM_LEVEL), 90)
|
||||
assert.equal(DEFAULT_ZOOM_LEVEL, percentToZoomLevel(90))
|
||||
})
|
||||
|
||||
test('clampZoomLevel rejects garbage and enforces bounds', () => {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* Chromium actual-size baseline); Chromium's internal unit is the zoom level,
|
||||
* where factor = 1.2 ^ level.
|
||||
*
|
||||
* Our shipped default is five Ctrl/Cmd+- steps out from Chromium 0 — a slightly
|
||||
* tighter UI that still lands near the 90% Appearance preset.
|
||||
* Our shipped default is the Appearance 90% preset — tight enough to feel
|
||||
* denser than Chromium 100%, and selected in the UI Scale control on first run.
|
||||
*/
|
||||
|
||||
export const ZOOM_STORAGE_KEY = 'hermes:desktop:zoomLevel'
|
||||
|
|
@ -18,8 +18,8 @@ const MAX_ZOOM_LEVEL = 9
|
|||
/** Half Chromium's default step; matching the shortcuts and View menu. */
|
||||
export const ZOOM_STEP = 0.1
|
||||
|
||||
/** Five Ctrl/Cmd+- presses from Chromium 0 (~91%). Fresh installs + Actual Size. */
|
||||
export const DEFAULT_ZOOM_LEVEL = -5 * ZOOM_STEP
|
||||
/** Appearance 90% preset. Fresh installs + Actual Size / Ctrl+0. */
|
||||
export const DEFAULT_ZOOM_LEVEL = Math.log(0.9) / Math.log(ZOOM_FACTOR_BASE)
|
||||
|
||||
export function clampZoomLevel(value) {
|
||||
if (!Number.isFinite(value)) {
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ function ThemePreview({ name, mode }: { name: string; mode: 'light' | 'dark' })
|
|||
}
|
||||
|
||||
// UI scale presets, as zoom percentages. 100 is Chromium's actual-size
|
||||
// baseline; the shipped default is five Ctrl/Cmd+- steps out (~91%). Ids
|
||||
// double as the percent values sent to the main process. A Cmd/Ctrl +/-
|
||||
// step landing between presets highlights nothing, and the row description
|
||||
// keeps showing the exact current percent.
|
||||
// baseline; the shipped default is the 90% preset. Ids double as the percent
|
||||
// values sent to the main process. A Cmd/Ctrl +/- step landing between
|
||||
// presets highlights nothing, and the row description keeps showing the
|
||||
// exact current percent.
|
||||
const UI_SCALE_PRESETS = ['90', '100', '110', '125', '150', '175'] as const
|
||||
|
||||
type UiScalePreset = (typeof UI_SCALE_PRESETS)[number]
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
import { atom } from 'nanostores'
|
||||
|
||||
// Mirror DEFAULT_ZOOM_LEVEL (-0.5 ≈ 91%) so Appearance doesn't flash 100% before
|
||||
// Mirror DEFAULT_ZOOM_LEVEL (90%) so Appearance doesn't flash 100% before
|
||||
// the main-process zoom.get() resolves. Keep in sync with electron/zoom.ts.
|
||||
export const $zoomPercent = atom<number>(91)
|
||||
export const $zoomPercent = atom<number>(90)
|
||||
|
||||
export function setZoomPercent(percent: number): void {
|
||||
window.hermesDesktop?.zoom?.setPercent(percent)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue