diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-01 15:00:21 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-01 15:00:21 +0200 |
| commit | ee973cad21440d03bf9d0308eb8a313c92b3e7ef (patch) | |
| tree | 3a964335ecac48215e23c0094437e36cf4a98060 /apps/web/src/components | |
| parent | 9c8594d8f31aa99466cc00cd45b37a6f21099245 (diff) | |
| download | opencut-ee973cad21440d03bf9d0308eb8a313c92b3e7ef.tar.gz | |
feat: select clip when being dragged, even if it wasn't selected
Diffstat (limited to 'apps/web/src/components')
| -rw-r--r-- | apps/web/src/components/editor/timeline-track.tsx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/web/src/components/editor/timeline-track.tsx b/apps/web/src/components/editor/timeline-track.tsx index 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 mousedown
if (e.metaKey || e.ctrlKey || e.shiftKey) {
selectClip(track.id, clip.id, true);
|
