summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/commands/timeline/element/move-elements.ts
diff options
context:
space:
mode:
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;