The open-source CapCut alternative
fix: click empty on track to move playhead
Maze Winther9ca32e5e39d3
diff --git a/apps/web/src/components/editor/timeline/index.tsx b/apps/web/src/components/editor/timeline/index.tsxindex 7e2b2b66..271bad9b 100644--- a/apps/web/src/components/editor/timeline/index.tsx+++ b/apps/web/src/components/editor/timeline/index.tsx@@ -423,7 +423,11 @@ export function Timeline() {onResizeStateChange={handleResizeStateChange}onElementMouseDown={handleElementMouseDown}onElementClick={handleElementClick}- onTrackMouseDown={handleSelectionMouseDown}+ onTrackMouseDown={(event) => {+ handleSelectionMouseDown(event);+ handleTracksMouseDown(event);+ }}+ onTrackClick={handleTracksClick}shouldIgnoreClick={shouldIgnoreClick}/></div>diff --git a/apps/web/src/components/editor/timeline/timeline-track.tsx b/apps/web/src/components/editor/timeline/timeline-track.tsxindex 573bd4b5..47a9f282 100644--- a/apps/web/src/components/editor/timeline/timeline-track.tsx+++ b/apps/web/src/components/editor/timeline/timeline-track.tsx@@ -31,6 +31,7 @@ interface TimelineTrackContentProps {track: TimelineTrack;}) => void;onTrackMouseDown?: (event: React.MouseEvent) => void;+ onTrackClick?: (event: React.MouseEvent) => void;shouldIgnoreClick?: () => boolean;}@@ -46,6 +47,7 @@ export function TimelineTrackContent({onElementMouseDown,onElementClick,onTrackMouseDown,+ onTrackClick,shouldIgnoreClick,}: TimelineTrackContentProps) {const editor = useEditor();@@ -68,11 +70,13 @@ export function TimelineTrackContent({return (<buttonclassName={cn("size-full", hasSelectedElements && "bg-panel-accent/35")}- onClick={() => {+ onClick={(event) => {if (shouldIgnoreClick?.()) return;clearElementSelection();+ onTrackClick?.(event);}}onMouseDown={(event) => {+ event.preventDefault();onTrackMouseDown?.(event);}}type="button"