Files
yaak-mountain-loop/src-web/hooks/useZoom.ts
Gregory Schier 5919fae739 Run oxfmt across repo, add format script and ignore config
Format all non-generated files with oxfmt via `vp fmt`. Add
.oxfmtignore to skip bindings/ and wasm-pack output. Add npm
format script and update DEVELOPMENT.md docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 09:52:11 -07:00

28 lines
781 B
TypeScript

import { patchModel, settingsAtom } from "@yaakapp-internal/models";
import { useAtomValue } from "jotai";
import { useCallback } from "react";
export function useZoom() {
const settings = useAtomValue(settingsAtom);
const zoomIn = useCallback(async () => {
if (!settings) return;
await patchModel(settings, {
interfaceScale: Math.min(1.8, settings.interfaceScale * 1.1),
});
}, [settings]);
const zoomOut = useCallback(async () => {
if (!settings) return;
await patchModel(settings, {
interfaceScale: Math.max(0.4, settings.interfaceScale * 0.9),
});
}, [settings]);
const zoomReset = useCallback(async () => {
await patchModel(settings, { interfaceScale: 1 });
}, [settings]);
return { zoomIn, zoomOut, zoomReset };
}