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:
+14
-1
@@ -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 }>(
|
||||
|
||||
Reference in New Issue
Block a user