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 lockedRatio: number | null = null
|
||||||
let resizeDebounce: number | null = null
|
let resizeDebounce: number | null = null
|
||||||
let enforcing = false
|
let enforcing = false
|
||||||
|
let resizing = false
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const updateSize = async () => {
|
const updateSize = async () => {
|
||||||
@@ -35,14 +36,20 @@
|
|||||||
win.onResized(async () => {
|
win.onResized(async () => {
|
||||||
if (enforcing) return
|
if (enforcing) return
|
||||||
await updateSize()
|
await updateSize()
|
||||||
// Let Rust handle ratio enforcement via Win32 API
|
// Re-sync ratio from Rust in case it changed
|
||||||
enforcing = true
|
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)
|
if (resizeDebounce !== null) clearTimeout(resizeDebounce)
|
||||||
resizeDebounce = window.setTimeout(async () => {
|
resizeDebounce = window.setTimeout(async () => {
|
||||||
|
resizing = false
|
||||||
try { await invoke("enforce_overlay_aspect") } catch {}
|
try { await invoke("enforce_overlay_aspect") } catch {}
|
||||||
await updateSize()
|
await updateSize()
|
||||||
enforcing = false
|
enforcing = false
|
||||||
}, 80)
|
}, 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