From 3540226af59481aa304dadc041071b74ba7dbcf5 Mon Sep 17 00:00:00 2001 From: Hyteq Date: Mon, 23 Jun 2025 14:14:06 +0300 Subject: [PATCH 1/3] fix: clips duplicating when moving them around --- apps/web/src/components/editor/timeline.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index f6d9fdde..50a64dbb 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -903,6 +903,7 @@ function TimelineTrackContent({ const handleTrackDrop = (e: React.DragEvent) => { e.preventDefault(); + e.stopPropagation(); // Reset all drag states dragCounterRef.current = 0; @@ -985,7 +986,6 @@ function TimelineTrackContent({ updateClipStartTime(track.id, clipId, snappedTime); } else { // Moving to different track - console.log('Moving clip from', fromTrackId, 'to', track.id); moveClipToTrack(fromTrackId, track.id, clipId); requestAnimationFrame(() => { updateClipStartTime(track.id, clipId, snappedTime); From c8e522a82f4e8c2e6f9eb90f22a28f947dc7fe41 Mon Sep 17 00:00:00 2001 From: Hyteq Date: Mon, 23 Jun 2025 14:19:56 +0300 Subject: [PATCH 2/3] fix: items duplicate instead of moving t racks --- apps/web/src/components/editor/timeline.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 50a64dbb..3823f096 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -64,7 +64,7 @@ export function Timeline() { const handleDragEnter = (e: React.DragEvent) => { // When something is dragged over the timeline, show overlay e.preventDefault(); - // Don't show overlay for timeline clips or other internal drags + // Don't show overlay for timeline clips - they're handled by tracks if (e.dataTransfer.types.includes("application/x-timeline-clip")) { return; } @@ -81,7 +81,7 @@ export function Timeline() { const handleDragLeave = (e: React.DragEvent) => { e.preventDefault(); - // Don't update state for timeline clips + // Don't update state for timeline clips - they're handled by tracks if (e.dataTransfer.types.includes("application/x-timeline-clip")) { return; } @@ -98,6 +98,12 @@ export function Timeline() { setIsDragOver(false); dragCounterRef.current = 0; + // Ignore timeline clip drags - they're handled by track-specific handlers + const hasTimelineClip = e.dataTransfer.types.includes("application/x-timeline-clip"); + if (hasTimelineClip) { + return; + } + const mediaItemData = e.dataTransfer.getData("application/x-media-item"); if (mediaItemData) { // Handle media item drops by creating new tracks From 7b6ab8f1520ee91ae3504c4594f96a05fce13e9f Mon Sep 17 00:00:00 2001 From: Hyteq Date: Mon, 23 Jun 2025 14:21:42 +0300 Subject: [PATCH 3/3] chore: cleanup --- apps/web/src/components/editor/timeline.tsx | 84 +-------------------- 1 file changed, 1 insertion(+), 83 deletions(-) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 3823f096..d1bb3aa8 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -20,12 +20,10 @@ import { TooltipTrigger, TooltipProvider, } from "../ui/tooltip"; -import { DragOverlay } from "../ui/drag-overlay"; import { useTimelineStore, type TimelineTrack } from "@/stores/timeline-store"; import { useMediaStore } from "@/stores/media-store"; import { usePlaybackStore } from "@/stores/playback-store"; import { processMediaFiles } from "@/lib/media-processing"; -import { ImageTimelineTreatment } from "@/components/ui/image-timeline-treatment"; import { toast } from "sonner"; import { useState, useRef, useEffect } from "react"; @@ -1301,87 +1299,7 @@ function TimelineTrackContent({ )} )} - - ); -} - -// Custom context menu for track actions -function TrackContextMenu({ - x, - y, - track, - onClose, - onSplit, - onMute, - onDelete, -}: { - x: number; - y: number; - track: any; - onClose: () => void; - onSplit: () => void; - onMute: () => void; - onDelete: () => void; -}) { - // Small, modern, visually appealing popup - return ( -
e.preventDefault()} - > - {/* Split option */} - - {/* Mute/Unmute option */} - - {/* Delete option */} - -
- ); -} - - - - - - - - - - - - - - - +} \ No newline at end of file