From 9b5fd6eb077a3fb2380f42414b65405030a01fcd Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 8 Feb 2026 01:51:25 +0100 Subject: feat: ensure elements on main track starts at 0 --- apps/web/src/lib/commands/timeline/element/move-elements.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'apps/web/src/lib/commands/timeline/element/move-elements.ts') diff --git a/apps/web/src/lib/commands/timeline/element/move-elements.ts b/apps/web/src/lib/commands/timeline/element/move-elements.ts index 2d4f9236..2fe06694 100644 --- a/apps/web/src/lib/commands/timeline/element/move-elements.ts +++ b/apps/web/src/lib/commands/timeline/element/move-elements.ts @@ -9,6 +9,7 @@ import { buildEmptyTrack, isMainTrack, validateElementTrackCompatibility, + enforceMainTrackStart, } from "@/lib/timeline/track-utils"; export class MoveElementCommand extends Command { @@ -66,9 +67,16 @@ export class MoveElementCommand extends Command { return; } + const adjustedStartTime = enforceMainTrackStart({ + tracks: tracksToUpdate, + targetTrackId: this.targetTrackId, + requestedStartTime: this.newStartTime, + excludeElementId: this.elementId, + }); + const movedElement: TimelineElement = { ...element, - startTime: this.newStartTime, + startTime: adjustedStartTime, }; const isSameTrack = this.sourceTrackId === this.targetTrackId; -- cgit v1.3.1