Open History to see the last commit
1import type { PreviewViewportSetting } from "@t3tools/contracts";
2
3export function reconcileLockedAspectRatio(
4 current: number | null,
5 viewportAspectRatio: number | null,
6): number | null {
7 return current === null || viewportAspectRatio === null ? null : viewportAspectRatio;
8}
9
10export async function commitViewportAndAspectRatio(
11 setting: PreviewViewportSetting,
12 aspectRatio: number | null,
13 onChange: (setting: PreviewViewportSetting) => Promise<void>,
14 onAspectRatioChange: (aspectRatio: number | null) => void,
15): Promise<void> {
16 await onChange(setting);
17 onAspectRatioChange(aspectRatio);
18}