fix: ensure selecting an already selected clip doesn't deselect it

This commit is contained in:
Maze Winther
2025-07-04 00:37:59 +02:00
parent 8be05901fb
commit 9dbfa980c2

View File

@ -212,18 +212,16 @@ export function TimelineTrackContent({
return; return;
} }
// Handle single selection/deselection // Handle single selection
const isSelected = selectedClips.some( const isSelected = selectedClips.some(
(c) => c.trackId === track.id && c.clipId === clip.id (c) => c.trackId === track.id && c.clipId === clip.id
); );
if (isSelected) { if (!isSelected) {
// If clip is selected, deselect it
deselectClip(track.id, clip.id);
} else {
// If clip is not selected, select it (replacing other selections) // If clip is not selected, select it (replacing other selections)
selectClip(track.id, clip.id, false); selectClip(track.id, clip.id, false);
} }
// If clip is already selected, keep it selected (do nothing)
}; };
const handleTrackDragOver = (e: React.DragEvent) => { const handleTrackDragOver = (e: React.DragEvent) => {