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:
+2
-2
@@ -69,7 +69,7 @@
|
||||
let previewDims = $derived.by(() => {
|
||||
if (!clip) return ""
|
||||
if (format === "gif") {
|
||||
const bpf = 0.5
|
||||
const bpf = 0.2
|
||||
const requestedFps = fps
|
||||
const aspect = clip.height === 0 ? 16 / 9 : clip.width / clip.height
|
||||
|
||||
@@ -439,9 +439,9 @@
|
||||
<div class="preset-row">
|
||||
{#each PRESETS as [w, h, label]}
|
||||
<button class="chip" onclick={() => {
|
||||
api.setOverlaySize(w, h)
|
||||
aspectLock = w / h
|
||||
emit("overlay-aspect-lock", { ratio: aspectLock })
|
||||
api.setOverlaySize(w, h)
|
||||
}}>{label}</button>
|
||||
{/each}
|
||||
{#if aspectLock !== null}
|
||||
|
||||
+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