Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: split action respects segment timescale (speed)
martinicoding259beaf7ff89
diff --git a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsxindex 5bb449c86..051b671b0 100644--- a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx+++ b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx@@ -421,7 +421,8 @@ export function ClipTrack(const fraction = (e.clientX - rect.left) / rect.width;const seg = segment();- const splitTime = fraction * (seg.end - seg.start);+ const splitTime =+ (fraction * (seg.end - seg.start)) / seg.timescale;projectActions.splitClipSegment(prevDuration() + splitTime);} else {diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.tsindex f7b9bef38..02b66155f 100644--- a/apps/desktop/src/routes/editor/context.ts+++ b/apps/desktop/src/routes/editor/context.ts@@ -202,7 +202,8 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(let searchTime = time;let _prevDuration = 0;const currentSegmentIndex = segments.findIndex((segment) => {- const duration = segment.end - segment.start;+ const duration =+ (segment.end - segment.start) / segment.timescale;if (searchTime > duration) {searchTime -= duration;_prevDuration += duration;@@ -215,12 +216,15 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(if (currentSegmentIndex === -1) return;const segment = segments[currentSegmentIndex];+ const splitPositionInRecording = searchTime * segment.timescale;+segments.splice(currentSegmentIndex + 1, 0, {...segment,- start: segment.start + searchTime,+ start: segment.start + splitPositionInRecording,end: segment.end,});- segments[currentSegmentIndex].end = segment.start + searchTime;+ segments[currentSegmentIndex].end =+ segment.start + splitPositionInRecording;}),);},