feat(studio): unify timeline vertical reorder with z-index stacking

Timeline rows now order by scoped stacking (z-index per stacking context)
instead of data-track-index, and dragging a clip up/down commits a targeted
z-index change through the same shared path the layers panel uses. Both panels
stay consistent and moving a clip actually changes front/back. data-track-index
is demoted to time-overlap layout only; no bulk z-index injection (#958 intact).

Also restores beat-snapping on keyframe retiming (re-wires snapKeyframePctToBeat,
orphaned when keyframe dragging was removed) which surfaced while unifying the
model. Extracts pure track-ordering logic to timelineTrackOrder.ts, the stacking
reorder commit + deleteSelectedKeyframes to timelineEditingHelpers.ts, to keep
StudioApp / the timeline hook / Timeline under the studio 600-LOC cap.

U3: scoped stacking row order in the timeline
U4: vertical drag commits z-index via the shared reorder commit
U8: restore keyframe beat-snap on retime
This commit is contained in:
Miguel Angel Simon Sierra
2026-07-08 23:46:24 -04:00
parent 070ee91694
commit dd980697a2
16 changed files with 1110 additions and 54 deletions
@@ -41,8 +41,7 @@ export function computeReorderZValues(
return hasDupes ? reordered.map((_, i) => reordered.length - i) : sorted;
}
// Exported in a later unit when the timeline consumes it; internal-only for now.
function resolveStackingContextKey(item: StackingContextDescriptor): string {
export function resolveStackingContextKey(item: StackingContextDescriptor): string {
return item.stackingContextId ?? item.parentCompositionId ?? item.compositionAncestors[0] ?? "";
}