summaryrefslogtreecommitdiff
path: root/apps/web/src/stores/timeline-store.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-22 01:01:54 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-22 01:01:54 +0200
commitc783062121a4a31ec6ee20c4ca52fd47f4fbdab7 (patch)
treef7d2a8845b6139ef4e75e1a9ab6a6a29e1a3a8f3 /apps/web/src/stores/timeline-store.ts
parent550f5363fde76b9cbe2d6f06f55ff27be44223ee (diff)
downloadopencut-c783062121a4a31ec6ee20c4ca52fd47f4fbdab7.tar.gz
feat: ensure text tracks are always created above media tracks
Diffstat (limited to 'apps/web/src/stores/timeline-store.ts')
-rw-r--r--apps/web/src/stores/timeline-store.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index 01ad1635..20e80253 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -1317,8 +1317,9 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
findOrCreateTrack: (trackType) => {
// Always create new text track to allow multiple text elements
+ // Insert text tracks at the top
if (trackType === "text") {
- return get().addTrack(trackType);
+ return get().insertTrackAt(trackType, 0);
}
const existingTrack = get()._tracks.find((t) => t.type === trackType);
@@ -1356,7 +1357,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
},
addTextAtTime: (item, currentTime = 0) => {
- const targetTrackId = get().addTrack("text"); // Always create new text track to allow multiple text elements
+ const targetTrackId = get().insertTrackAt("text", 0); // Always create new text track at the top
get().addElementToTrack(targetTrackId, {
type: "text",
@@ -1399,7 +1400,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
},
addTextToNewTrack: (item) => {
- const targetTrackId = get().addTrack("text"); // Always create new text track to allow multiple text elements
+ const targetTrackId = get().insertTrackAt("text", 0); // Always create new text track at the top
get().addElementToTrack(targetTrackId, {
type: "text",