fix aspect ratio lock (send event before resize, enforce on lock), fix gif size estimate (0.5 -> 0.2 bytes/pixel for screen content)

This commit is contained in:
2026-05-27 21:12:00 +03:00
parent f15d984532
commit 3a631c0c24
3 changed files with 20 additions and 4 deletions
+14 -1
View File
@@ -44,8 +44,21 @@
}, 150)
}).then(fn => cleanup.push(fn))
listen<{ ratio: number | null }>("overlay-aspect-lock", (e) => {
listen<{ ratio: number | null }>("overlay-aspect-lock", async (e) => {
lockedRatio = e.payload.ratio
if (lockedRatio !== null) {
// Enforce ratio on current size immediately
await updateSize()
const targetH = Math.round(width / lockedRatio)
const minH = 90
const clampedH = Math.max(minH, targetH)
if (Math.abs(clampedH - height) > 1) {
try {
await win.setSize({ type: "Logical", width, height: clampedH })
await updateSize()
} catch {}
}
}
}).then(fn => cleanup.push(fn))
listen<{ phase: "idle"|"recording"|"paused"; fps: number }>(