diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 9abb522..9dec5bb 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -49,6 +49,7 @@ export function Timeline() { const [zoomLevel, setZoomLevel] = useState(1); const dragCounterRef = useRef(0); const timelineRef = useRef(null); + const [isInTimeline, setIsInTimeline] = useState(false); // Unified context menu state const [contextMenu, setContextMenu] = useState<{ @@ -477,10 +478,30 @@ export function Timeline() { toast.success("Deleted selected clip(s)"); }; + + // Prevent explorer zooming in/out when in timeline + useEffect(() => { + const preventZoom = (e: WheelEvent) => { + // if (isInTimeline && (e.ctrlKey || e.metaKey)) { + if (isInTimeline && (e.ctrlKey || e.metaKey) && timelineRef.current?.contains(e.target as Node)) { + e.preventDefault(); + } + }; + + document.addEventListener('wheel', preventZoom, { passive: false }); + + return () => { + document.removeEventListener('wheel', preventZoom); + }; + }, [isInTimeline]); + return (
setIsInTimeline(true)} + onMouseLeave={() => setIsInTimeline(false)} + onWheel={handleWheel} > {/* Show overlay when dragging media over the timeline */} {isDragOver && ( @@ -758,25 +779,35 @@ export function Timeline() {
{ + e.preventDefault(); + setContextMenu({ + type: 'track', + trackId: track.id, + x: e.clientX, + y: e.clientY, + }); + }} > -
+
- + {track.name} - {track.muted && ( - - Muted - - )}
+ {track.muted && ( + + Muted + + )}
))}
@@ -795,7 +826,6 @@ export function Timeline() { }} onClick={handleTimelineAreaClick} onMouseDown={handleTimelineMouseDown} - onWheel={handleWheel} > {tracks.length === 0 ? (