Skip to content

Commit 0f2ff40

Browse files
ItsEeleeyaameer2468richiemcilroyoscartbeaumontcoderabbitai[bot]
authored
New Cropper across the app (#1079)
* New Cropper, updated CaptureArea window * Fix capture-area nswindow layer, close button on CapErrorBoundary, Remove haptics toggle * Remove unused CropAreaRenderer and Box. * Add default capability "core:resources:allow-close" to properly close menus * Properly disable Confirm button when crop size is too small * Cropper double click, * Use new cropper in target-select-overlay * Don't fill when double clicking selected region. Only the container * oops * Ensure editor project has a first segment in editor cropper, better invalid cropper state error message * Delete canvas.ts * Remove unused calculations in Cropper * Add hard minSize to target-select-overlay cropper, apply ratio snapping after size constraint checks * Ensure the new selection controls can't go under the notch on macos * Update tauri.ts * Update general.tsx * nit * move event def to Rust * (Fix) Use the new cropper again in target-select-overlay * Cropper: Stop resizing in aspect ratio mode towards the opposite side. * Add alt mode indicator * fix the close button i broke * Add minimum size warning * Ensure `createKeyDownSignal` handles blur event Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix "ResizeObserver loop completed with undelivered notifications." * biome * render latest frame in the cropper and pause playback when opening it * some tweaks * rendering current would have drawbacks * ts * use named export + attach pointermove to window instead of container * formatting * final fixes --------- Co-authored-by: ameer2468 <[email protected]> Co-authored-by: Richie McIlroy <[email protected]> Co-authored-by: Oscar Beaumont <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Brendan Allan <[email protected]>
1 parent 3af8741 commit 0f2ff40

File tree

22 files changed

+2112
-2174
lines changed

22 files changed

+2112
-2174
lines changed

apps/desktop/src-tauri/capabilities/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"core:path:default",
2525
"core:event:default",
2626
"core:menu:default",
27+
"core:resources:allow-close",
2728
"core:window:default",
2829
"core:window:allow-close",
2930
"core:window:allow-destroy",

apps/desktop/src-tauri/src/general_settings.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ pub struct GeneralSettingsStore {
7070
pub upload_individual_files: bool,
7171
#[serde(default)]
7272
pub hide_dock_icon: bool,
73-
#[serde(default = "true_b")]
74-
pub haptics_enabled: bool,
7573
#[serde(default)]
7674
pub auto_create_shareable_link: bool,
7775
#[serde(default = "true_b")]
@@ -166,7 +164,6 @@ impl Default for GeneralSettingsStore {
166164
instance_id: uuid::Uuid::new_v4(),
167165
upload_individual_files: false,
168166
hide_dock_icon: false,
169-
haptics_enabled: true,
170167
auto_create_shareable_link: false,
171168
enable_notifications: true,
172169
disable_auto_open_links: false,

apps/desktop/src-tauri/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ pub struct RecordingDeleted {
285285
path: PathBuf,
286286
}
287287

288+
#[derive(specta::Type, tauri_specta::Event, Serialize)]
289+
pub struct SetCaptureAreaPending(bool);
290+
288291
#[derive(Deserialize, specta::Type, Serialize, tauri_specta::Event, Debug, Clone)]
289292
pub struct NewScreenshotAdded {
290293
path: PathBuf,
@@ -1920,6 +1923,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
19201923
target_select_overlay::TargetUnderCursor,
19211924
hotkeys::OnEscapePress,
19221925
upload::UploadProgressEvent,
1926+
SetCaptureAreaPending,
19231927
])
19241928
.error_handling(tauri_specta::ErrorHandlingMode::Throw)
19251929
.typ::<ProjectConfiguration>()

apps/desktop/src-tauri/src/platform/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub use macos::*;
1111
use tracing::instrument;
1212

1313
#[derive(Debug, Serialize, Deserialize, Type, Default)]
14+
#[serde(rename_all = "camelCase")]
1415
#[repr(isize)]
1516
pub enum HapticPattern {
1617
Alignment = 0,
@@ -20,6 +21,7 @@ pub enum HapticPattern {
2021
}
2122

2223
#[derive(Debug, Serialize, Deserialize, Type, Default)]
24+
#[serde(rename_all = "camelCase")]
2325
#[repr(usize)]
2426
pub enum HapticPerformanceTime {
2527
Default = 0,

apps/desktop/src-tauri/src/windows.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ impl ShowCapWindow {
578578
.maximized(false)
579579
.fullscreen(false)
580580
.shadow(false)
581+
.resizable(false)
581582
.always_on_top(true)
582583
.content_protected(should_protect)
583584
.skip_taskbar(true)
@@ -608,7 +609,7 @@ impl ShowCapWindow {
608609
#[cfg(target_os = "macos")]
609610
crate::platform::set_window_level(
610611
window.as_ref().window(),
611-
objc2_app_kit::NSScreenSaverWindowLevel,
612+
objc2_app_kit::NSPopUpMenuWindowLevel,
612613
);
613614

614615
// Hide the main window if the target monitor is the same

apps/desktop/src/components/CapErrorBoundary.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Button } from "@cap/ui-solid";
2+
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
23
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
34
import { ErrorBoundary, type ParentProps } from "solid-js";
45

@@ -32,6 +33,12 @@ export function CapErrorBoundary(props: ParentProps) {
3233
>
3334
Reload
3435
</Button>
36+
<Button
37+
onClick={() => getCurrentWebviewWindow().close()}
38+
variant="destructive"
39+
>
40+
Close
41+
</Button>
3542
</div>
3643

3744
{import.meta.env.DEV && (

apps/desktop/src/components/CropAreaRenderer.tsx

Lines changed: 0 additions & 290 deletions
This file was deleted.

0 commit comments

Comments
 (0)