mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
Arrow keys move the selected canvas element(s) by 1 composition px, Shift by 10 — the top-ranked gap vs CapCut-class editors. The nudge reuses the manual-offset drag machinery end to end: the same drag-member snapshot, the same GSAP/CSS preview channel per keypress, and the same path-offset commit a drag drop uses, so persistence and undo behave identically to a tiny drag. A key-repeat burst commits once (400ms debounce after the last arrow, flushed on selection change / pointerdown / unmount) = one undo entry per burst. Guards: no text-input/contentEditable focus, no pointer gesture in flight, every target must support manual offset, plain/Shift arrows only. Caption editing is safe by construction (CaptionOverlay and DomEditOverlay mount mutually exclusively). While a nudgeable selection exists, ArrowLeft/Right frame-stepping yields via a claim gate (both listen on window capture with mount-order-dependent priority, so defaultPrevented can't arbitrate) — deliberate behavior change: arrows nudge when an element is selected, frame-step otherwise.