Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Support different minimum crop sizes for screenshot mode

Richie McIlroydd51fcca85eb
diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsx
index eee4d02ba..ab314ab33 100644
--- a/apps/desktop/src/routes/target-select-overlay.tsx
+++ b/apps/desktop/src/routes/target-select-overlay.tsx
@@ -67,6 +67,7 @@ import {
} from "./(window-chrome)/OptionsContext";
const MIN_SIZE = { width: 150, height: 150 };
+const MIN_SCREENSHOT_SIZE = { width: 1, height: 1 };
const capitalize = (str: string) => {
return str.charAt(0).toUpperCase() + str.slice(1);
@@ -431,9 +432,13 @@ function Inner() {
return bounds.width <= 1 && bounds.height <= 1 && !isInteracting();
});
+ const minSize = () =>
+ options.mode === "screenshot" ? MIN_SCREENSHOT_SIZE : MIN_SIZE;
+
const isValid = createMemo(() => {
const b = crop();
- return b.width >= MIN_SIZE.width && b.height >= MIN_SIZE.height;
+ const min = minSize();
+ return b.width >= min.width && b.height >= min.height;
});
const [targetState, setTargetState] = createSignal<{
@@ -781,7 +786,9 @@ function Inner() {
</Show>
<Show when={!isValid()}>
<div class="flex flex-col gap-1 items-center p-2.5 my-2 rounded-xl border min-w-fit w-fit bg-red-2 shadow-sm border-red-4 text-sm">
- <p>Minimum size is 150 x 150</p>
+ <p>
+ Minimum size is {minSize().width} x {minSize().height}
+ </p>
<small>
<code>
{crop().width} x {crop().height}