Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
hide cursor option in editor
Brendan Allanfa65db4fe5af
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex 458131fac..4acbab2f2 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -416,69 +416,75 @@ export function ConfigSidebar() {)}</KTabs.Content><KTabs.Content value="cursor" class="flex flex-col gap-6">- <Field name="Cursor" icon={<IconCapCursor />}>- {/* <Subfield name="Hide cursor when not moving">+ <Field+ name="Cursor"+ icon={<IconCapCursor />}+ value={<Toggle- checked={project.cursor.hideWhenIdle}- onChange={(v) => setProject("cursor", "hideWhenIdle", v)}+ checked={!project.cursor.hide}+ onChange={(v) => {+ setProject("cursor", "hide", !v);+ }}/>- </Subfield> */}- </Field>- <Field name="Size" icon={<IconCapEnlarge />}>- <Slider- value={[project.cursor.size]}- onChange={(v) => setProject("cursor", "size", v[0])}- minValue={20}- maxValue={300}- step={1}- />- </Field>- <KCollapsible open={!project.cursor.raw}>- <Field- name="Smooth Movement"- icon={<IconHugeiconsEaseCurveControlPoints />}- value={- <Toggle- checked={!project.cursor.raw}- onChange={(value) => {- setProject("cursor", "raw", !value);- }}- />- }- />- <KCollapsible.Content class="overflow-hidden border-b border-gray-200 opacity-0 transition-opacity animate-collapsible-up ui-expanded:animate-collapsible-down ui-expanded:opacity-100">- {/* if Content has padding or margin the animation doesn't look as good */}- <div class="flex flex-col gap-4 pt-4 pb-6">- <Field name="Tension">- <Slider- value={[project.cursor.tension]}- onChange={(v) => setProject("cursor", "tension", v[0])}- minValue={1}- maxValue={500}- step={1}- />- </Field>- <Field name="Friction">- <Slider- value={[project.cursor.friction]}- onChange={(v) => setProject("cursor", "friction", v[0])}- minValue={0}- maxValue={50}- step={0.1}- />- </Field>- <Field name="Mass">- <Slider- value={[project.cursor.mass]}- onChange={(v) => setProject("cursor", "mass", v[0])}- minValue={0.1}- maxValue={10}- step={0.01}+ }+ />+ <Show when={!project.cursor.hide}>+ <Field name="Size" icon={<IconCapEnlarge />}>+ <Slider+ value={[project.cursor.size]}+ onChange={(v) => setProject("cursor", "size", v[0])}+ minValue={20}+ maxValue={300}+ step={1}+ />+ </Field>+ <KCollapsible open={!project.cursor.raw}>+ <Field+ name="Smooth Movement"+ icon={<IconHugeiconsEaseCurveControlPoints />}+ value={+ <Toggle+ checked={!project.cursor.raw}+ onChange={(value) => {+ setProject("cursor", "raw", !value);+ }}/>- </Field>- </div>- </KCollapsible.Content>- </KCollapsible>+ }+ />+ <KCollapsible.Content class="overflow-hidden border-b border-gray-200 opacity-0 transition-opacity animate-collapsible-up ui-expanded:animate-collapsible-down ui-expanded:opacity-100">+ {/* if Content has padding or margin the animation doesn't look as good */}+ <div class="flex flex-col gap-4 pt-4 pb-6">+ <Field name="Tension">+ <Slider+ value={[project.cursor.tension]}+ onChange={(v) => setProject("cursor", "tension", v[0])}+ minValue={1}+ maxValue={500}+ step={1}+ />+ </Field>+ <Field name="Friction">+ <Slider+ value={[project.cursor.friction]}+ onChange={(v) => setProject("cursor", "friction", v[0])}+ minValue={0}+ maxValue={50}+ step={0.1}+ />+ </Field>+ <Field name="Mass">+ <Slider+ value={[project.cursor.mass]}+ onChange={(v) => setProject("cursor", "mass", v[0])}+ minValue={0.1}+ maxValue={10}+ step={0.01}+ />+ </Field>+ </div>+ </KCollapsible.Content>+ </KCollapsible>+ </Show>{/* <Field name="Motion Blur"><Sliderdiff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsxindex c37a222de..788337c8b 100644--- a/apps/desktop/src/routes/editor/ui.tsx+++ b/apps/desktop/src/routes/editor/ui.tsx@@ -24,10 +24,15 @@ import { useEditorContext } from "./context";import { TextInput } from "./TextInput";export function Field(- props: ParentProps<{ name: string; icon?: JSX.Element; value?: JSX.Element }>+ props: ParentProps<{+ name: string;+ icon?: JSX.Element;+ value?: JSX.Element;+ class?: string;+ }>) {return (- <div class="flex flex-col gap-4">+ <div class={cx("flex flex-col gap-4", props.class)}><span class="flex flex-row items-center gap-[0.375rem] text-gray-500 font-medium text-sm">{props.icon}{props.name}diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 702908f06..20dad072d 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -246,7 +246,7 @@ export type CurrentRecording = { target: CurrentRecordingTarget; type: Recordingexport type CurrentRecordingChanged = nullexport type CurrentRecordingTarget = { window: { id: number; bounds: Bounds } } | { screen: { id: number } } | { area: { screen: number; bounds: Bounds } }export type CursorAnimationStyle = "regular" | "slow" | "fast"-export type CursorConfiguration = { hideWhenIdle: boolean; size: number; type: CursorType; animationStyle: CursorAnimationStyle; tension: number; mass: number; friction: number; raw?: boolean; motionBlur?: number }+export type CursorConfiguration = { hide?: boolean; hideWhenIdle: boolean; size: number; type: CursorType; animationStyle: CursorAnimationStyle; tension: number; mass: number; friction: number; raw?: boolean; motionBlur?: number }export type CursorMeta = { imagePath: string; hotspot: XY<number> }export type CursorType = "pointer" | "circle"export type Cursors = { [key in string]: string } | { [key in string]: CursorMeta }diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rsindex 0ab01da81..6e4188f59 100644--- a/crates/project/src/configuration.rs+++ b/crates/project/src/configuration.rs@@ -330,6 +330,8 @@ pub enum CursorAnimationStyle {#[derive(Type, Serialize, Deserialize, Clone, Debug)]#[serde(rename_all = "camelCase")]pub struct CursorConfiguration {+ #[serde(default)]+ pub hide: bool,hide_when_idle: bool,pub size: u32,r#type: CursorType,@@ -346,6 +348,7 @@ pub struct CursorConfiguration {impl Default for CursorConfiguration {fn default() -> Self {Self {+ hide: false,hide_when_idle: false,size: 100,r#type: CursorType::default(),diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rsindex 1264a2895..961feeed5 100644--- a/crates/rendering/src/lib.rs+++ b/crates/rendering/src/lib.rs@@ -992,13 +992,15 @@ async fn produce_frame(DisplayLayer::render(&mut pipeline, &segment_frames);- constants.cursor_layer.render(- &mut pipeline,- &segment_frames,- uniforms.resolution_base,- &cursor,- &uniforms.zoom,- );+ if !uniforms.project.cursor.hide {+ constants.cursor_layer.render(+ &mut pipeline,+ &segment_frames,+ uniforms.resolution_base,+ &cursor,+ &uniforms.zoom,+ );+ }if let (Some(camera_size),