enforce aspect ratio on every resize frame, no debounce
This commit is contained in:
+5
-12
@@ -36,20 +36,13 @@
|
|||||||
win.onResized(async () => {
|
win.onResized(async () => {
|
||||||
if (enforcing) return
|
if (enforcing) return
|
||||||
await updateSize()
|
await updateSize()
|
||||||
// Re-sync ratio from Rust in case it changed
|
|
||||||
await syncRatio()
|
await syncRatio()
|
||||||
if (lockedRatio === null) return
|
if (lockedRatio === null) return
|
||||||
// Only enforce AFTER the user stops dragging.
|
// Enforce ratio on every resize frame - no debounce
|
||||||
// Reset debounce on every resize event - enforcement fires only when
|
enforcing = true
|
||||||
// resize events stop coming (user released mouse).
|
try { await invoke("enforce_overlay_aspect") } catch {}
|
||||||
resizing = true
|
await updateSize()
|
||||||
if (resizeDebounce !== null) clearTimeout(resizeDebounce)
|
enforcing = false
|
||||||
resizeDebounce = window.setTimeout(async () => {
|
|
||||||
resizing = false
|
|
||||||
try { await invoke("enforce_overlay_aspect") } catch {}
|
|
||||||
await updateSize()
|
|
||||||
enforcing = false
|
|
||||||
}, 350)
|
|
||||||
}).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