diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-26 13:13:27 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-26 13:13:27 +0200 |
| commit | 14475dc9a692aeffa8ef3caccecc1d3164ce4cfc (patch) | |
| tree | c3688bc5b2eeef45a5ce67bca4be8a636b987ec2 /apps/web/src/stores | |
| parent | f149ab3b6cad8ba3af370d86f9f2bcd4d77b1870 (diff) | |
| download | opencut-14475dc9a692aeffa8ef3caccecc1d3164ce4cfc.tar.gz | |
fix: prevent resizing elements on the timeline further than the timeline start
Diffstat (limited to 'apps/web/src/stores')
| -rw-r--r-- | apps/web/src/stores/timeline-store.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts index 6f9dfbd6..9e3f56d6 100644 --- a/apps/web/src/stores/timeline-store.ts +++ b/apps/web/src/stores/timeline-store.ts @@ -754,13 +754,16 @@ export const useTimelineStore = create<TimelineStore>((set, get) => { pushHistory = true ) => { if (pushHistory) get().pushHistory(); + const clampedStartTime = Math.max(0, startTime); updateTracksAndSave( get()._tracks.map((track) => track.id === trackId ? { ...track, elements: track.elements.map((element) => - element.id === elementId ? { ...element, startTime } : element + element.id === elementId + ? { ...element, startTime: clampedStartTime } + : element ), } : track @@ -799,8 +802,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => { const updatedElements = currentTrack.elements.map((currentElement) => { if (currentElement.id === elementId && currentTrack.id === trackId) { - // Update the moved element - return { ...currentElement, startTime: newStartTime }; + return { ...currentElement, startTime: Math.max(0, newStartTime) }; } // Only apply ripple effects if we should process this track |
