diff --git a/packages/studio/src/player/components/timelineDragDrop.ts b/packages/studio/src/player/components/timelineDragDrop.ts index 63182617f4..77574f3343 100644 --- a/packages/studio/src/player/components/timelineDragDrop.ts +++ b/packages/studio/src/player/components/timelineDragDrop.ts @@ -1,5 +1,6 @@ import { useCallback, useState, type RefObject } from "react"; import { TIMELINE_ASSET_MIME, TIMELINE_BLOCK_MIME } from "../../utils/timelineAssetDrop"; +import { usePlayerStore } from "../store/playerStore"; import { TRACK_H, resolveTimelineAssetDrop } from "./timelineLayout"; import type { TimelineDropCallbacks } from "./timelineCallbacks"; @@ -11,12 +12,12 @@ interface UseTimelineAssetDropOptions extends TimelineDropCallbacks { } /** - * Dropping an asset/file/block onto the timeline places it at the DROP - * POSITION — start comes from the drop x, track from the drop y. This is the - * industry-standard drag semantic (CapCut/Premiere/FCP: dragged media lands - * where you release it); playhead placement is reserved for button/shortcut - * adds (handleAddAssetAtPlayhead). External OS file drops and internal asset - * drops share this same placement path. + * Dropping an asset/file/block onto the timeline places it at the PLAYHEAD — + * start is the current playhead time, only the track comes from the drop y. + * Deliberate product choice (user preference, 2026-07-09): every add lands at + * the playhead regardless of drop x, like CapCut's add-to-timeline. External + * OS file drops and internal asset drops share this same placement path, so + * both land identically. */ export function useTimelineAssetDrop({ scrollRef, @@ -46,28 +47,23 @@ export function useTimelineAssetDrop({ (clientX: number, clientY: number): { start: number; track: number } => { const scroll = scrollRef.current; const rect = scroll?.getBoundingClientRect(); - const pps = ppsRef.current; - // Start comes from the drop x, track from the drop y. Allow dropping into - // the rendered empty space past the content end (same relaxed bound as a - // clip drag) — the composition grows to fit on commit, content-driven. - const maxDropTime = Math.max( - durationRef.current, - scroll && pps > 0 ? scroll.scrollWidth / pps : durationRef.current, - ); - return resolveTimelineAssetDrop( + // Track comes from the vertical drop position; start is the playhead. + const { track } = resolveTimelineAssetDrop( { rectLeft: rect?.left ?? 0, rectTop: rect?.top ?? 0, scrollLeft: scroll?.scrollLeft ?? 0, scrollTop: scroll?.scrollTop ?? 0, - pixelsPerSecond: pps, - duration: maxDropTime, + pixelsPerSecond: ppsRef.current, + duration: durationRef.current, trackHeight: TRACK_H, trackOrder: trackOrderRef.current, }, clientX, clientY, ); + const start = Math.max(0, usePlayerStore.getState().currentTime); + return { start, track }; }, [scrollRef, ppsRef, durationRef, trackOrderRef], );