@@ -29,7 +29,6 @@ import {
2929import { useTimelineKeyframeHandlers } from "./useTimelineKeyframeHandlers" ;
3030import { useTrackGapMenu } from "./useTrackGapMenu" ;
3131import { useTimelineGapHighlights } from "./useTimelineGapHighlights" ;
32- import { useStudioPlaybackContextOptional } from "../../contexts/StudioContext" ;
3332import { TimelineRazorGuide , useTimelineRazorInteraction } from "./TimelineRazorInteraction" ;
3433import { useTimelinePerformanceTelemetry } from "./useTimelinePerformanceTelemetry" ;
3534import {
@@ -45,6 +44,7 @@ import { getTimelineElementIdentity } from "../lib/timelineElementHelpers";
4544import { useTimelineRowVirtualization } from "./useTimelineRowVirtualization" ;
4645import { useTimelineClipRenderWindow } from "./useTimelineClipRenderWindow" ;
4746import { useTimelineActiveClips } from "./useTimelineActiveClips" ;
47+ import { useTimelineLaneMoveRefresh } from "./useTimelineLaneMoveRefresh" ;
4848
4949export {
5050 shouldAutoScrollTimeline ,
@@ -106,11 +106,7 @@ export const Timeline = memo(function Timeline({
106106 onSplitElement : onSplitElementOverride ,
107107 } ) ;
108108 const theme = useMemo ( ( ) => ( { ...defaultTimelineTheme , ...themeOverrides } ) , [ themeOverrides ] ) ;
109- const playbackContext = useStudioPlaybackContextOptional ( ) ;
110- const setRefreshKey = playbackContext ?. setRefreshKey ;
111- const refreshAfterLaneMove = useCallback ( ( ) => {
112- setRefreshKey ?.( ( key ) => key + 1 ) ;
113- } , [ setRefreshKey ] ) ;
109+ const refreshAfterLaneMove = useTimelineLaneMoveRefresh ( ) ;
114110 useMusicBeatAnalysis ( ) ;
115111 const rawElements = usePlayerStore ( ( s ) => s . elements ) ;
116112 const expandedElements = useExpandedTimelineElements ( ) ;
@@ -129,14 +125,8 @@ export const Timeline = memo(function Timeline({
129125 const clipRevealRequest = usePlayerStore ( ( s ) => s . clipRevealRequest ) ;
130126 const focusedEaseSegment = usePlayerStore ( ( s ) => s . focusedEaseSegment ) ;
131127 const gsapAnimations = usePlayerStore ( ( s ) => s . gsapAnimations ) ;
132- const hasKeyframedClips = useMemo (
133- ( ) => hasKeyframedTimelineClips ( gsapAnimations ) ,
134- [ gsapAnimations ] ,
135- ) ;
136- const labelMode = hasKeyframedClips ;
137- // Without the label column the pre-t=0 breathing room is still TRACKS_LEFT_PAD
138- // (dropping it would jam clip 0 against the gutter on every non-keyframed
139- // composition); in label mode the 232px label column already provides it.
128+ const labelMode = useMemo ( ( ) => hasKeyframedTimelineClips ( gsapAnimations ) , [ gsapAnimations ] ) ;
129+ // The label column provides pre-t=0 space; otherwise keep TRACKS_LEFT_PAD after the gutter.
140130 const contentOrigin = labelMode ? LABEL_COL_W + GUTTER : GUTTER + TRACKS_LEFT_PAD ;
141131 const contentGutter = labelMode ? GUTTER : 0 ;
142132 const setSelectedElementId = usePlayerStore ( ( s ) => s . setSelectedElementId ) ;
@@ -236,7 +226,6 @@ export const Timeline = memo(function Timeline({
236226 setResizingClip,
237227 blockedClipRef,
238228 suppressClickRef,
239- syncClipDragAutoScroll,
240229 } = useTimelineClipDrag ( {
241230 scrollRef,
242231 ppsRef,
@@ -253,6 +242,7 @@ export const Timeline = memo(function Timeline({
253242 readZIndex : zSyncEnabled ? readClipZIndex : undefined ,
254243 onStackingPatches : zSyncEnabled ? applyStackingPatches : undefined ,
255244 refreshAfterLaneMove,
245+ sessionEpoch,
256246 } ) ;
257247
258248 const { isDragOver, handleAssetDragOver, handleAssetDrop, clearDropPreview } =
@@ -269,6 +259,9 @@ export const Timeline = memo(function Timeline({
269259 onCompositionDrop : pinnedOnCompositionDrop ,
270260 } ) ;
271261 const displayLayout = useTimelineDisplayLayout ( draggedClip , trackOrder , rowGeometry ) ;
262+ const resizingElementIds =
263+ resizingClip ?. groupPreview ?. map ( ( change ) => change . key ) ??
264+ ( resizingClip ? [ getTimelineElementIdentity ( resizingClip . element ) ] : undefined ) ;
272265 const { recordTimelineScroll } = useTimelinePerformanceTelemetry ( {
273266 totalClipCount : expandedElements . length ,
274267 totalRowCount : displayLayout . displayTrackOrder . length ,
@@ -289,7 +282,7 @@ export const Timeline = memo(function Timeline({
289282 selectedElementId,
290283 revealElementId : clipRevealRequest ?. elementId ?? null ,
291284 draggedRowKey : draggedClip ?. started ? draggedClip . previewTrack : undefined ,
292- resizingRowKey : resizingClip ?. element . track ,
285+ resizingElementIds ,
293286 clipContextMenuRowKey : clipContextMenu ?. element . track ,
294287 keyframeContextMenuRowKey : kfContextMenu ?. element . track ,
295288 lastScrollLeftRef,
@@ -332,7 +325,7 @@ export const Timeline = memo(function Timeline({
332325 duration : displayDuration ,
333326 selectedElementId : selectedElementId ?? undefined ,
334327 draggedElementId : draggedClip ? getTimelineElementIdentity ( draggedClip . element ) : undefined ,
335- resizingElementId : resizingClip ? getTimelineElementIdentity ( resizingClip . element ) : undefined ,
328+ resizingElementIds ,
336329 revealElementId : clipRevealRequest ?. elementId ,
337330 focusedEaseElementId : focusedEaseSegment ?. elementId ,
338331 clipContextMenuElementId : clipContextMenu
@@ -468,6 +461,7 @@ export const Timeline = memo(function Timeline({
468461 >
469462 < div
470463 ref = { setScrollRef }
464+ // Stable owner for gestures that must survive virtual row/clip unmounts.
471465 data-timeline-scroll-viewport
472466 data-timeline-auto-scroll-left-inset = { labelMode ? LABEL_COL_W : 0 }
473467 tabIndex = { - 1 }
@@ -541,7 +535,6 @@ export const Timeline = memo(function Timeline({
541535 setResizingClip = { setResizingClip }
542536 setDraggedClip = { setDraggedClip }
543537 setSelectedElementId = { setSelectedElementId }
544- syncClipDragAutoScroll = { syncClipDragAutoScroll }
545538 shiftClickClipRef = { shiftClickClipRef }
546539 getPreviewElement = { getPreviewElement }
547540 getTrackStyle = { getTrackStyle }
0 commit comments