Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
desktop: multi-select in clip and scenes track & more (#1295)
Ameer Al Ashhabc83f852ab113
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsxindex 9944f0ac3..b75ce3290 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx@@ -177,7 +177,7 @@ export default function Recordings() {No {activeTab()} recordings</p></Show>- <ul class="p-4 flex flex-col gap-5 w-full text-[--text-primary]">+ <ul class="flex flex-col w-full text-[--text-primary]"><For each={filteredRecordings()}>{(recording) => (<RecordingItem@@ -219,9 +219,23 @@ function RecordingItem(props: {mode().charAt(0).toUpperCase() + mode().slice(1);const queryClient = useQueryClient();+ const studioCompleteCheck = () =>+ mode() === "studio" && props.recording.meta.status.status === "Complete";return (- <li class="flex flex-row justify-between [&:not(:last-child)]:border-b [&:not(:last-child)]:pb-5 [&:not(:last-child)]:border-gray-3 items-center w-full transition-colors duration-200 hover:bg-gray-2">+ <li+ onClick={() => {+ if (studioCompleteCheck()) {+ props.onOpenEditor();+ }+ }}+ class={cx(+ "flex flex-row justify-between p-3 [&:not(:last-child)]:border-b [&:not(:last-child)]:border-gray-3 items-center w-full transition-colors duration-200",+ studioCompleteCheck()+ ? "cursor-pointer hover:bg-gray-3"+ : "cursor-default",+ )}+ ><div class="flex gap-5 items-center"><Showwhen={imageExists()}@@ -242,7 +256,7 @@ function RecordingItem(props: {<divclass={cx("px-2 py-0.5 flex items-center gap-1.5 font-medium text-[11px] text-gray-12 rounded-full w-fit",- mode() === "instant" ? "bg-blue-100" : "bg-gray-3",+ mode() === "instant" ? "bg-blue-100" : "bg-gray-4",)}>{mode() === "instant" ? (diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex a4e4facfe..b5ae2287b 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -487,8 +487,8 @@ export function ConfigSidebar() {}/><Show when={project.cursor.hideWhenIdle}>- <Subfield name="Inactivity Delay" class="items-center gap-4">- <div class="flex items-center gap-3 flex-1">+ <Subfield name="Inactivity Delay" class="gap-4 items-center">+ <div class="flex flex-1 gap-3 items-center"><Sliderclass="flex-1"value={[cursorIdleDelay()]}@@ -734,37 +734,131 @@ export function ConfigSidebar() {const sceneSelection = selection();if (sceneSelection.type !== "scene") return;- const segment =- project.timeline?.sceneSegments?.[sceneSelection.index];- if (!segment) return;+ const segments = sceneSelection.indices+ .map((idx) => ({+ segment: project.timeline?.sceneSegments?.[idx],+ index: idx,+ }))+ .filter((s) => s.segment !== undefined);- return { selection: sceneSelection, segment };+ if (segments.length === 0) return;+ return { selection: sceneSelection, segments };})()}>{(value) => (- <SceneSegmentConfig- segment={value().segment}- segmentIndex={value().selection.index}- />+ <Show+ when={value().segments.length > 1}+ fallback={+ <SceneSegmentConfig+ segment={value().segments[0].segment!}+ segmentIndex={value().segments[0].index}+ />+ }+ >+ <div class="space-y-4">+ <div class="flex flex-row justify-between items-center">+ <div class="flex gap-2 items-center">+ <EditorButton+ onClick={() =>+ setEditorState("timeline", "selection", null)+ }+ leftIcon={<IconLucideCheck />}+ >+ Done+ </EditorButton>+ <span class="text-sm text-gray-10">+ {value().segments.length} scene{" "}+ {value().segments.length === 1+ ? "segment"+ : "segments"}{" "}+ selected+ </span>+ </div>+ <EditorButton+ variant="danger"+ onClick={() => {+ const indices = value().selection.indices;++ // Delete segments in reverse order to maintain indices+ [...indices]+ .sort((a, b) => b - a)+ .forEach((idx) => {+ projectActions.deleteSceneSegment(idx);+ });+ }}+ leftIcon={<IconCapTrash />}+ >+ Delete+ </EditorButton>+ </div>+ </div>+ </Show>)}</Show><Showwhen={(() => {- const clipSegment = selection();- if (clipSegment.type !== "clip") return;+ const clipSelection = selection();+ if (clipSelection.type !== "clip") return;- const segment =- project.timeline?.segments?.[clipSegment.index];- if (!segment) return;+ const segments = clipSelection.indices+ .map((idx) => ({+ segment: project.timeline?.segments?.[idx],+ index: idx,+ }))+ .filter((s) => s.segment !== undefined);- return { selection: clipSegment, segment };+ if (segments.length === 0) return;+ return { selection: clipSelection, segments };})()}>{(value) => (- <ClipSegmentConfig- segment={value().segment}- segmentIndex={value().selection.index}- />+ <Show+ when={value().segments.length > 1}+ fallback={+ <ClipSegmentConfig+ segment={value().segments[0].segment!}+ segmentIndex={value().segments[0].index}+ />+ }+ >+ <div class="space-y-4">+ <div class="flex flex-row justify-between items-center">+ <div class="flex gap-2 items-center">+ <EditorButton+ onClick={() =>+ setEditorState("timeline", "selection", null)+ }+ leftIcon={<IconLucideCheck />}+ >+ Done+ </EditorButton>+ <span class="text-sm text-gray-10">+ {value().segments.length} clip{" "}+ {value().segments.length === 1+ ? "segment"+ : "segments"}{" "}+ selected+ </span>+ </div>+ <EditorButton+ variant="danger"+ onClick={() => {+ const indices = value().selection.indices;++ // Delete segments in reverse order to maintain indices+ [...indices]+ .sort((a, b) => b - a)+ .forEach((idx) => {+ projectActions.deleteClipSegment(idx);+ });+ }}+ leftIcon={<IconCapTrash />}+ >+ Delete+ </EditorButton>+ </div>+ </div>+ </Show>)}</Show></Suspense>diff --git a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsxindex e8fcca489..1dc4ac803 100644--- a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx+++ b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx@@ -242,7 +242,9 @@ export function ClipTrack((s) => s.start === segment.start && s.end === segment.end,);- return segmentIndex === selection.index;+ if (segmentIndex === undefined || segmentIndex === -1) return false;++ return selection.indices.includes(segmentIndex);});const micWaveform = () => {@@ -371,16 +373,81 @@ export function ClipTrack(projectActions.splitClipSegment(prevDuration() + splitTime);} else {createRoot((dispose) => {- createEventListener(e.currentTarget, "mouseup", (e) => {- dispose();+ createEventListener(+ e.currentTarget,+ "mouseup",+ (upEvent) => {+ dispose();- setEditorState("timeline", "selection", {- type: "clip",- index: i(),- });+ const currentIndex = i();+ const selection = editorState.timeline.selection;+ const isMac =+ navigator.platform.toUpperCase().indexOf("MAC") >=+ 0;+ const isMultiSelect = isMac+ ? upEvent.metaKey+ : upEvent.ctrlKey;+ const isRangeSelect = upEvent.shiftKey;- props.handleUpdatePlayhead(e);- });+ if (+ isRangeSelect &&+ selection &&+ selection.type === "clip"+ ) {+ // Range selection: select from last selected to current+ const existingIndices = selection.indices;+ const lastIndex =+ existingIndices[existingIndices.length - 1];+ const start = Math.min(lastIndex, currentIndex);+ const end = Math.max(lastIndex, currentIndex);+ const rangeIndices = Array.from(+ { length: end - start + 1 },+ (_, idx) => start + idx,+ );++ setEditorState("timeline", "selection", {+ type: "clip" as const,+ indices: rangeIndices,+ });+ } else if (+ isMultiSelect &&+ selection &&+ selection.type === "clip"+ ) {+ // Multi-select: toggle current index+ const existingIndices = selection.indices;++ if (existingIndices.includes(currentIndex)) {+ // Remove from selection+ const newIndices = existingIndices.filter(+ (idx) => idx !== currentIndex,+ );+ if (newIndices.length > 0) {+ setEditorState("timeline", "selection", {+ type: "clip" as const,+ indices: newIndices,+ });+ } else {+ setEditorState("timeline", "selection", null);+ }+ } else {+ // Add to selection+ setEditorState("timeline", "selection", {+ type: "clip" as const,+ indices: [...existingIndices, currentIndex],+ });+ }+ } else {+ // Normal single selection+ setEditorState("timeline", "selection", {+ type: "clip" as const,+ indices: [currentIndex],+ });+ }++ props.handleUpdatePlayhead(upEvent);+ },+ );});}}}diff --git a/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx b/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsxindex faa668e39..3d785fb14 100644--- a/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx+++ b/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx@@ -230,17 +230,78 @@ export function SceneTrack(props: {function finish(e: MouseEvent) {resumeHistory();++ const currentIndex = i();+ const selection = editorState.timeline.selection;+ const isMac =+ navigator.platform.toUpperCase().indexOf("MAC") >= 0;+ const isMultiSelect = isMac ? e.metaKey : e.ctrlKey;+ const isRangeSelect = e.shiftKey;+if (!moved) {e.stopPropagation();- setEditorState("timeline", "selection", {- type: "scene",- index: i(),- });++ if (+ isRangeSelect &&+ selection &&+ selection.type === "scene"+ ) {+ // Range selection: select from last selected to current+ const existingIndices = selection.indices;+ const lastIndex =+ existingIndices[existingIndices.length - 1];+ const start = Math.min(lastIndex, currentIndex);+ const end = Math.max(lastIndex, currentIndex);+ const rangeIndices = Array.from(+ { length: end - start + 1 },+ (_, idx) => start + idx,+ );++ setEditorState("timeline", "selection", {+ type: "scene" as const,+ indices: rangeIndices,+ });+ } else if (+ isMultiSelect &&+ selection &&+ selection.type === "scene"+ ) {+ // Multi-select: toggle current index+ const existingIndices = selection.indices;++ if (existingIndices.includes(currentIndex)) {+ // Remove from selection+ const newIndices = existingIndices.filter(+ (idx) => idx !== currentIndex,+ );+ if (newIndices.length > 0) {+ setEditorState("timeline", "selection", {+ type: "scene" as const,+ indices: newIndices,+ });+ } else {+ setEditorState("timeline", "selection", null);+ }+ } else {+ // Add to selection+ setEditorState("timeline", "selection", {+ type: "scene" as const,+ indices: [...existingIndices, currentIndex],+ });+ }+ } else {+ // Normal single selection+ setEditorState("timeline", "selection", {+ type: "scene" as const,+ indices: [currentIndex],+ });+ }+props.handleUpdatePlayhead(e);} else {setEditorState("timeline", "selection", {- type: "scene",- index: i(),+ type: "scene" as const,+ indices: [currentIndex],});}props.onDragStateChanged({ type: "idle" });@@ -286,7 +347,9 @@ export function SceneTrack(props: {(s) => s.start === segment.start && s.end === segment.end,);- return segmentIndex === selection.index;+ if (segmentIndex === undefined || segmentIndex === -1) return false;++ return selection.indices.includes(segmentIndex);});return (diff --git a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsxindex 6a6914840..1d476bdf8 100644--- a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx+++ b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx@@ -314,29 +314,42 @@ export function ZoomTrack(props: {const currentSelection = editorState.timeline.selection;const segmentIndex = i();+ const isMultiSelect = e.ctrlKey || e.metaKey;+ const isRangeSelect = e.shiftKey;++ if (isRangeSelect && currentSelection?.type === "zoom") {+ // Range selection: select from last selected to current+ const existingIndices = currentSelection.indices;+ const lastIndex =+ existingIndices[existingIndices.length - 1];+ const start = Math.min(lastIndex, segmentIndex);+ const end = Math.max(lastIndex, segmentIndex);+ const rangeIndices: number[] = [];+ for (let idx = start; idx <= end; idx++) {+ rangeIndices.push(idx);+ }- // Handle multi-selection with Ctrl/Cmd+click- if (e.ctrlKey || e.metaKey) {+ setEditorState("timeline", "selection", {+ type: "zoom",+ indices: rangeIndices,+ });+ } else if (isMultiSelect) {+ // Handle multi-selection with Ctrl/Cmd+clickif (currentSelection?.type === "zoom") {- // Normalize to indices[] from either indices[] or legacy index- const baseIndices =- "indices" in currentSelection &&- Array.isArray(currentSelection.indices)- ? currentSelection.indices- : "index" in currentSelection &&- typeof currentSelection.index === "number"- ? [currentSelection.index]- : [];-+ const baseIndices = currentSelection.indices;const exists = baseIndices.includes(segmentIndex);const newIndices = exists? baseIndices.filter((idx) => idx !== segmentIndex): [...baseIndices, segmentIndex];- setEditorState("timeline", "selection", {- type: "zoom",- indices: newIndices,- });+ if (newIndices.length > 0) {+ setEditorState("timeline", "selection", {+ type: "zoom",+ indices: newIndices,+ });+ } else {+ setEditorState("timeline", "selection", null);+ }} else {// Start new multi-selectionsetEditorState("timeline", "selection", {@@ -345,6 +358,7 @@ export function ZoomTrack(props: {});}} else {+ // Normal single selectionsetEditorState("timeline", "selection", {type: "zoom",indices: [segmentIndex],@@ -396,20 +410,9 @@ export function ZoomTrack(props: {);// Support both single selection (index) and multi-selection (indices)- if (- "indices" in selection &&- Array.isArray(selection.indices) &&- segmentIndex !== undefined- ) {- return selection.indices.includes(segmentIndex);- } else if (- "index" in selection &&- typeof selection.index === "number"- ) {- return segmentIndex === selection.index;- }+ if (segmentIndex === undefined || segmentIndex === -1) return false;- return false;+ return selection.indices.includes(segmentIndex);});return (diff --git a/apps/desktop/src/routes/editor/Timeline/index.tsx b/apps/desktop/src/routes/editor/Timeline/index.tsxindex 3c7cb52e6..4f849a0f8 100644--- a/apps/desktop/src/routes/editor/Timeline/index.tsx+++ b/apps/desktop/src/routes/editor/Timeline/index.tsx@@ -141,9 +141,19 @@ export function Timeline() {if (selection.type === "zoom") {projectActions.deleteZoomSegments(selection.indices);} else if (selection.type === "clip") {- projectActions.deleteClipSegment(selection.index);+ // Delete all selected clips in reverse order+ [...selection.indices]+ .sort((a, b) => b - a)+ .forEach((idx) => {+ projectActions.deleteClipSegment(idx);+ });} else if (selection.type === "scene") {- projectActions.deleteSceneSegment(selection.index);+ // Delete all selected scenes in reverse order+ [...selection.indices]+ .sort((a, b) => b - a)+ .forEach((idx) => {+ projectActions.deleteSceneSegment(idx);+ });}} else if (e.code === "KeyC" && hasNoModifiers) {// Allow cutting while playing: use playbackTime when previewTime is nulldiff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.tsindex cb60f644a..3e3e443cb 100644--- a/apps/desktop/src/routes/editor/context.ts+++ b/apps/desktop/src/routes/editor/context.ts@@ -297,8 +297,8 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(selection: null as| null| { type: "zoom"; indices: number[] }- | { type: "clip"; index: number }- | { type: "scene"; index: number },+ | { type: "clip"; indices: number[] }+ | { type: "scene"; indices: number[] },transform: {// visible secondszoom: zoomOutLimit(),