Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
coderabbit/cleanup
Richie McIlroy906851e71fa3
diff --git a/apps/desktop/src-tauri/src/captions.rs b/apps/desktop/src-tauri/src/captions.rsindex e9fb1711e..624606cb7 100644--- a/apps/desktop/src-tauri/src/captions.rs+++ b/apps/desktop/src-tauri/src/captions.rs@@ -1777,11 +1777,14 @@ pub async fn save_captions("position".to_string(),serde_json::Value::String(settings.position.clone()),);- settings_obj.insert("bold".to_string(), serde_json::Value::Bool(settings.bold));settings_obj.insert("italic".to_string(),serde_json::Value::Bool(settings.italic),);+ settings_obj.insert(+ "fontWeight".to_string(),+ serde_json::Value::Number(serde_json::Number::from(settings.font_weight)),+ );settings_obj.insert("outline".to_string(),serde_json::Value::Bool(settings.outline),@@ -1914,10 +1917,6 @@ pub fn parse_captions_json(json: &str) -> Result<cap_project::CaptionsData, Stri.and_then(|v| v.as_str()).unwrap_or("bottom").to_string();- let bold = settings_obj- .get("bold")- .and_then(|v| v.as_bool())- .unwrap_or(false);let italic = settings_obj.get("italic").and_then(|v| v.as_bool())@@ -1978,7 +1977,6 @@ pub fn parse_captions_json(json: &str) -> Result<cap_project::CaptionsData, Stribackground_color,background_opacity,position,- bold,italic,font_weight,outline,diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex abeebad4d..1e683b149 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -2677,7 +2677,9 @@ function TextSegmentConfig(props: {{ label: "Medium", value: 500 },{ label: "Bold", value: 700 },].find((o) => o.value === weight);- return option ? option.label : "Normal";+ if (option) return option.label;+ if (weight != null) return `Custom (${weight})`;+ return "Normal";}}</KSelect.Value><KSelect.Icon>diff --git a/apps/desktop/src/routes/editor/MaskOverlay.tsx b/apps/desktop/src/routes/editor/MaskOverlay.tsxindex d372a1657..5e8a4a6cf 100644--- a/apps/desktop/src/routes/editor/MaskOverlay.tsx+++ b/apps/desktop/src/routes/editor/MaskOverlay.tsx@@ -113,7 +113,7 @@ export function MaskOverlay(props: MaskOverlayProps) {><MaskOverlayContentsize={props.size}- maskState={maskState()}+ maskState={maskState}updateSegment={updateSegment}projectHistory={projectHistory}/>@@ -127,7 +127,7 @@ export function MaskOverlay(props: MaskOverlayProps) {function MaskOverlayContent(props: {size: { width: number; height: number };- maskState: ReturnType<typeof evaluateMask>;+ maskState: () => ReturnType<typeof evaluateMask>;updateSegment: (fn: (segment: MaskSegment) => void) => void;projectHistory: ReturnType<typeof useEditorContext>["projectHistory"];}) {@@ -170,7 +170,7 @@ function MaskOverlayContent(props: {};}- const state = () => props.maskState;+ const state = () => props.maskState();const rect = () => {const width = state().size.x * props.size.width;const height = state().size.y * props.size.height;diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsxindex 8e61b4a2e..26daea71a 100644--- a/apps/desktop/src/routes/editor/Player.tsx+++ b/apps/desktop/src/routes/editor/Player.tsx@@ -81,7 +81,6 @@ export function PlayerContent() {backgroundColor: captionsStore.state.settings.backgroundColor,backgroundOpacity: captionsStore.state.settings.backgroundOpacity,position: captionsStore.state.settings.position,- bold: captionsStore.state.settings.bold,italic: captionsStore.state.settings.italic,outline: captionsStore.state.settings.outline,outlineColor: captionsStore.state.settings.outlineColor,diff --git a/apps/desktop/src/routes/editor/TextOverlay.tsx b/apps/desktop/src/routes/editor/TextOverlay.tsxindex 0b562681a..f7cea0100 100644--- a/apps/desktop/src/routes/editor/TextOverlay.tsx+++ b/apps/desktop/src/routes/editor/TextOverlay.tsx@@ -7,6 +7,7 @@ import {createSignal,For,on,+ onCleanup,onMount,} from "solid-js";import { produce } from "solid-js/store";@@ -193,11 +194,20 @@ function TextSegmentOverlay(props: {let hiddenMeasureRef: HTMLDivElement | undefined;const [mounted, setMounted] = createSignal(false);const [isResizing, setIsResizing] = createSignal(false);+ let pendingResizeCleanup: (() => void) | null = null;onMount(() => {setMounted(true);});+ onCleanup(() => {+ if (pendingResizeCleanup) {+ pendingResizeCleanup();+ pendingResizeCleanup = null;+ }+ setIsResizing(false);+ });+const isDefaultSize = (size: { x: number; y: number }) =>size.x <= 0.025 || size.y <= 0.025;@@ -423,8 +433,13 @@ function TextSegmentOverlay(props: {const onMouseUp = () => {setIsResizing(false);window.removeEventListener("mouseup", onMouseUp);+ pendingResizeCleanup = null;};window.addEventListener("mouseup", onMouseUp);+ pendingResizeCleanup = () => {+ setIsResizing(false);+ window.removeEventListener("mouseup", onMouseUp);+ };}};};diff --git a/apps/desktop/src/routes/editor/text.ts b/apps/desktop/src/routes/editor/text.tsindex d7d5d47e8..2285f8a75 100644--- a/apps/desktop/src/routes/editor/text.ts+++ b/apps/desktop/src/routes/editor/text.ts@@ -24,7 +24,7 @@ export const defaultTextSegment = (enabled: true,content: "Text",center: { x: 0.5, y: 0.5 },- size: { x: 0.01, y: 0.01 },+ size: { x: 0.35, y: 0.2 },fontFamily: "sans-serif",fontSize: 48,fontWeight: 700,diff --git a/apps/desktop/src/store/captions.ts b/apps/desktop/src/store/captions.tsindex 56b0ef2e5..36ee01261 100644--- a/apps/desktop/src/store/captions.ts+++ b/apps/desktop/src/store/captions.ts@@ -20,7 +20,6 @@ export const defaultCaptionSettings: CaptionSettings = {backgroundColor: "#000000",backgroundOpacity: 95,position: "bottom-center",- bold: false,italic: false,fontWeight: 700,outline: false,@@ -137,7 +136,6 @@ function createCaptionsStore() {backgroundColor: state.settings.backgroundColor,backgroundOpacity: state.settings.backgroundOpacity,position: state.settings.position,- bold: state.settings.bold,italic: state.settings.italic,fontWeight: state.settings.fontWeight,outline: state.settings.outline,diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rsindex 7f3f62bc4..ed9b166f7 100644--- a/crates/project/src/configuration.rs+++ b/crates/project/src/configuration.rs@@ -788,7 +788,6 @@ pub struct CaptionSettings {pub background_opacity: u32,#[serde(default)]pub position: String,- pub bold: bool,pub italic: bool,#[serde(alias = "fontWeight", default = "CaptionSettings::default_font_weight")]pub font_weight: u32,@@ -851,7 +850,6 @@ impl Default for CaptionSettings {background_color: "#000000".to_string(),background_opacity: 90,position: "bottom-center".to_string(),- bold: false,italic: false,font_weight: Self::default_font_weight(),outline: false,