feat: ensure elements on main track starts at 0

This commit is contained in:
Maze Winther
2026-02-08 01:51:25 +01:00
parent 00cf7f6ab7
commit 9b5fd6eb07
6 changed files with 160 additions and 11 deletions
@@ -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;