The open-source CapCut alternative
feat: select clip when being dragged, even if it wasn't selected
Maze Wintheree973cad2144
diff --git a/apps/web/src/components/editor/timeline-track.tsx b/apps/web/src/components/editor/timeline-track.tsxindex 0dd1ca1b..4ba22164 100644--- a/apps/web/src/components/editor/timeline-track.tsx+++ b/apps/web/src/components/editor/timeline-track.tsx@@ -58,6 +58,19 @@ export function TimelineTrackContent({const handleMouseMove = (e: MouseEvent) => {if (!timelineRef.current) return;+ // On first mouse move during drag, ensure the clip is selected+ if (dragState.clipId && dragState.trackId) {+ const isSelected = selectedClips.some(+ (c) =>+ c.trackId === dragState.trackId && c.clipId === dragState.clipId+ );++ if (!isSelected) {+ // Select this clip (replacing other selections) since we're dragging it+ selectClip(dragState.trackId, dragState.clipId, false);+ }+ }+const timelineRect = timelineRef.current.getBoundingClientRect();const mouseX = e.clientX - timelineRect.left;const mouseTime = Math.max(0, mouseX / (50 * zoomLevel));@@ -139,6 +152,7 @@ export function TimelineTrackContent({const handleClipMouseDown = (e: React.MouseEvent, clip: TypeTimelineClip) => {setMouseDownLocation({ x: e.clientX, y: e.clientY });+// Handle multi-selection only in mousedownif (e.metaKey || e.ctrlKey || e.shiftKey) {selectClip(track.id, clip.id, true);