11import { memo } from "react" ;
2- import { TimelineRuler } from "./TimelineRuler " ;
2+ import { TimelineRulerPart } from "./TimelineRulerPart " ;
33import { PlayheadIndicator } from "./PlayheadIndicator" ;
44import {
55 RULER_H ,
@@ -12,12 +12,8 @@ import {
1212 getTimelineRowTop ,
1313 getTimelineRowHeight ,
1414} from "./timelineLayout" ;
15- import { type MultiDragPreviewInput } from "./timelineMultiDragPreview" ;
16- import { useTimelineEditContextOptional } from "../../contexts/TimelineEditContext" ;
1715import { TimelineLanes } from "./TimelineLanes" ;
18- import { getTimelineElementIdentity } from "../lib/timelineElementHelpers" ;
1916import { TimelineGestureOverlay } from "./TimelineGestureOverlay" ;
20- import { resolveSnapGuide } from "./timelineSnapping" ;
2117import { useTimelineContext } from "./TimelineProvider" ;
2218
2319// A dropped clip's length is unknown until it lands; the preview shows a default.
@@ -26,8 +22,7 @@ const DROP_PREVIEW_SECONDS = 3;
2622export const TimelineCanvas = memo ( function TimelineCanvas ( ) {
2723 const { state, actions } = useTimelineContext ( ) ;
2824 const props = state . canvas ;
29- const { draggedClip, resizingClip, scrollRef, selectedElementIds, displayTrackOrder } = props ;
30- const snapGuide = resolveSnapGuide ( draggedClip , resizingClip ) ;
25+ const { draggedClip, scrollRef, displayTrackOrder } = props ;
3126 const draggedRowIndex =
3227 draggedClip ?. started === true ? displayTrackOrder . indexOf ( draggedClip . previewTrack ) : - 1 ;
3328 const dropTrackIndex = props . dropPreview
@@ -43,55 +38,14 @@ export const TimelineCanvas = memo(function TimelineCanvas() {
4338 // ghost and drop placeholder must clamp to it or they stretch to the full
4439 // expanded row height and stop matching the clip being dragged.
4540 const draggedClipHeight = Math . min ( draggedRowHeight , TRACK_H ) - CLIP_Y * 2 ;
46- const {
47- onResizeElement,
48- onMoveElement,
49- onToggleTrackHidden,
50- onTogglePropertyGroupKeyframe,
51- onRazorSplit,
52- onRazorSplitAll,
53- } = useTimelineEditContextOptional ( ) ;
5441 const beatDragging = props . beatDragging ;
55- const draggedElement = draggedClip ?. element ?? null ;
56- const draggedElementIdentity = draggedElement ? getTimelineElementIdentity ( draggedElement ) : null ;
57- // The drag ghost follows the cursor freely (both axes) — CapCut-style. The
58- // "magnetic" affordance is a highlight on the destination lane (draggedRowIndex),
59- // which flips at the MAGNETIC_TRACK_THRESHOLD point; the clip drops into it.
60- // Live multi-selection drag: while a selected clip is dragged, ALL selected
61- // clips move together as one rigid formation. The GRABBED clip is the free
62- // ghost below; its co-selected "passengers" slide by the SAME group-clamped
63- // delta (cheap translateX, no re-layout) — the delta is derived from the
64- // grabbed clip's ALREADY-clamped previewStart, so the whole formation stops at
65- // the wall together and never deforms. Matches what the commit will do — see
66- // timelineMultiDragPreview + commit.
67- const multiDragPreview : MultiDragPreviewInput | null =
68- draggedClip ?. started === true && draggedElement && draggedElementIdentity
69- ? {
70- dragStarted : true ,
71- draggedKey : draggedElementIdentity ,
72- draggedOriginStart : draggedElement . start ,
73- draggedPreviewStart : draggedClip . previewStart ,
74- selectedKeys : selectedElementIds ,
75- }
76- : null ;
42+ const { draggedElement, snapGuide, multiDragPreview } = props ;
7743 return (
7844 < div
7945 className = "relative"
8046 style = { { height : props . totalH , width : props . contentOrigin + props . trackContentWidth } }
8147 >
82- < TimelineRuler
83- major = { props . major }
84- minor = { props . minor }
85- pps = { props . pps }
86- trackContentWidth = { props . trackContentWidth }
87- totalH = { props . totalH }
88- effectiveDuration = { props . effectiveDuration }
89- majorTickInterval = { props . majorTickInterval }
90- theme = { props . theme }
91- beatAnalysis = { props . beatAnalysis }
92- contentOrigin = { props . contentOrigin }
93- renderTimeRange = { props . rowsVirtualized ? props . renderTimeRange : undefined }
94- />
48+ < TimelineRulerPart />
9549
9650 { /* Breathing room between the sticky ruler and the first track lane — the
9751 top half of the CapCut-style padding (see TRACKS_TOP_PAD). */ }
@@ -104,12 +58,12 @@ export const TimelineCanvas = memo(function TimelineCanvas() {
10458 snapGuide = { snapGuide }
10559 draggedElement = { draggedElement }
10660 multiDragPreview = { multiDragPreview }
107- onToggleTrackHidden = { onToggleTrackHidden }
108- onTogglePropertyGroupKeyframe = { onTogglePropertyGroupKeyframe }
109- onResizeElement = { onResizeElement }
110- onMoveElement = { onMoveElement }
111- onRazorSplit = { onRazorSplit }
112- onRazorSplitAll = { onRazorSplitAll }
61+ onToggleTrackHidden = { props . onToggleTrackHidden }
62+ onTogglePropertyGroupKeyframe = { props . onTogglePropertyGroupKeyframe }
63+ onResizeElement = { props . onResizeElement }
64+ onMoveElement = { props . onMoveElement }
65+ onRazorSplit = { props . onRazorSplit }
66+ onRazorSplitAll = { props . onRazorSplitAll }
11367 />
11468
11569 { /* Breathing room below the last track lane (~1.5 track heights) — a real
0 commit comments