30ms debounce on aspect ratio enforcement to break SetWindowPos resize loop

This commit is contained in:
2026-05-29 16:23:11 +03:00
parent ec26ad274f
commit f1e5c5f3db
+4 -2
View File
@@ -36,13 +36,15 @@
win.onResized(async () => { win.onResized(async () => {
if (enforcing) return if (enforcing) return
await updateSize() await updateSize()
await syncRatio()
if (lockedRatio === null) return if (lockedRatio === null) return
// Enforce ratio on every resize frame - no debounce // Small debounce to break the SetWindowPos → onResized loop
if (resizeDebounce !== null) clearTimeout(resizeDebounce)
resizeDebounce = window.setTimeout(async () => {
enforcing = true enforcing = true
try { await invoke("enforce_overlay_aspect") } catch {} try { await invoke("enforce_overlay_aspect") } catch {}
await updateSize() await updateSize()
enforcing = false enforcing = false
}, 30)
}).then(fn => cleanup.push(fn)) }).then(fn => cleanup.push(fn))
listen<{ phase: "idle"|"recording"|"paused"; fps: number }>( listen<{ phase: "idle"|"recording"|"paused"; fps: number }>(