Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Refactor crop dialog state in Header component

Richie McIlroy1c349eaf92f1
diff --git a/apps/desktop/src/routes/screenshot-editor/Header.tsx b/apps/desktop/src/routes/screenshot-editor/Header.tsx
index e1e26f713..eaa4ee2d2 100644
--- a/apps/desktop/src/routes/screenshot-editor/Header.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/Header.tsx
@@ -66,18 +66,13 @@ export function Header() {
const cropDialogHandler = () => {
const frame = latestFrame();
+ const frameWidth = frame?.data?.width ?? 0;
+ const frameHeight = frame?.data?.height ?? 0;
setDialog({
open: true,
type: "crop",
- position: {
- ...(project.background.crop?.position ?? { x: 0, y: 0 }),
- },
- size: {
- ...(project.background.crop?.size ?? {
- x: frame?.data?.width ?? 0,
- y: frame?.data?.height ?? 0,
- }),
- },
+ originalSize: { x: frameWidth, y: frameHeight },
+ currentCrop: project.background.crop,
});
};