fix: deselect clips by clicking outside of track
This commit is contained in:
@ -188,6 +188,14 @@ export function Timeline() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add new click handler for deselection
|
||||||
|
const handleTimelineClick = (e: React.MouseEvent) => {
|
||||||
|
// If clicking empty area (not on a clip) and not starting marquee, deselect all clips
|
||||||
|
if (!(e.target as HTMLElement).closest(".timeline-clip")) {
|
||||||
|
clearSelectedClips();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Mouse move to update marquee
|
// Mouse move to update marquee
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!marquee || !marquee.active) return;
|
if (!marquee || !marquee.active) return;
|
||||||
@ -1068,7 +1076,7 @@ export function Timeline() {
|
|||||||
height: `${Math.max(200, Math.min(800, tracks.length * 60))}px`,
|
height: `${Math.max(200, Math.min(800, tracks.length * 60))}px`,
|
||||||
width: `${dynamicTimelineWidth}px`,
|
width: `${dynamicTimelineWidth}px`,
|
||||||
}}
|
}}
|
||||||
onClick={handleTimelineMouseDown}
|
onClick={handleTimelineClick}
|
||||||
onMouseDown={handleTimelineMouseDown}
|
onMouseDown={handleTimelineMouseDown}
|
||||||
>
|
>
|
||||||
{tracks.length === 0 ? (
|
{tracks.length === 0 ? (
|
||||||
|
Reference in New Issue
Block a user