summaryrefslogtreecommitdiff
path: root/apps/web/src/stores
diff options
context:
space:
mode:
authorDevloperAmanSingh <amansinghneh211205@gmail.com>2025-06-26 23:46:43 +0530
committerDevloperAmanSingh <amansinghneh211205@gmail.com>2025-06-26 23:46:43 +0530
commita816cc503f692f43b966b6f166691a18fc3fe76f (patch)
treed0446153b0171a2026d3daa6bb5efc119e0e8c11 /apps/web/src/stores
parentf74bebeb8b95891a6e0ea0cfe6a67b786dc826de (diff)
downloadopencut-a816cc503f692f43b966b6f166691a18fc3fe76f.tar.gz
feat: add detailed comments for clip splitting and audio separation methods in timeline store
Diffstat (limited to 'apps/web/src/stores')
-rw-r--r--apps/web/src/stores/timeline-store.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index a6da4e25..f789548f 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -74,7 +74,7 @@ interface TimelineStore {
) => void;
toggleTrackMute: (trackId: string) => void;
- // Split operations
+ // Split operations for clips
splitClip: (
trackId: string,
clipId: string,
@@ -339,6 +339,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => ({
return secondClipId;
},
+ // Split clip and keep only the left portion
splitAndKeepLeft: (trackId, clipId, splitTime) => {
const { tracks } = get();
const track = tracks.find((t) => t.id === trackId);
@@ -378,6 +379,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => ({
}));
},
+ // Split clip and keep only the right portion
splitAndKeepRight: (trackId, clipId, splitTime) => {
const { tracks } = get();
const track = tracks.find((t) => t.id === trackId);
@@ -416,6 +418,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => ({
}));
},
+ // Extract audio from video clip to an audio track
separateAudio: (trackId, clipId) => {
const { tracks } = get();
const track = tracks.find((t) => t.id === trackId);
@@ -425,6 +428,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => ({
get().pushHistory();
+ // Find or create an audio track
let audioTrackId = tracks.find((t) => t.type === "audio")?.id;
if (!audioTrackId) {