Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(editor): make overlap source selection explicit
Richie McIlroya42aabb19a8d
diff --git a/apps/desktop/src/routes/editor/TranscriptPage.tsx b/apps/desktop/src/routes/editor/TranscriptPage.tsxindex ec25105e1..7f18b6789 100644--- a/apps/desktop/src/routes/editor/TranscriptPage.tsx+++ b/apps/desktop/src/routes/editor/TranscriptPage.tsx@@ -187,6 +187,8 @@ export function TranscriptPanel() {project.timeline?.segments ?? [],recordingSegments(),project.timeline?.transitions ?? [],+ undefined,+ "incoming",) ?? outputStart;const end = start + defaultDuration;const text = "New caption";@@ -268,6 +270,8 @@ export function TranscriptPanel() {project.timeline?.segments ?? [],recordingSegments(),project.timeline?.transitions ?? [],+ undefined,+ "incoming",);if (sourceTime === null) return -1;diff --git a/apps/desktop/src/routes/editor/captions.ts b/apps/desktop/src/routes/editor/captions.tsindex 50c3e6abf..c500e4079 100644--- a/apps/desktop/src/routes/editor/captions.ts+++ b/apps/desktop/src/routes/editor/captions.ts@@ -403,6 +403,7 @@ export function mapEditedTimeToSource(recordingSegments: SegmentRecordings[],transitions: ClipTransition[] = [],sourceRange?: { start: number; end: number },+ overlapPreference: "outgoing" | "incoming" = "outgoing",): number | null {const mappings = buildSourceToEditedMappings(timelineSegments,@@ -425,7 +426,9 @@ export function mapEditedTimeToSource() {return sourceTime;}- fallback = sourceTime;+ if (fallback === null || overlapPreference === "incoming") {+ fallback = sourceTime;+ }}}return fallback;@@ -818,7 +821,7 @@ if (import.meta.vitest) {});describe("mapEditedTimeToSource", () => {- it("selects the incoming source by default and honors a caption source hint", () => {+ it("selects overlap sources explicitly and honors a caption source hint", () => {const segments: TimelineSegment[] = [{ start: 4, end: 6, timescale: 1, recordingSegment: 0 },{ start: 0, end: 2, timescale: 1, recordingSegment: 1 },@@ -833,6 +836,16 @@ if (import.meta.vitest) {expect(mapEditedTimeToSource(1.75, segments, recordings, transitions),+ ).toBeCloseTo(5.75);+ expect(+ mapEditedTimeToSource(+ 1.75,+ segments,+ recordings,+ transitions,+ undefined,+ "incoming",+ ),).toBeCloseTo(10.25);expect(mapEditedTimeToSource(1.75, segments, recordings, transitions, {diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.tsindex 616f9ccb1..7ed1ea051 100644--- a/apps/desktop/src/routes/editor/context.ts+++ b/apps/desktop/src/routes/editor/context.ts@@ -1353,6 +1353,8 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(timeline.segments,captionRecordingSegments,timeline.transitions ?? [],+ undefined,+ "incoming",);const inverted = segments.flatMap((segment) => {const start = toSource(segment.start);