Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(editor): fix split-mode click position on clamped caption and keyboard segments

Minitf4bbe742ab13
diff --git a/apps/desktop/src/routes/editor/Timeline/CaptionsTrack.tsx b/apps/desktop/src/routes/editor/Timeline/CaptionsTrack.tsx
index 33a746f43..9093e24e4 100644
--- a/apps/desktop/src/routes/editor/Timeline/CaptionsTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/CaptionsTrack.tsx
@@ -161,7 +161,8 @@ export function CaptionsTrack(props: {
return indices.has(i());
});
- const segmentWidth = () => segment.end - segment.start;
+ const segmentWidth = () =>
+ Math.min(segment.end, totalDuration()) - segment.start;
return (
<SegmentRoot
diff --git a/apps/desktop/src/routes/editor/Timeline/KeyboardTrack.tsx b/apps/desktop/src/routes/editor/Timeline/KeyboardTrack.tsx
index 07a0a57d6..9cefb84bf 100644
--- a/apps/desktop/src/routes/editor/Timeline/KeyboardTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/KeyboardTrack.tsx
@@ -153,7 +153,8 @@ export function KeyboardTrack(props: {
return indices.has(i());
});
- const segmentWidth = () => segment.end - segment.start;
+ const segmentWidth = () =>
+ Math.min(segment.end, totalDuration()) - segment.start;
return (
<SegmentRoot