Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix area select (#599)

Brendan Allan75badfc1b201
diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx
index f790834e5..18376185c 100644
--- a/apps/desktop/src/App.tsx
+++ b/apps/desktop/src/App.tsx
@@ -1,7 +1,6 @@
import { Router, useCurrentMatches } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start/router";
import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";
-import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { message } from "@tauri-apps/plugin-dialog";
import {
createEffect,
@@ -10,7 +9,6 @@ import {
onMount,
Suspense,
} from "solid-js";
-import { Button } from "@cap/ui-solid";
import {
getCurrentWebviewWindow,
WebviewWindow,
@@ -31,7 +29,7 @@ const queryClient = new QueryClient({
defaultOptions: {
mutations: {
onError: (e) => {
- message(`Error\n${e.message}`);
+ message(`Error\n${e}`);
},
},
},
diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsx
index 9d032f892..a71be5f95 100644
--- a/apps/desktop/src/routes/(window-chrome)/(main).tsx
+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx
@@ -143,6 +143,10 @@ function Page() {
const screenId = rawOptions.captureTarget.id;
screen =
screens.data?.find((s) => s.id === screenId) ?? screens.data?.[0];
+ } else if (rawOptions.captureTarget.variant === "area") {
+ const screenId = rawOptions.captureTarget.screen;
+ screen =
+ screens.data?.find((s) => s.id === screenId) ?? screens.data?.[0];
}
return screen;
@@ -191,14 +195,13 @@ function Page() {
const toggleRecording = createMutation(() => ({
mutationFn: async () => {
if (!isRecording()) {
+ console.log("bruh", rawOptions, options.screen());
await commands.startRecording({
capture_target: options.target(),
mode: rawOptions.mode,
capture_system_audio: rawOptions.captureSystemAudio,
});
- } else {
- await commands.stopRecording();
- }
+ } else await commands.stopRecording();
},
}));
@@ -317,6 +320,7 @@ function Page() {
</div>
<div>
<AreaSelectButton
+ screen={options.screen()}
targetVariant={
rawOptions.captureTarget.variant === "window"
? "other"
@@ -528,7 +532,7 @@ function createUpdateCheck() {
function AreaSelectButton(props: {
targetVariant: "screen" | "area" | "other";
- screen?: CaptureScreen;
+ screen: CaptureScreen | undefined;
onChange(area?: number): void;
}) {
const [areaSelection, setAreaSelection] = createStore({ pending: false });
@@ -551,6 +555,7 @@ function AreaSelectButton(props: {
}
const { screen } = props;
+ console.log({ screen });
if (!screen) return;
trackEvent("crop_area_enabled", {