Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Refactor useScreenshotExport to use editorCtx object
Richie McIlroydd137a62812f
diff --git a/apps/desktop/src/routes/screenshot-editor/useScreenshotExport.ts b/apps/desktop/src/routes/screenshot-editor/useScreenshotExport.tsindex 9abc271d2..10e8d754d 100644--- a/apps/desktop/src/routes/screenshot-editor/useScreenshotExport.ts+++ b/apps/desktop/src/routes/screenshot-editor/useScreenshotExport.ts@@ -8,15 +8,8 @@ import { getArrowHeadPoints } from "./arrow";import { type Annotation, useScreenshotEditorContext } from "./context";export function useScreenshotExport() {- const {- path,- prettyName,- latestFrame,- annotations,- dialog,- setDialog,- project,- } = useScreenshotEditorContext();+ const editorCtx = useScreenshotEditorContext();+ const { latestFrame, annotations, dialog, setDialog, project } = editorCtx;const [isExporting, setIsExporting] = createSignal(false);const drawAnnotations = (@@ -200,9 +193,8 @@ export function useScreenshotExport() {canvas.height = frame.data.height;ctx.putImageData(frame.data, 0, 0);} else {- // Fallback to loading fileconst img = new Image();- img.src = convertFileSrc(path);+ img.src = convertFileSrc(editorCtx.path);await new Promise((resolve, reject) => {img.onload = resolve;img.onerror = reject;@@ -291,7 +283,7 @@ export function useScreenshotExport() {if (destination === "file") {const savePath = await save({filters: [{ name: "PNG Image", extensions: ["png"] }],- defaultPath: `${prettyName}.png`,+ defaultPath: `${editorCtx.prettyName}.png`,});if (savePath) {await writeFile(savePath, uint8Array);