summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/commands/timeline/element/move-elements.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-02-08 01:51:25 +0100
committerMaze Winther <mazewinther@gmail.com>2026-02-08 01:51:25 +0100
commit9b5fd6eb077a3fb2380f42414b65405030a01fcd (patch)
tree91d56e1c71e9a876afb1ae39fe4644ed8d5accee /apps/web/src/lib/commands/timeline/element/move-elements.ts
parent00cf7f6ab7b35616290cfeab06256a14f6d4beba (diff)
downloadopencut-9b5fd6eb077a3fb2380f42414b65405030a01fcd.tar.gz
feat: ensure elements on main track starts at 0
Diffstat (limited to 'apps/web/src/lib/commands/timeline/element/move-elements.ts')
-rw-r--r--apps/web/src/lib/commands/timeline/element/move-elements.ts10
1 files changed, 9 insertions, 1 deletions
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;