Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Default configs for size + rounding

Richie McIlroyd7980460d20f
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index f5849c3a6..0e4a8f797 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -438,7 +438,7 @@ export function ConfigSidebar() {
</Field>
<Field name="Rounded Corners" icon={<IconCapCorners />}>
<Slider
- value={[project.camera.rounding]}
+ value={[project.camera.rounding ?? 100.0]}
onChange={(v) => setProject("camera", "rounding", v[0])}
minValue={0}
maxValue={100}
diff --git a/apps/desktop/src/routes/editor/projectConfig.ts b/apps/desktop/src/routes/editor/projectConfig.ts
index 92df5bed4..899c425d2 100644
--- a/apps/desktop/src/routes/editor/projectConfig.ts
+++ b/apps/desktop/src/routes/editor/projectConfig.ts
@@ -25,6 +25,7 @@ export const DEFAULT_PROJECT_CONFIG: ProjectConfiguration = {
position: { x: "right", y: "bottom" },
rounding: 100,
shadow: 50,
+ size: 30,
},
audio: { mute: false, improve: false },
cursor: { hideWhenIdle: false, size: 0, type: "pointer" },
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 8c1ba8021..1e05dacbb 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -293,7 +293,7 @@ export type AuthStore = { token: string; expires: number }
export type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; inset: number; crop: Crop | null }
export type BackgroundSource = { type: "wallpaper"; id: number } | { type: "image"; path: string | null } | { type: "color"; value: [number, number, number] } | { type: "gradient"; from: [number, number, number]; to: [number, number, number]; angle?: number }
export type Bounds = { x: number; y: number; width: number; height: number }
-export type CameraConfiguration = { hide: boolean; mirror: boolean; position: CameraPosition; rounding: number; shadow: number; size?: number }
+export type CameraConfiguration = { hide: boolean; mirror: boolean; position: CameraPosition; rounding: number; shadow: number; size: number }
export type CameraMeta = { path: string }
export type CameraPosition = { x: CameraXPosition; y: CameraYPosition }
export type CameraXPosition = "left" | "center" | "right"
diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rs
index dbc4919ee..d76c3aec1 100644
--- a/crates/project/src/configuration.rs
+++ b/crates/project/src/configuration.rs
@@ -101,7 +101,7 @@ pub struct CameraPosition {
pub y: CameraYPosition,
}
-#[derive(Type, Serialize, Deserialize, Clone, Debug, Default)]
+#[derive(Type, Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct CameraConfiguration {
pub hide: bool,
@@ -109,15 +109,30 @@ pub struct CameraConfiguration {
pub position: CameraPosition,
pub rounding: f32,
pub shadow: u32,
- // min 20 max 80
- #[serde(default = "CameraConfiguration::default_size")]
pub size: f32,
}
+impl Default for CameraConfiguration {
+ fn default() -> Self {
+ Self {
+ hide: false,
+ mirror: false,
+ position: CameraPosition::default(),
+ rounding: Self::default_rounding(),
+ shadow: 0,
+ size: Self::default_size(),
+ }
+ }
+}
+
impl CameraConfiguration {
fn default_size() -> f32 {
30.0
}
+
+ fn default_rounding() -> f32 {
+ 100.0
+ }
}
#[derive(Type, Serialize, Deserialize, Clone, Debug, Default)]
@@ -224,13 +239,7 @@ impl Default for ProjectConfiguration {
source: BackgroundSource::default(),
..Default::default()
},
- camera: CameraConfiguration {
- position: CameraPosition {
- x: CameraXPosition::Right,
- y: CameraYPosition::Bottom,
- },
- ..Default::default()
- },
+ camera: CameraConfiguration::default(),
audio: AudioConfiguration::default(),
cursor: CursorConfiguration::default(),
hotkeys: HotkeysConfiguration::default(),