summaryrefslogtreecommitdiff
path: root/apps/web/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src')
-rw-r--r--apps/web/src/components/editor/timeline.tsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx
index b9e78839..7e2089a7 100644
--- a/apps/web/src/components/editor/timeline.tsx
+++ b/apps/web/src/components/editor/timeline.tsx
@@ -1251,6 +1251,8 @@ function TimelineTrackContent({
setResizing(null);
};
+ const [justFinishedDrag, setJustFinishedDrag] = useState(false);
+
const handleClipMouseDown = (e: React.MouseEvent, clip: any) => {
// Calculate the offset from the left edge of the clip to where the user clicked
const clipElement = e.currentTarget.parentElement as HTMLElement;
@@ -1261,6 +1263,16 @@ function TimelineTrackContent({
startDrag(e, clip.id, track.id, clip.startTime, clickOffsetTime);
};
+ // Reset drag flag when drag ends
+ useEffect(() => {
+ if (!isDragging && justFinishedDrag) {
+ const timer = setTimeout(() => setJustFinishedDrag(false), 50);
+ return () => clearTimeout(timer);
+ } else if (isDragging && !justFinishedDrag) {
+ setJustFinishedDrag(true);
+ }
+ }, [isDragging, justFinishedDrag]);
+
const handleTrackDragOver = (e: React.DragEvent) => {
e.preventDefault();
@@ -1766,6 +1778,11 @@ function TimelineTrackContent({
onClick={(e) => {
e.stopPropagation();
+ // Don't handle click if we just finished dragging
+ if (justFinishedDrag) {
+ return;
+ }
+
// Close context menu if it's open
if (contextMenu) {
setContextMenu(null);