aspect ratio enforcement now waits until after resize drag stops (350ms debounce), re-syncs ratio from Rust on each resize
This commit is contained in:
+10
-3
@@ -16,6 +16,7 @@
|
||||
let lockedRatio: number | null = null
|
||||
let resizeDebounce: number | null = null
|
||||
let enforcing = false
|
||||
let resizing = false
|
||||
|
||||
onMount(() => {
|
||||
const updateSize = async () => {
|
||||
@@ -35,14 +36,20 @@
|
||||
win.onResized(async () => {
|
||||
if (enforcing) return
|
||||
await updateSize()
|
||||
// Let Rust handle ratio enforcement via Win32 API
|
||||
enforcing = true
|
||||
// Re-sync ratio from Rust in case it changed
|
||||
await syncRatio()
|
||||
if (lockedRatio === null) return
|
||||
// Only enforce AFTER the user stops dragging.
|
||||
// Reset debounce on every resize event - enforcement fires only when
|
||||
// resize events stop coming (user released mouse).
|
||||
resizing = true
|
||||
if (resizeDebounce !== null) clearTimeout(resizeDebounce)
|
||||
resizeDebounce = window.setTimeout(async () => {
|
||||
resizing = false
|
||||
try { await invoke("enforce_overlay_aspect") } catch {}
|
||||
await updateSize()
|
||||
enforcing = false
|
||||
}, 80)
|
||||
}, 350)
|
||||
}).then(fn => cleanup.push(fn))
|
||||
|
||||
listen<{ phase: "idle"|"recording"|"paused"; fps: number }>(
|
||||
|
||||
Reference in New Issue
Block a user