fix: ensure timeline clips can be extended to longer than 5s

This commit is contained in:
Maze Winther
2025-07-08 00:42:46 +02:00
parent c0cc4c009e
commit ea59cc3950
3 changed files with 92 additions and 6 deletions

View File

@ -87,6 +87,11 @@ interface TimelineStore {
trimStart: number,
trimEnd: number
) => void;
updateElementDuration: (
trackId: string,
elementId: string,
duration: number
) => void;
updateElementStartTime: (
trackId: string,
elementId: string,
@ -284,7 +289,9 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
removeTrack: (trackId) => {
get().pushHistory();
updateTracksAndSave(get()._tracks.filter((track) => track.id !== trackId));
updateTracksAndSave(
get()._tracks.filter((track) => track.id !== trackId)
);
},
addElementToTrack: (trackId, elementData) => {
@ -439,6 +446,22 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
);
},
updateElementDuration: (trackId, elementId, duration) => {
get().pushHistory();
updateTracksAndSave(
get()._tracks.map((track) =>
track.id === trackId
? {
...track,
elements: track.elements.map((element) =>
element.id === elementId ? { ...element, duration } : element
),
}
: track
)
);
},
updateElementStartTime: (trackId, elementId, startTime) => {
get().pushHistory();
updateTracksAndSave(