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
+8 -6
View File
@@ -36,13 +36,15 @@
win.onResized(async () => {
if (enforcing) return
await updateSize()
await syncRatio()
if (lockedRatio === null) return
// Enforce ratio on every resize frame - no debounce
enforcing = true
try { await invoke("enforce_overlay_aspect") } catch {}
await updateSize()
enforcing = false
// Small debounce to break the SetWindowPos → onResized loop
if (resizeDebounce !== null) clearTimeout(resizeDebounce)
resizeDebounce = window.setTimeout(async () => {
enforcing = true
try { await invoke("enforce_overlay_aspect") } catch {}
await updateSize()
enforcing = false
}, 30)
}).then(fn => cleanup.push(fn))
listen<{ phase: "idle"|"recording"|"paused"; fps: number }>(