Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor(target-select): use cameraPreviewDimensions for inline preview

Richie McIlroy9eae9b022e91
diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsx
index eb64f497e..7893479ac 100644
--- a/apps/desktop/src/routes/target-select-overlay.tsx
+++ b/apps/desktop/src/routes/target-select-overlay.tsx
@@ -41,6 +41,7 @@ import {
CameraResizeHandles,
type CameraWindowState,
cameraBorderRadius,
+ cameraPreviewDimensions,
cameraToolbarScale,
clampCameraSize,
getDefaultCameraWindowState,
@@ -1500,11 +1501,11 @@ function CameraPreviewInline() {
const previewDimensions = () => {
const f = frame();
- const aspect = f ? f.width / f.height : 16 / 9;
- const size = clampCameraSize(state.size);
- const width = state.shape === "full" && aspect >= 1 ? size * aspect : size;
- const height =
- state.shape === "full" ? (aspect >= 1 ? size : size / aspect) : size;
+ const { width, height } = cameraPreviewDimensions(
+ state.size,
+ state.shape,
+ f ? f.width / f.height : undefined,
+ );
const viewport = viewportSize();
const maxWidth = Math.max(160, viewport.width - 48);
const maxHeight = Math.max(160, viewport.height - 320);