Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Merge branch 'main' into pr/1771

Richie McIlroycb990a0b624e
diff --cc apps/desktop/src/routes/camera.tsx
index fc74a9d5e,e00313436..9c53a80b8
--- a/apps/desktop/src/routes/camera.tsx
+++ b/apps/desktop/src/routes/camera.tsx
@@@ -1319,15 -1327,67 +1327,67 @@@ function cameraBorderRadius(state: Came
return `${radius}rem`;
}
- function CameraIssueOverlay(props: { issue: CameraPreviewIssue }) {
+ function cameraOverlayTextMetrics(size: number) {
+ const normalized =
+ (Math.max(CAMERA_MIN_SIZE, Math.min(CAMERA_MAX_SIZE, size)) -
+ CAMERA_MIN_SIZE) /
+ (CAMERA_MAX_SIZE - CAMERA_MIN_SIZE);
+ const titleSize = 0.75 + normalized * 0.375;
+ const messageSize = 0.625 + normalized * 0.25;
+ const lineHeight = 1.2 + normalized * 0.2;
+ const gap = 0.375 + normalized * 0.25;
+ const maxWidth = Math.max(7.5, Math.min(18, size / 16));
+
+ return {
+ gap: `${gap}rem`,
+ maxWidth: `${maxWidth}rem`,
+ messageLineHeight: `${lineHeight}rem`,
+ messageSize: `${messageSize}rem`,
+ titleSize: `${titleSize}rem`,
+ };
+ }
+
+ function CameraIssueOverlay(props: {
+ issue: CameraPreviewIssue;
+ size: number;
+ class?: string;
+ top?: number;
+ borderRadius?: string;
+ }) {
+ const textMetrics = () => cameraOverlayTextMetrics(props.size);
+ const style = () => {
+ const base = { "border-radius": props.borderRadius ?? "inherit" };
+ if (props.top === undefined) return base;
+ return { ...base, top: `${props.top}px` };
+ };
+
return (
<div
- class="absolute inset-0 z-50 flex items-center justify-center bg-black/75 backdrop-blur-xs px-4 pointer-events-none"
- style={{ "border-radius": "inherit" }}
+ class={cx(
- "absolute z-10 flex items-center justify-center overflow-hidden bg-black/75 backdrop-blur-sm px-4 pointer-events-none",
++ "absolute z-10 flex items-center justify-center overflow-hidden bg-black/75 backdrop-blur-xs px-4 pointer-events-none",
+ props.class ?? "inset-0",
+ )}
+ style={style()}
>
- <div class="flex max-w-[18rem] flex-col items-center gap-2 text-center text-white">
- <p class="text-sm font-semibold text-white">{props.issue.title}</p>
- <p class="text-xs leading-5 text-white/75">{props.issue.message}</p>
+ <div
+ class="flex flex-col items-center text-center text-white"
+ style={{ gap: textMetrics().gap, "max-width": textMetrics().maxWidth }}
+ >
+ <p
+ class="font-semibold text-white"
+ style={{ "font-size": textMetrics().titleSize }}
+ >
+ {props.issue.title}
+ </p>
+ <p
+ class="text-white/75"
+ style={{
+ "font-size": textMetrics().messageSize,
+ "line-height": textMetrics().messageLineHeight,
+ }}
+ >
+ {props.issue.message}
+ </p>
</div>
</div>
);
diff --cc apps/desktop/src/routes/screenshot-editor/Preview.tsx
index f856a3eb8,2b353d3c8..e46a1fef6
--- a/apps/desktop/src/routes/screenshot-editor/Preview.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/Preview.tsx
@@@ -325,12 -430,11 +430,11 @@@ export function Preview(props: { zoom:
{/* Preview Area */}
<div
ref={setCanvasContainerRef}
- class="flex-1 relative flex items-center justify-center overflow-hidden outline-none"
+ class="flex-1 relative flex items-center justify-center overflow-hidden outline-hidden"
style={gridStyle}
- onWheel={handleWheel}
onMouseDown={handleMiddleMouseDown}
>
- <div class="absolute left-4 bottom-4 z-10 flex items-center gap-2 bg-gray-1 dark:bg-gray-3 rounded-lg shadow-sm p-1 border border-gray-4">
+ <div class="absolute left-4 bottom-4 z-10 flex items-center gap-2 bg-gray-1 dark:bg-gray-3 rounded-lg shadow-xs p-1 border border-gray-4">
<EditorButton
tooltipText="Zoom Out"
kbd={["meta", "-"]}