30ms debounce on aspect ratio enforcement to break SetWindowPos resize loop
This commit is contained in:
@@ -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 }>(
|
||||||
|
|||||||
Reference in New Issue
Block a user