Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Update index.tsx (#1210)

Ameer Al Ashhab5638a95e31a6
diff --git a/apps/desktop/src/routes/editor/Timeline/index.tsx b/apps/desktop/src/routes/editor/Timeline/index.tsx
index ad80857c9..e9ec6690c 100644
--- a/apps/desktop/src/routes/editor/Timeline/index.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/index.tsx
@@ -52,6 +52,22 @@ export function Timeline() {
});
resume();
}
+
+ const checkBounds = () => {
+ if (timelineBounds.width && timelineBounds.width > 0) {
+ const minSegmentPixels = 80;
+ const secondsPerPixel = 1 / minSegmentPixels;
+ const desiredZoom = timelineBounds.width * secondsPerPixel;
+
+ if (transform().zoom > desiredZoom) {
+ transform().updateZoom(desiredZoom, 0);
+ }
+ } else {
+ setTimeout(checkBounds, 10);
+ }
+ };
+
+ checkBounds();
});
if (