Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
various visual tweaks to the new editor and fixed playback
ameer2468aa6ef9f1ec36
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex 8cdab67b0..b2c9449f6 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -131,7 +131,7 @@ impl CapWindowId {Self::Setup => (600.0, 600.0),Self::Main => (300.0, 360.0),Self::SignIn => (300.0, 360.0),- Self::Editor { .. } => (1170.0, 800.0),+ Self::Editor { .. } => (1275.0, 800.0),Self::Settings => (600.0, 450.0),Self::Camera => (460.0, 920.0),Self::Upgrade => (850.0, 850.0),diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex 056354fe7..012701e28 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -458,7 +458,7 @@ export function ConfigSidebar() {</KTabs.List><divref={scrollRef}- class="p-5 custom-scroll overflow-x-hidden overflow-y-auto text-[0.875rem] h-full"+ class="p-4 custom-scroll overflow-x-hidden overflow-y-auto text-[0.875rem] h-full"><KTabs.Content value="background" class="flex flex-col gap-8"><Field icon={<IconCapImage class="size-4" />} name="Background Image">diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsxindex 5c3e8cd2e..20263751f 100644--- a/apps/desktop/src/routes/editor/Header.tsx+++ b/apps/desktop/src/routes/editor/Header.tsx@@ -75,41 +75,6 @@ const Menu = {editorContext: ReturnType<typeof useEditorContext>;}) => <PresetsDropdown />,},- {- button: (props: {- editorContext: ReturnType<typeof useEditorContext>;- }) => {- const { editorInstance, setDialog, project } = props.editorContext;- return (- <EditorButton- onClick={() => {- const display = editorInstance.recordings.segments[0].display;- setDialog({- open: true,- type: "crop",- position: {- ...(project.background.crop?.position ?? { x: 0, y: 0 }),- },- size: {- ...(project.background.crop?.size ?? {- x: display.width,- y: display.height,- }),- },- });- }}- leftIcon={<IconCapCrop class="w-5 text-gray-500" />}- >- Crop- </EditorButton>- );- },- },- {- button: (props: {- editorContext: ReturnType<typeof useEditorContext>;- }) => <AspectRatioSelect />,- },],right: [{@@ -142,24 +107,6 @@ const Menu = {);},},- {- button: (props: {- editorContext?: ReturnType<typeof useEditorContext>;- }) => (- <EditorButton- onClick={async () => {- const currentWindow = getCurrentWindow();- if (!props.editorContext?.editorInstance.path) return ;- if (!(await ask("Are you sure you want to delete this recording?")))- return;- await remove(props.editorContext?.editorInstance.path, { recursive: true });- await currentWindow.close();- }}- tooltipText="Delete recording"- leftIcon={<IconCapTrash class="w-5" />}- />- ),- },],} satisfies Record<"left" | "center" | "right",@@ -171,7 +118,6 @@ const Menu = {>;export function Header() {- const license = createLicenseQuery();const editorContext = useEditorContext();const [selectedFps, setSelectedFps] = createSignal(@@ -209,7 +155,7 @@ export function Header() {ostype() === "windows" ? "pl-[4.3rem]" : "pl-[1.25rem]")}>- <div class="flex relative z-20 flex-row gap-2 items-center font-medium">+ <div class="flex relative z-20 flex-row gap-3 items-center font-medium"><ShareButtonselectedResolution={selectedResolution}selectedFps={selectedFps}@@ -231,9 +177,21 @@ export function Header() {data-tauri-drag-regionclass="absolute flex gap-4 h-full w-full items-start left-[5.5rem] z-10">- <div class="flex gap-4 items-center h-full">+ <div class="flex gap-2 items-center h-full">+ <EditorButton+ onClick={async () => {+ const currentWindow = getCurrentWindow();+ if (!editorContext?.editorInstance.path) return ;+ if (!(await ask("Are you sure you want to delete this recording?")))+ return;+ await remove(editorContext?.editorInstance.path, { recursive: true });+ await currentWindow.close();+ }}+ tooltipText="Delete recording"+ leftIcon={<IconCapTrash class="w-5" />}+ /><p class="text-sm text-gray-500">- {editorContext.editorInstance.prettyName}+ {editorContext.editorInstance.prettyName}<span class="text-sm text-gray-400">.cap</span></p>{/* <ErrorBoundary fallback={<></>}><Suspense>diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsxindex 2c4e6a43a..51e62eaa8 100644--- a/apps/desktop/src/routes/editor/Player.tsx+++ b/apps/desktop/src/routes/editor/Player.tsx@@ -9,6 +9,7 @@ import { commands } from "~/utils/tauri";import { FPS, OUTPUT_SIZE, useEditorContext } from "./context";import { ComingSoonTooltip, EditorButton, Slider } from "./ui";import { formatTime } from "./utils";+import AspectRatioSelect from "./AspectRatioSelect";export function Player() {const {@@ -79,6 +80,8 @@ export function Player() {await commands.stopPlayback();setPlaying(false);} else {+ // Ensure we seek to the current playback time before starting playback+ await commands.seekTo(Math.floor(playbackTime() * FPS));await commands.startPlayback(FPS, OUTPUT_SIZE);setPlaying(true);}@@ -106,10 +109,34 @@ export function Player() {return (<div class="flex flex-col flex-1">- <div ref={setCanvasContainerRef} class="relative flex-1 bg-gray-50">+ <div class="flex w-[calc(100%-40px)] mx-auto gap-3 justify-center p-5 bg-gray-100 rounded-t-xl">+ <AspectRatioSelect />+ <EditorButton+ onClick={() => {+ const display = editorInstance.recordings.segments[0].display;+ setDialog({+ open: true,+ type: "crop",+ position: {+ ...(project.background.crop?.position ?? { x: 0, y: 0 }),+ },+ size: {+ ...(project.background.crop?.size ?? {+ x: display.width,+ y: display.height,+ }),+ },+ });+ }}+ leftIcon={<IconCapCrop class="w-5 text-gray-500" />}+ >+ Crop+ </EditorButton>+ </div>+ <div ref={setCanvasContainerRef} class="relative flex-1 justify-center items-center bg-gray-50"><Show when={latestFrame()}>{(currentFrame) => {- const padding = 20;+ const padding = 4;const containerAspect = () => {if (containerBounds.width && containerBounds.height) {@@ -144,21 +171,13 @@ export function Player() {};return (- <div class="relative w-[calc(100%-40px)] mx-auto h-full bg-gray-100 rounded-t-xl">+ <div class="relative w-[calc(100%-40px)] overflow-hidden flex items-center justify-center mx-auto h-full bg-gray-100"><canvasstyle={{- left: `${Math.max(- ((containerBounds.width ?? 0) - size().width) / 2,- padding- )}px`,- top: `${Math.max(- ((containerBounds.height ?? 0) - size().height) / 2,- padding- )}px`,width: `${size().width - padding * 2}px`,height: `${size().height}px`,}}- class="absolute bg-blue-50 rounded"+ class="bg-blue-50 rounded"ref={canvasRef}id="canvas"width={currentFrame().width}@@ -169,7 +188,7 @@ export function Player() {}}</Show></div>- <div class="flex z-10 flex-row gap-3 justify-between items-center p-5 w-[calc(100%-40px)] mx-auto bg-gray-100 rounded-b-xl">+ <div class="flex z-10 overflow-hidden flex-row gap-3 justify-between items-center p-5 w-[calc(100%-40px)] mx-auto bg-gray-100 rounded-b-xl"><div class="flex-1"><Timeclass="text-gray-500"diff --git a/apps/desktop/src/routes/editor/ShareButton.tsx b/apps/desktop/src/routes/editor/ShareButton.tsxindex b4a0953ab..d4c166ee8 100644--- a/apps/desktop/src/routes/editor/ShareButton.tsx+++ b/apps/desktop/src/routes/editor/ShareButton.tsx@@ -203,14 +203,14 @@ function ShareButton(props: {const url = () => new URL(sharing().link);return (- <div class="flex flex-row gap-2 items-center">+ <div class="flex gap-3 items-center"><Tooltip.Root openDelay={0} closeDelay={0}><Tooltip.Trigger><Buttondisabled={uploadVideo.isPending}onClick={(e) => uploadVideo.mutate()}- variant="secondary"- class="flex items-center space-x-1"+ variant="primary"+ class="flex items-center h-[41px] px-3 space-x-1">{uploadVideo.isPending ? (<IconLucideLoaderCircle class="size-[1rem] animate-spin" />@@ -229,7 +229,7 @@ function ShareButton(props: {</Tooltip.Portal></Tooltip.Root><a- class="rounded-full h-[2rem] px-[1rem] flex flex-row items-center gap-[0.375rem] bg-gray-200 hover:bg-gray-300 transition-colors duration-100"+ class="rounded-xl px-4 py-2.5 flex flex-row items-center gap-[0.375rem] bg-gray-200 hover:bg-gray-300 transition-colors duration-100"href={sharing().link}target="_blank"rel="noreferrer"diff --git a/apps/desktop/src/routes/editor/Timeline.tsx b/apps/desktop/src/routes/editor/Timeline.tsxindex 48998cc3b..fc84402a4 100644--- a/apps/desktop/src/routes/editor/Timeline.tsx+++ b/apps/desktop/src/routes/editor/Timeline.tsx@@ -327,20 +327,8 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {state.timelineTransform.updateZoom(totalDuration(), previewTime()!);}}+- const timelineMarkings = () => {- const resolution =- TIMELINE_MARKING_RESOLUTIONS.find(- (r) => state.timelineTransform.zoom / r <= MAX_TIMELINE_MARKINGS- ) ?? 30;-- const diff = state.timelineTransform.position % resolution;-- return Array.from(- { length: (state.timelineTransform.zoom + 5) / resolution },- (_, i) => state.timelineTransform.position - diff + (i + 1) * resolution- );- };return (<TrackRoot ref={props.ref}>@@ -422,7 +410,7 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {(markingTime - segmentStartTime) / secsPerPixel()}px`,}}- class="absolute z-10 w-px h-14 bg-gradient-to-b to-transparent from-white-transparent-40 dark:from-black-transparent-60"+ class="absolute z-10 w-px h-12 bg-gradient-to-b from-transparent to-transparent via-white-transparent-40 dark:via-black-transparent-60"/>);}@@ -497,7 +485,17 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {}}/><SegmentContent class="justify-between relative bg-gradient-to-r timeline-gradient-border from-[#2675DB] via-[#5CA3FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]">+ <Show when={segment.start > 0}>+ <span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] left-5">+ {formatTime(segment.start)}+ </span>+ </Show><div class="absolute inset-0 -top-[120px] dark:bg-gray-500 bg-gray-50 w-[500px] h-[150px] rounded-full mx-auto blur-[50px] mix-blend-overlay opacity-30" />+ <Show when={segment.end < editorInstance.recordingDuration}>+ <span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] right-5">+ {formatTime(segment.end)}+ </span>+ </Show></SegmentContent><SegmentHandleclass={cx(diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsxindex d21f1e55e..b8e0dd31c 100644--- a/apps/desktop/src/routes/editor/ui.tsx+++ b/apps/desktop/src/routes/editor/ui.tsx@@ -22,7 +22,7 @@ export function Field(props: ParentProps<{ name: string; icon?: JSX.Element; value?: JSX.Element }>) {return (- <div class="flex flex-col gap-6">+ <div class="flex flex-col gap-5"><span class="flex flex-row items-center gap-[0.375rem] text-gray-500 font-medium text-sm">{props.icon}{props.name}