Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(cursor): pick the cursor types drawn as recorded, 3D under the styles
EtienneLescot738b678c38b8
diff --git a/electron/ai-edition/style-preset-service.test.ts b/electron/ai-edition/style-preset-service.test.tsindex b7bc7fd56..f732f538a 100644--- a/electron/ai-edition/style-preset-service.test.ts+++ b/electron/ai-edition/style-preset-service.test.ts@@ -32,7 +32,7 @@ const APPEARANCE: StylePresetAppearance = {motionBlur: 0.35,clickBounce: 1,model3d: false,- alwaysArrow: false,+ asArrow: [],clickImpact: false,},cursorShow: true,diff --git a/electron/ipc/nativeBridge.presets.test.ts b/electron/ipc/nativeBridge.presets.test.tsindex 8183140e4..a048e877b 100644--- a/electron/ipc/nativeBridge.presets.test.ts+++ b/electron/ipc/nativeBridge.presets.test.ts@@ -52,7 +52,7 @@ const APPEARANCE: StylePresetAppearance = {motionBlur: 0.35,clickBounce: 1,model3d: false,- alwaysArrow: false,+ asArrow: [],clickImpact: false,},cursorShow: true,diff --git a/electron/native-bridge/services/compositorViewService.test.ts b/electron/native-bridge/services/compositorViewService.test.tsindex 46e4beb28..eee8fe305 100644--- a/electron/native-bridge/services/compositorViewService.test.ts+++ b/electron/native-bridge/services/compositorViewService.test.ts@@ -540,17 +540,26 @@ describe("resolveSceneAssetPaths", () => {expect(Object.keys(sprites).sort()).toEqual(Object.keys(DEFAULT_CURSOR_SPRITES).sort());});- it("draws every cursor state with the arrow when alwaysArrow is on", () => {- const sprites = resolved({ cursor: { theme: "default", alwaysArrow: true } }).cursor+ it("draws the kinds the scene names with the arrow, and only those", () => {+ const sprites = resolved({ cursor: { theme: "default", asArrow: ["text", "resize"] } }).cursor.cursorSprites;expect(Object.keys(sprites).sort()).toEqual(Object.keys(DEFAULT_CURSOR_SPRITES).sort());- for (const [type, sprite] of Object.entries<ResolvedSprite>(sprites)) {- expect(sprite, type).toEqual(sprites.arrow);+ for (const type of ["text", "resize-ew", "resize-ns", "resize-nwse", "resize-nesw", "move"]) {+ expect(sprites[type], type).toEqual(sprites.arrow);}+ expect(sprites.pointer.path).toBe(path.join(resources, "cursors", "default", "pointer.png"));expect(sprites.arrow.path).toBe(path.join(resources, "cursors", "default", "arrow.png"));});+ // The scene is JSON from the renderer: a kind this build does not know changes nothing.+ it("ignores a cursor kind it does not know", () => {+ const sprites = resolved({ cursor: { theme: "default", asArrow: ["sparkles", 3] } }).cursor+ .cursorSprites;++ expect(sprites.text.path).toBe(path.join(resources, "cursors", "default", "text.png"));+ });+it("carries each sprite's hotspot as a fraction of its own image", () => {const sprites = resolved({ cursor: { theme: "default" } }).cursor.cursorSprites;diff --git a/electron/native-bridge/services/compositorViewService.ts b/electron/native-bridge/services/compositorViewService.tsindex 2725cd0ae..ccf01c723 100644--- a/electron/native-bridge/services/compositorViewService.ts+++ b/electron/native-bridge/services/compositorViewService.ts@@ -3,7 +3,11 @@ import { createRequire } from "node:module";import path from "node:path";import { fileURLToPath } from "node:url";import { app } from "electron";-import { resolveCursorSprites } from "../../../src/lib/cursor/cursorThemes";+import {+ type CursorKind,+ readCursorAsArrow,+ resolveCursorSprites,+} from "../../../src/lib/cursor/cursorThemes";import type { GifExportJob } from "../../ipc/gifExportJobs";import type {ClipInput,@@ -101,16 +105,14 @@ export function resolveSceneAssetPath(relativePath: string): string | null {*/function resolveCursorSpritePaths(themeId: string,- alwaysArrow: boolean,+ asArrow: readonly CursorKind[],model3d = false,): Record<string, { path: string; hotspotX: number; hotspotY: number; sculpt?: string }> {const resolved: Record<string,{ path: string; hotspotX: number; hotspotY: number; sculpt?: string }> = {};- for (const [type, sprite] of Object.entries(- resolveCursorSprites(themeId, alwaysArrow, model3d),- )) {+ for (const [type, sprite] of Object.entries(resolveCursorSprites(themeId, asArrow, model3d))) {const absolute = resolveSceneAssetPath(sprite.assetPath);if (absolute) {resolved[type] = {@@ -135,7 +137,7 @@ export function resolveSceneAssetPaths(sceneJson: string): string {background?: { kind?: string; path?: string };cursor?: {theme?: string;- alwaysArrow?: boolean;+ asArrow?: unknown;model3d?: boolean;cursorSprites?: Record<string,@@ -174,7 +176,7 @@ export function resolveSceneAssetPaths(sceneJson: string): string {if (scene.cursor && typeof scene.cursor.theme === "string") {scene.cursor.cursorSprites = resolveCursorSpritePaths(scene.cursor.theme,- scene.cursor.alwaysArrow === true,+ readCursorAsArrow(scene.cursor.asArrow),scene.cursor.model3d === true,);changed = true;diff --git a/src/components/ai-edition/CursorPane.levels.test.tsx b/src/components/ai-edition/CursorPane.levels.test.tsxindex 4d5807260..5074a08f0 100644--- a/src/components/ai-edition/CursorPane.levels.test.tsx+++ b/src/components/ai-edition/CursorPane.levels.test.tsx@@ -1,10 +1,11 @@// @vitest-environment jsdom-import { cleanup, fireEvent, render, screen } from "@testing-library/react";-import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { I18nProvider } from "@/contexts/I18nContext";import { LOCALE_STORAGE_KEY } from "@/i18n/config";-import { createEmptyDocument } from "@/lib/ai-edition/schema";+import { assetSchema, clipSchema, createEmptyDocument } from "@/lib/ai-edition/schema";import { useProjectStore } from "@/lib/ai-edition/store/projectStore";+import { type NativeCursorType, nativeBridgeClient } from "@/native";import { CursorPane } from "./RightPanes";beforeEach(() => {@@ -54,6 +55,96 @@ describe("CursorPane named levels", () => {});});+describe("CursorPane cursor types", () => {+ /** A one-clip project over a recording whose cursor walks through `states`, 100 ms each. */+ function renderWithRecording(+ legacyEditor: Record<string, unknown>,+ states: Array<NativeCursorType | null>,+ ) {+ // A path per test: the pane reads each recording once per session.+ const originalPath = `/recordings/${crypto.randomUUID()}.mp4`;+ vi.spyOn(nativeBridgeClient.cursor, "getRecordingData").mockResolvedValue({+ version: 2,+ provider: "native",+ assets: [],+ samples: states.map((cursorType, i) => ({ timeMs: i * 100, cx: 0.5, cy: 0.5, cursorType })),+ });+ vi.spyOn(nativeBridgeClient.aiEdition, "save").mockImplementation(async (document) => ({+ success: true,+ document,+ }));+ const document = createEmptyDocument({ projectId: "p", title: "t" });+ const asset = assetSchema.parse({ id: "a", label: "take", originalPath });+ const clip = clipSchema.parse({+ id: "c",+ assetId: "a",+ sourceStartSec: 0,+ sourceEndSec: 10,+ timelineStartSec: 0,+ timelineEndSec: 10,+ origin: "user",+ });+ useProjectStore.setState({+ projectId: "p",+ document: {+ ...document,+ assets: [asset],+ timeline: { ...document.timeline, clips: [clip] },+ legacyEditor,+ },+ });+ render(+ <I18nProvider>+ <CursorPane />+ </I18nProvider>,+ );+ }++ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("offers only the cursors the video shows, lit until drawn as the arrow", async () => {+ renderWithRecording({ cursorAsArrow: ["text"] }, ["arrow", "pointer", "text", null]);+ const group = await screen.findByRole("group", { name: "Cursor types" });+ const buttons = [...group.querySelectorAll("button")];+ expect(+ buttons.map((b) => [b.getAttribute("aria-label"), b.getAttribute("aria-pressed")]),+ ).toEqual([+ ["Hand", "true"],+ ["Text", "false"],+ ]);+ // The arrow is what the others become: shown, never a switch.+ expect(within(group).getByRole("img", { name: "Arrow" }).tagName).toBe("SPAN");+ });++ it("draws a type as the arrow on a click, and as recorded on the next", async () => {+ renderWithRecording({}, ["arrow", "resize-ns", "pointer"]);+ const resize = await screen.findByRole("button", { name: "Resize" });+ fireEvent.click(resize);+ const asArrow = () => useProjectStore.getState().document?.legacyEditor?.cursorAsArrow;+ expect(asArrow()).toEqual(["resize"]);+ fireEvent.click(screen.getByRole("button", { name: "Hand" }));+ expect(asArrow()).toEqual(["pointer", "resize"]);+ fireEvent.click(screen.getByRole("button", { name: "Resize" }));+ expect(asArrow()).toEqual(["pointer"]);+ });++ it("offers nothing to redraw when the video only shows the arrow", async () => {+ renderWithRecording({}, ["arrow", null]);+ await waitFor(() => expect(nativeBridgeClient.cursor.getRecordingData).toHaveBeenCalled());+ expect(screen.queryByRole("group", { name: "Cursor types" })).toBeNull();+ });++ // The 3D switch changes how the chosen style looks, so it sits right under the styles.+ it("puts the 3D switch right under the cursor styles", () => {+ renderWithCursor({});+ const styleLabel = screen.getByText("Cursor style");+ const grid = styleLabel.nextElementSibling;+ expect(grid?.nextElementSibling?.textContent).toBe("3D cursor");+ });+});+describe("CursorPane size", () => {// Named steps stopped at 2.75; people asked for at least twice that.it("is a slider from the default up to four times it", () => {diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.cssindex fdac902c9..e2892b6f1 100644--- a/src/components/ai-edition/NewEditorShell.module.css+++ b/src/components/ai-edition/NewEditorShell.module.css@@ -1446,6 +1446,13 @@ textarea.control {background: var(--accent-soft);color: var(--fg);}+/* The cursor types (CursorPane): a dimmed type is drawn as the arrow. The arrow's own cell is not+ a control, it is what the others become. */+.cursorCellOff img { opacity: 0.35; transition: opacity 150ms ease; }+.cursorCellOff:hover:not(:disabled) img { opacity: 0.7; }+.cursorCellFixed { cursor: default; }+/* A row that belongs to the grid right above it: the 3D switch under the cursor style. */+.paneRowTight { margin-top: calc(-1 * var(--sp-2)); }/* Same cell, reused for the icon+label rows (camera shape, camera background).`minmax(0, 1fr)` stopped a long label from pushing the grid, but the text stillspilled over the button's own border and crowded its neighbour -- « Personnalisé »,diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex de03769a4..e48823a6a 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -108,8 +108,12 @@ import {import { getAssetPath } from "@/lib/assetPath";import { resolveWebcamLayoutPreset, supportsWebcamReactiveZoom } from "@/lib/compositeLayout";import {+ CURSOR_KIND_IDS,+ CURSOR_KINDS,CURSOR_THEMES,+ type CursorKind,DEFAULT_CURSOR_THEME_ID,+ resolveCursorSprites,themePickerPreviewAssets,} from "@/lib/cursor/cursorThemes";import { gradientSeedColor, oneColorGradient } from "@/lib/gradientBuilder";@@ -147,6 +151,7 @@ import { CaptionsPane } from "./CaptionsPane";import { ColorField } from "./ColorField";import { insertionsEnabled } from "./insertionsEnabled";import styles from "./NewEditorShell.module.css";+import { useRecordedCursorTypes } from "./recordedCursorTypes";import { useTranscriptionLabel } from "./TranscriptionStatus";import { transcriptionBusyLabel } from "./transcriptionBusyLabel";@@ -3668,6 +3673,29 @@ export function CursorPane() {[ts],);+ // What the preview draws for each state: the theme's art, the built-in art where it has none.+ const cursorSprites = useMemo(+ () => resolveCursorSprites(settings.cursorTheme),+ [settings.cursorTheme],+ );+ const recordedTypes = useRecordedCursorTypes();+ // Each kind the video shows, pictured by the first of its states it shows.+ const recordedKinds = CURSOR_KIND_IDS.flatMap((kind) => {+ const type = CURSOR_KINDS[kind].find((state) => recordedTypes?.has(state));+ return type ? [{ kind, type }] : [];+ });+ const cursorKindLabels: Record<CursorKind, string> = {+ pointer: ts("cursor.typePointer"),+ text: ts("cursor.typeText"),+ grab: ts("cursor.typeGrab"),+ resize: ts("cursor.typeResize"),+ busy: ts("cursor.typeBusy"),+ crosshair: ts("cursor.typeCrosshair"),+ "not-allowed": ts("cursor.typeNotAllowed"),+ help: ts("cursor.typeHelp"),+ "up-arrow": ts("cursor.typeUpArrow"),+ };+return (<Panetitle={ts("cursor.title")}@@ -3702,43 +3730,17 @@ export function CursorPane() {}}/></div>- {/* A hidden cursor has nothing to model, restyle or click with, so these rows are not- offered then. */}+ {/* A hidden cursor has nothing to click with, so this row is not offered then. */}{settings.cursorShow ? (- <>- <div className={styles.paneRow}>- <span className={styles.label}>{ts("cursor.model3d")}</span>- <Toggle- ariaLabel={ts("cursor.model3d")}- checked={settings.cursor.model3d}- disabled={!hasDocument}- onChange={(v) => {- void set({ cursor: { model3d: v } });- if (isNativeCompositorActive()) {- setNativeParam("cursorModel3d", v);- }- }}- />- </div>- <div className={styles.paneRow}>- <span className={styles.label}>{ts("cursor.alwaysArrow")}</span>- <Toggle- ariaLabel={ts("cursor.alwaysArrow")}- checked={settings.cursor.alwaysArrow}- disabled={!hasDocument}- onChange={(v) => void set({ cursor: { alwaysArrow: v } })}- />- </div>- <div className={styles.paneRow}>- <span className={styles.label}>{ts("cursor.clickImpact")}</span>- <Toggle- ariaLabel={ts("cursor.clickImpact")}- checked={settings.cursor.clickImpact}- disabled={!hasDocument}- onChange={(v) => void set({ cursor: { clickImpact: v } })}- />- </div>- </>+ <div className={styles.paneRow}>+ <span className={styles.label}>{ts("cursor.clickImpact")}</span>+ <Toggle+ ariaLabel={ts("cursor.clickImpact")}+ checked={settings.cursor.clickImpact}+ disabled={!hasDocument}+ onChange={(v) => void set({ cursor: { clickImpact: v } })}+ />+ </div>) : null}{/* One option is not a choice: the picker shows once a pack ships beside thedefault art (see CURSOR_THEMES). */}@@ -3773,6 +3775,91 @@ export function CursorPane() {</div></>) : null}+ {/* A hidden cursor has nothing to model or redraw, so these rows are not offered then. */}+ {settings.cursorShow ? (+ <>+ <div className={`${styles.paneRow} ${styles.paneRowTight}`}>+ <span className={styles.label}>{ts("cursor.model3d")}</span>+ <Toggle+ ariaLabel={ts("cursor.model3d")}+ checked={settings.cursor.model3d}+ disabled={!hasDocument}+ onChange={(v) => {+ void set({ cursor: { model3d: v } });+ if (isNativeCompositorActive()) {+ setNativeParam("cursorModel3d", v);+ }+ }}+ />+ </div>+ {recordedKinds.length > 0 ? (+ <>+ <div className={styles.sectionLabel}>{ts("cursor.types")}</div>+ {/* The cursors the video shows, each drawn as recorded (lit) or as the arrow+ (dimmed). The arrow's own cell is not a control: it is what the others+ become. Space and Enter toggle the focused cell and stop there: the+ editor's shortcuts on `window` would also play the video. */}+ <div+ role="group"+ aria-label={ts("cursor.types")}+ className={styles.cursorGrid}+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") e.nativeEvent.stopPropagation();+ }}+ >+ <span+ role="img"+ aria-label={ts("cursor.typeArrow")}+ title={ts("cursor.typeArrow")}+ className={`${styles.cursorCell} ${styles.isActive} ${styles.cursorCellFixed}`}+ >+ <img+ src={safeAssetUrl(cursorSprites.arrow.assetPath)}+ alt=""+ width={20}+ height={20}+ draggable={false}+ style={{ objectFit: "contain", pointerEvents: "none" }}+ />+ </span>+ {recordedKinds.map(({ kind, type }) => {+ const shown = !settings.cursor.asArrow.includes(kind);+ const label = cursorKindLabels[kind];+ return (+ <button+ type="button"+ key={kind}+ className={`${styles.cursorCell} ${shown ? styles.isActive : styles.cursorCellOff}`}+ title={shown ? label : ts("cursor.typeAsArrow", { type: label })}+ aria-label={label}+ aria-pressed={shown}+ disabled={!hasDocument}+ onClick={() =>+ void set({+ cursor: {+ asArrow: CURSOR_KIND_IDS.filter((k) =>+ k === kind ? shown : settings.cursor.asArrow.includes(k),+ ),+ },+ })+ }+ >+ <img+ src={safeAssetUrl(cursorSprites[type].assetPath)}+ alt=""+ width={20}+ height={20}+ draggable={false}+ style={{ objectFit: "contain", pointerEvents: "none" }}+ />+ </button>+ );+ })}+ </div>+ </>+ ) : null}+ </>+ ) : null}<div className={styles.sliderGrid}>{/* A slider, not named steps: "a bit bigger" is a size between two of them.`SETTING_BOUNDS` keeps both ends sane. */}diff --git a/src/components/ai-edition/recordedCursorTypes.test.ts b/src/components/ai-edition/recordedCursorTypes.test.tsnew file mode 100644index 000000000..c20d80596--- /dev/null+++ b/src/components/ai-edition/recordedCursorTypes.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from "vitest";+import { cursorStateChanges, cursorStatesBetween } from "./recordedCursorTypes";++describe("cursorStateChanges", () => {+ it("keeps the changes only, and reads a sample with no state as the arrow", () => {+ expect(+ cursorStateChanges([+ { timeMs: 0, cursorType: null },+ { timeMs: 33, cursorType: "arrow" },+ { timeMs: 66, cursorType: "text" },+ { timeMs: 99, cursorType: "text" },+ { timeMs: 132 },+ ]),+ ).toEqual([+ { timeMs: 0, type: "arrow" },+ { timeMs: 66, type: "text" },+ { timeMs: 132, type: "arrow" },+ ]);+ });+});++describe("cursorStatesBetween", () => {+ const changes = cursorStateChanges([+ { timeMs: 1000, cursorType: "pointer" },+ { timeMs: 2000, cursorType: "text" },+ { timeMs: 3000, cursorType: "resize-ew" },+ ]);++ it("counts the state in force at the start and each change up to the end", () => {+ expect(cursorStatesBetween(changes, 1500, 2500)).toEqual(new Set(["pointer", "text"]));+ });++ // A clip trimmed past a state never puts it on screen.+ it("leaves out what comes after the end", () => {+ expect(cursorStatesBetween(changes, 0, 1500)).toEqual(new Set(["arrow", "pointer"]));+ expect(cursorStatesBetween(changes, 3500, 9000)).toEqual(new Set(["resize-ew"]));+ });+});diff --git a/src/components/ai-edition/recordedCursorTypes.ts b/src/components/ai-edition/recordedCursorTypes.tsnew file mode 100644index 000000000..032d82b32--- /dev/null+++ b/src/components/ai-edition/recordedCursorTypes.ts@@ -0,0 +1,102 @@+import { useEffect, useState } from "react";+import type { AxcutDocument } from "@/lib/ai-edition/schema";+import { useProjectStore } from "@/lib/ai-edition/store/projectStore";+import { resolveClipSourceEndSec } from "@/lib/ai-edition/timeline/clipDuration";+import { nativeBridgeClient } from "@/native";++interface CursorStateChange {+ timeMs: number;+ type: string;+}++/**+ * A recording's cursor states the way the compositor reads them (`CursorTrack::load`): the+ * changes only, and a sample without a state means the arrow.+ */+export function cursorStateChanges(+ samples: ReadonlyArray<{ timeMs: number; cursorType?: string | null }>,+): CursorStateChange[] {+ const changes: CursorStateChange[] = [];+ for (const { timeMs, cursorType } of samples) {+ const type = cursorType || "arrow";+ if (changes.at(-1)?.type !== type) changes.push({ timeMs, type });+ }+ return changes;+}++/** The states on screen from `startMs` to `endMs`: the one in force at the start, then every+ * change up to the end. */+export function cursorStatesBetween(+ changes: readonly CursorStateChange[],+ startMs: number,+ endMs: number,+): Set<string> {+ const states = new Set<string>();+ let atStart = "arrow";+ for (const { timeMs, type } of changes) {+ if (timeMs > endMs) break;+ if (timeMs <= startMs) atStart = type;+ else states.add(type);+ }+ return states.add(atStart);+}++// A recording's cursor file does not change once written: each is read once per session.+const changesByPath = new Map<string, Promise<CursorStateChange[]>>();++function stateChangesOf(videoPath: string): Promise<CursorStateChange[]> {+ let changes = changesByPath.get(videoPath);+ if (!changes) {+ changes = Promise.resolve()+ .then(() => nativeBridgeClient.cursor.getRecordingData(videoPath))+ .then((data) => cursorStateChanges(data.samples))+ // No cursor file, or no bridge: nothing but the arrow.+ .catch(() => []);+ changesByPath.set(videoPath, changes);+ }+ return changes;+}++/** Each clip as its recording and the stretch of it the timeline plays, in ms. */+function clipSourceRanges(document: AxcutDocument | null): Array<[string, number, number]> {+ if (!document) return [];+ return document.timeline.clips.flatMap((clip) => {+ const asset = document.assets.find((a) => a.id === clip.assetId);+ if (!asset || asset.kind !== "video") return [];+ const range: [string, number, number] = [+ asset.originalPath,+ clip.sourceStartSec * 1000,+ resolveClipSourceEndSec(clip, asset) * 1000,+ ];+ return [range];+ });+}++/**+ * Every cursor state the timeline's clips put on screen, or `null` while their recordings are+ * read. The cursor pane offers to redraw these and nothing else: a choice about a cursor the+ * video never shows would change nothing.+ *+ * ponytail: a state seen only inside a cut still counts; subtract the cuts if that ever leaves a+ * choice that changes nothing.+ */+export function useRecordedCursorTypes(): ReadonlySet<string> | null {+ // A string, so the recordings are read again when a clip changes, not on every other edit.+ const rangesJson = useProjectStore((s) => JSON.stringify(clipSourceRanges(s.document)));+ const [types, setTypes] = useState<ReadonlySet<string> | null>(null);+ useEffect(() => {+ let cancelled = false;+ const ranges = JSON.parse(rangesJson) as Array<[string, number, number]>;+ void Promise.all(+ ranges.map(async ([videoPath, startMs, endMs]) =>+ cursorStatesBetween(await stateChangesOf(videoPath), startMs, endMs),+ ),+ ).then((perClip) => {+ if (!cancelled) setTypes(new Set(perClip.flatMap((states) => [...states])));+ });+ return () => {+ cancelled = true;+ };+ }, [rangesJson]);+ return types;+}diff --git a/src/components/video-editor/editorDefaults.ts b/src/components/video-editor/editorDefaults.tsindex e1b770597..13afdb5d5 100644--- a/src/components/video-editor/editorDefaults.ts+++ b/src/components/video-editor/editorDefaults.ts@@ -82,7 +82,7 @@ export const DEFAULT_CURSOR_SETTINGS: CursorVisualSettings & { show: boolean; thmotionBlur: DEFAULT_CURSOR_MOTION_BLUR,clickBounce: DEFAULT_CURSOR_CLICK_BOUNCE,model3d: DEFAULT_CURSOR_MODEL3D,- alwaysArrow: false,+ asArrow: [],clickImpact: false,theme: DEFAULT_CURSOR_THEME_ID,};diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.tsindex 52d5934ad..9977eac3c 100644--- a/src/components/video-editor/projectPersistence.ts+++ b/src/components/video-editor/projectPersistence.ts@@ -1,6 +1,10 @@import { normalizeTextAnimation } from "@/lib/annotationTextAnimation";import { normalizeBlurColor, normalizeBlurType } from "@/lib/blurEffects";-import { normalizeCursorThemeId } from "@/lib/cursor/cursorThemes";+import {+ type CursorKind,+ normalizeCursorThemeId,+ readCursorAsArrow,+} from "@/lib/cursor/cursorThemes";import type { ExportFormat, ExportQuality, GifFrameRate, GifSizePreset } from "@/lib/exporter";import {DEFAULT_PROJECT_APPEARANCE,@@ -114,6 +118,8 @@ export interface ProjectEditorState {cursorSmoothing?: number;cursorMotionBlur?: number;cursorClickBounce?: number;+ cursorAsArrow?: CursorKind[];+ /** The one switch before `cursorAsArrow`; `getEditorSettings` reads it as every kind. */cursorAlwaysArrow?: boolean;// Same reason as the cursor keys above. `window-light` / `window-dark` are kept as stored:// `getEditorSettings` splits them into a frame and a theme (`readRecordingFrame`).@@ -505,6 +511,9 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro...(isFiniteNumber(editor.cursorClickBounce)? { cursorClickBounce: editor.cursorClickBounce }: {}),+ ...(editor.cursorAsArrow !== undefined+ ? { cursorAsArrow: readCursorAsArrow(editor.cursorAsArrow) }+ : {}),...(typeof editor.cursorAlwaysArrow === "boolean"? { cursorAlwaysArrow: editor.cursorAlwaysArrow }: {}),diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.tsindex 78a6807eb..ec98991a3 100644--- a/src/components/video-editor/types.ts+++ b/src/components/video-editor/types.ts@@ -4,6 +4,7 @@ import {type ZoomScaleInput,} from "@/lib/ai-edition/timeline/zoom-scale";import type { WebcamLayoutPreset } from "@/lib/compositeLayout";+import type { CursorKind } from "@/lib/cursor/cursorThemes";import { DEFAULT_PROJECT_APPEARANCE, SETTING_BOUNDS } from "@/lib/projectDefaults";import { clamp01 } from "@/utils/math";@@ -286,8 +287,8 @@ export interface CursorVisualSettings {* each click; pointing shapes also lean towards their motion. Other themes stay flat sprites.*/model3d: boolean;- /** Draws every cursor state (text, hand, resize…) with the theme's arrow sprite. */- alwaysArrow: boolean;+ /** The kinds drawn with the theme's arrow instead of their own sprite (`CURSOR_KINDS`). */+ asArrow: CursorKind[];/*** Each click gives the screen an impact, whatever the zoom's camera: a fixed angle rocks the* tilted screen toward the clicked side, the moving camera recoils, a flat screen is pusheddiff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.jsonindex 3f7daf9df..c88154d57 100644--- a/src/i18n/locales/ar/settings.json+++ b/src/i18n/locales/ar/settings.json@@ -411,7 +411,18 @@"title": "المؤشر","show": "إظهار المؤشر","themeDefault": "افتراضي",- "alwaysArrow": "استخدام السهم دائمًا",+ "types": "أنواع المؤشر",+ "typeArrow": "سهم",+ "typePointer": "يد",+ "typeText": "نص",+ "typeGrab": "إمساك",+ "typeResize": "تغيير الحجم",+ "typeBusy": "مشغول",+ "typeCrosshair": "تقاطع",+ "typeNotAllowed": "غير متاح",+ "typeHelp": "تعليمات",+ "typeUpArrow": "تحديد بديل",+ "typeAsArrow": "{{type}}: يُعرض كسهم","motionBlur": "ضبابية الحركة","theme": "نمط المؤشر","autoHide": "إخفاء عند عدم النشاط",diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.jsonindex 7fc41fa8b..c806893dd 100644--- a/src/i18n/locales/cs/settings.json+++ b/src/i18n/locales/cs/settings.json@@ -411,7 +411,18 @@"title": "Kurzor","show": "Zobrazit kurzor","themeDefault": "Výchozí",- "alwaysArrow": "Vždy používat kurzor šipky",+ "types": "Typy kurzoru",+ "typeArrow": "Šipka",+ "typePointer": "Ruka",+ "typeText": "Text",+ "typeGrab": "Uchopení",+ "typeResize": "Změna velikosti",+ "typeBusy": "Zaneprázdněno",+ "typeCrosshair": "Zaměřovač",+ "typeNotAllowed": "Nedostupné",+ "typeHelp": "Nápověda",+ "typeUpArrow": "Alternativní výběr",+ "typeAsArrow": "{{type}}: místo něj šipka","motionBlur": "Pohybové rozmazání","theme": "Styl kurzoru","autoHide": "Automaticky skrýt, když je neaktivní",diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.jsonindex c78163a73..72960d051 100644--- a/src/i18n/locales/de/settings.json+++ b/src/i18n/locales/de/settings.json@@ -411,7 +411,18 @@"title": "Cursor","show": "Cursor anzeigen","themeDefault": "Standard",- "alwaysArrow": "Immer Pfeil-Cursor verwenden",+ "types": "Cursortypen",+ "typeArrow": "Pfeil",+ "typePointer": "Hand",+ "typeText": "Text",+ "typeGrab": "Greifen",+ "typeResize": "Größe ändern",+ "typeBusy": "Beschäftigt",+ "typeCrosshair": "Fadenkreuz",+ "typeNotAllowed": "Nicht verfügbar",+ "typeHelp": "Hilfe",+ "typeUpArrow": "Alternative Auswahl",+ "typeAsArrow": "{{type}}: wird als Pfeil gezeigt","motionBlur": "Bewegungsunschärfe","theme": "Cursor-Stil","autoHide": "Bei Inaktivität ausblenden",diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.jsonindex c73f7d27d..db292b6d5 100644--- a/src/i18n/locales/en/settings.json+++ b/src/i18n/locales/en/settings.json@@ -411,7 +411,18 @@"title": "Cursor","show": "Show cursor","themeDefault": "Default",- "alwaysArrow": "Always use arrow cursor",+ "types": "Cursor types",+ "typeArrow": "Arrow",+ "typePointer": "Hand",+ "typeText": "Text",+ "typeGrab": "Grab",+ "typeResize": "Resize",+ "typeBusy": "Busy",+ "typeCrosshair": "Crosshair",+ "typeNotAllowed": "Not allowed",+ "typeHelp": "Help",+ "typeUpArrow": "Alternate select",+ "typeAsArrow": "{{type}}: replaced by the arrow","motionBlur": "Motion blur","theme": "Cursor style","autoHide": "Auto-hide when inactive",diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.jsonindex c3e45ed32..bba009eaa 100644--- a/src/i18n/locales/es/settings.json+++ b/src/i18n/locales/es/settings.json@@ -411,7 +411,18 @@"title": "Cursor","show": "Mostrar cursor","themeDefault": "Predeterminado",- "alwaysArrow": "Usar siempre el cursor de flecha",+ "types": "Tipos de cursor",+ "typeArrow": "Flecha",+ "typePointer": "Mano",+ "typeText": "Texto",+ "typeGrab": "Agarrar",+ "typeResize": "Cambiar tamaño",+ "typeBusy": "Ocupado",+ "typeCrosshair": "Precisión",+ "typeNotAllowed": "No disponible",+ "typeHelp": "Ayuda",+ "typeUpArrow": "Selección alternativa",+ "typeAsArrow": "{{type}}: se muestra la flecha","motionBlur": "Desenfoque de movimiento","theme": "Estilo del cursor","autoHide": "Ocultar si está inactivo",diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.jsonindex 19d292f9b..f223a1f07 100644--- a/src/i18n/locales/fr/settings.json+++ b/src/i18n/locales/fr/settings.json@@ -411,7 +411,18 @@"title": "Curseur","show": "Afficher le curseur","themeDefault": "Par défaut",- "alwaysArrow": "Toujours utiliser la flèche",+ "types": "Types de curseur",+ "typeArrow": "Flèche",+ "typePointer": "Main",+ "typeText": "Texte",+ "typeGrab": "Saisie",+ "typeResize": "Redimensionnement",+ "typeBusy": "Occupé",+ "typeCrosshair": "Précision",+ "typeNotAllowed": "Non disponible",+ "typeHelp": "Aide",+ "typeUpArrow": "Autre sélection",+ "typeAsArrow": "{{type}} : la flèche à la place","motionBlur": "Flou de mouvement","theme": "Style du curseur","autoHide": "Masquer si inactif",diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.jsonindex e7c8b2a6e..2e884b185 100644--- a/src/i18n/locales/it/settings.json+++ b/src/i18n/locales/it/settings.json@@ -411,7 +411,18 @@"title": "Cursore","show": "Mostra cursore","themeDefault": "Predefinito",- "alwaysArrow": "Usa sempre il cursore a freccia",+ "types": "Tipi di cursore",+ "typeArrow": "Freccia",+ "typePointer": "Mano",+ "typeText": "Testo",+ "typeGrab": "Afferra",+ "typeResize": "Ridimensiona",+ "typeBusy": "Occupato",+ "typeCrosshair": "Mirino",+ "typeNotAllowed": "Non disponibile",+ "typeHelp": "Guida",+ "typeUpArrow": "Selezione alternativa",+ "typeAsArrow": "{{type}}: al suo posto la freccia","motionBlur": "Sfocatura movimento","theme": "Stile del cursore","autoHide": "Nascondi se inattivo",diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.jsonindex cace44f74..b91fe1d4a 100644--- a/src/i18n/locales/ja-JP/settings.json+++ b/src/i18n/locales/ja-JP/settings.json@@ -411,7 +411,18 @@"title": "カーソル","show": "カーソルを表示","themeDefault": "デフォルト",- "alwaysArrow": "常に矢印カーソルを使用",+ "types": "カーソルの種類",+ "typeArrow": "矢印",+ "typePointer": "手",+ "typeText": "テキスト",+ "typeGrab": "つかむ",+ "typeResize": "サイズ変更",+ "typeBusy": "待機中",+ "typeCrosshair": "十字",+ "typeNotAllowed": "利用不可",+ "typeHelp": "ヘルプ",+ "typeUpArrow": "代替選択",+ "typeAsArrow": "{{type}}:矢印で表示","motionBlur": "モーションブラー","theme": "カーソルのスタイル","autoHide": "非アクティブ時に非表示",diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.jsonindex 11b41220e..10e0151ec 100644--- a/src/i18n/locales/ko-KR/settings.json+++ b/src/i18n/locales/ko-KR/settings.json@@ -411,7 +411,18 @@"title": "커서","show": "커서 표시","themeDefault": "기본",- "alwaysArrow": "항상 화살표 커서 사용",+ "types": "커서 종류",+ "typeArrow": "화살표",+ "typePointer": "손",+ "typeText": "텍스트",+ "typeGrab": "잡기",+ "typeResize": "크기 조정",+ "typeBusy": "사용 중",+ "typeCrosshair": "십자선",+ "typeNotAllowed": "사용할 수 없음",+ "typeHelp": "도움말",+ "typeUpArrow": "대체 선택",+ "typeAsArrow": "{{type}}: 화살표로 표시","motionBlur": "모션 블러","theme": "커서 스타일","autoHide": "비활성 시 자동 숨김",diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.jsonindex a1f4b7122..2b7b5c0af 100644--- a/src/i18n/locales/pt-BR/settings.json+++ b/src/i18n/locales/pt-BR/settings.json@@ -411,7 +411,18 @@"title": "Cursor","show": "Mostrar cursor","themeDefault": "Padrão",- "alwaysArrow": "Sempre usar o cursor de seta",+ "types": "Tipos de cursor",+ "typeArrow": "Seta",+ "typePointer": "Mão",+ "typeText": "Texto",+ "typeGrab": "Agarrar",+ "typeResize": "Redimensionar",+ "typeBusy": "Ocupado",+ "typeCrosshair": "Precisão",+ "typeNotAllowed": "Indisponível",+ "typeHelp": "Ajuda",+ "typeUpArrow": "Seleção alternativa",+ "typeAsArrow": "{{type}}: a seta no lugar","motionBlur": "Desfoque de movimento","theme": "Estilo do cursor","autoHide": "Ocultar quando inativo",diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.jsonindex 31a105eff..d06ed0db7 100644--- a/src/i18n/locales/ru/settings.json+++ b/src/i18n/locales/ru/settings.json@@ -411,7 +411,18 @@"title": "Курсор","show": "Показывать курсор","themeDefault": "По умолчанию",- "alwaysArrow": "Всегда использовать стрелку",+ "types": "Типы курсора",+ "typeArrow": "Стрелка",+ "typePointer": "Рука",+ "typeText": "Текст",+ "typeGrab": "Захват",+ "typeResize": "Изменение размера",+ "typeBusy": "Занят",+ "typeCrosshair": "Перекрестие",+ "typeNotAllowed": "Недоступно",+ "typeHelp": "Справка",+ "typeUpArrow": "Альтернативный выбор",+ "typeAsArrow": "{{type}}: вместо него стрелка","motionBlur": "Размытие движения","theme": "Стиль курсора","autoHide": "Скрывать при неактивности",diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.jsonindex 1a1f2ba4f..998821208 100644--- a/src/i18n/locales/tr/settings.json+++ b/src/i18n/locales/tr/settings.json@@ -411,7 +411,18 @@"title": "İmleç","show": "İmleci Göster","themeDefault": "Varsayılan",- "alwaysArrow": "Her zaman ok imlecini kullan",+ "types": "İmleç türleri",+ "typeArrow": "Ok",+ "typePointer": "El",+ "typeText": "Metin",+ "typeGrab": "Tutma",+ "typeResize": "Yeniden boyutlandırma",+ "typeBusy": "Meşgul",+ "typeCrosshair": "Artı işareti",+ "typeNotAllowed": "Kullanılamaz",+ "typeHelp": "Yardım",+ "typeUpArrow": "Alternatif seçim",+ "typeAsArrow": "{{type}}: yerine ok gösterilir","motionBlur": "Hareket Bulanıklığı","theme": "İmleç Stili","autoHide": "Hareketsizken gizle",diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.jsonindex 57e93ce6c..b40f58c51 100644--- a/src/i18n/locales/vi/settings.json+++ b/src/i18n/locales/vi/settings.json@@ -411,7 +411,18 @@"title": "Con trỏ","show": "Hiện con trỏ","themeDefault": "Mặc định",- "alwaysArrow": "Luôn dùng con trỏ mũi tên",+ "types": "Loại con trỏ",+ "typeArrow": "Mũi tên",+ "typePointer": "Bàn tay",+ "typeText": "Văn bản",+ "typeGrab": "Nắm kéo",+ "typeResize": "Đổi kích thước",+ "typeBusy": "Đang bận",+ "typeCrosshair": "Chữ thập",+ "typeNotAllowed": "Không khả dụng",+ "typeHelp": "Trợ giúp",+ "typeUpArrow": "Chọn thay thế",+ "typeAsArrow": "{{type}}: hiển thị bằng mũi tên","motionBlur": "Làm mờ chuyển động","theme": "Kiểu con trỏ","autoHide": "Ẩn khi không hoạt động",diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonindex 101aab97d..aaa1cafaa 100644--- a/src/i18n/locales/zh-CN/settings.json+++ b/src/i18n/locales/zh-CN/settings.json@@ -411,7 +411,18 @@"title": "光标","show": "显示光标","themeDefault": "默认",- "alwaysArrow": "始终使用箭头光标",+ "types": "光标类型",+ "typeArrow": "箭头",+ "typePointer": "手形",+ "typeText": "文本",+ "typeGrab": "抓取",+ "typeResize": "调整大小",+ "typeBusy": "忙碌",+ "typeCrosshair": "十字准线",+ "typeNotAllowed": "不可用",+ "typeHelp": "帮助",+ "typeUpArrow": "候选",+ "typeAsArrow": "{{type}}:显示为箭头","motionBlur": "运动模糊","theme": "光标样式","autoHide": "闲置时隐藏",diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.jsonindex 782944603..4a802b0a3 100644--- a/src/i18n/locales/zh-TW/settings.json+++ b/src/i18n/locales/zh-TW/settings.json@@ -411,7 +411,18 @@"title": "游標","show": "顯示游標","themeDefault": "預設",- "alwaysArrow": "一律使用箭頭游標",+ "types": "游標類型",+ "typeArrow": "箭頭",+ "typePointer": "手形",+ "typeText": "文字",+ "typeGrab": "抓取",+ "typeResize": "調整大小",+ "typeBusy": "忙碌",+ "typeCrosshair": "十字準線",+ "typeNotAllowed": "無法使用",+ "typeHelp": "說明",+ "typeUpArrow": "替代選取",+ "typeAsArrow": "{{type}}:顯示為箭頭","motionBlur": "動態模糊","theme": "游標樣式","autoHide": "閒置時隱藏",diff --git a/src/lib/ai-edition/store/editorSettings.test.ts b/src/lib/ai-edition/store/editorSettings.test.tsindex 4ff9a89fb..afe28f1ef 100644--- a/src/lib/ai-edition/store/editorSettings.test.ts+++ b/src/lib/ai-edition/store/editorSettings.test.ts@@ -184,6 +184,16 @@ describe("patchEditorSettings", () => {expect(getEditorSettings(next).cursor.clickImpact).toBe(true);});+ it("stores the cursor kinds drawn as the arrow, and drops the switch they replace", () => {+ expect(getEditorSettings(baseDoc).cursor.asArrow).toEqual([]);+ const old = patchEditorSettings(baseDoc, {});+ old.legacyEditor = { ...old.legacyEditor, cursorAlwaysArrow: true };+ expect(getEditorSettings(old).cursor.asArrow).toHaveLength(9);+ const picked = patchEditorSettings(old, { cursor: { asArrow: ["text"] } });+ expect(getEditorSettings(picked).cursor.asArrow).toEqual(["text"]);+ expect(picked.legacyEditor).not.toHaveProperty("cursorAlwaysArrow");+ });+it("toggles cursorAutoHide on and off via patch", () => {const enabled = patchEditorSettings(baseDoc, { cursorAutoHide: true });expect(getEditorSettings(enabled).cursorAutoHide).toBe(true);diff --git a/src/lib/ai-edition/store/editorSettings.ts b/src/lib/ai-edition/store/editorSettings.tsindex c4d4b9dd3..fcb80a906 100644--- a/src/lib/ai-edition/store/editorSettings.ts+++ b/src/lib/ai-edition/store/editorSettings.ts@@ -21,7 +21,7 @@ import {type WebcamPosition,type WebcamSizePreset,} from "@/components/video-editor/types";-import { normalizeCursorThemeId } from "@/lib/cursor/cursorThemes";+import { normalizeCursorThemeId, readCursorAsArrow } from "@/lib/cursor/cursorThemes";import {DEFAULT_PROJECT_APPEARANCE,type FrameTheme,@@ -181,6 +181,9 @@ interface LegacyShape {cursorMotionBlur?: number;cursorClickBounce?: number;cursorModel3d?: boolean;+ /** `unknown`: read through `readCursorAsArrow`, which drops what this build does not know. */+ cursorAsArrow?: unknown;+ /** Written by builds with one "always use the arrow" switch; read as every kind. */cursorAlwaysArrow?: boolean;cursorClickImpact?: boolean;cursorShow?: boolean;@@ -226,7 +229,7 @@ export function getEditorSettings(doc: AxcutDocument | null | undefined): Editor),// Absent in every project saved before the setting existed: those keep the flat cursor.model3d: bool(legacy?.cursorModel3d, DEFAULT_EDITOR_SETTINGS.cursor.model3d),- alwaysArrow: bool(legacy?.cursorAlwaysArrow, DEFAULT_EDITOR_SETTINGS.cursor.alwaysArrow),+ asArrow: readCursorAsArrow(legacy?.cursorAsArrow, legacy?.cursorAlwaysArrow),clickImpact: bool(legacy?.cursorClickImpact, DEFAULT_EDITOR_SETTINGS.cursor.clickImpact),autoHide: bool(legacy?.cursorAutoHide, DEFAULT_EDITOR_SETTINGS.cursorAutoHide),};@@ -375,7 +378,11 @@ function nextLegacy(current: LegacyShape | null, patch: EditorSettingsPatch): Leif (c.motionBlur !== undefined) next.cursorMotionBlur = c.motionBlur;if (c.clickBounce !== undefined) next.cursorClickBounce = c.clickBounce;if (c.model3d !== undefined) next.cursorModel3d = c.model3d;- if (c.alwaysArrow !== undefined) next.cursorAlwaysArrow = c.alwaysArrow;+ if (c.asArrow !== undefined) {+ next.cursorAsArrow = c.asArrow;+ // The kinds now say it all; the old switch would only contradict them.+ delete next.cursorAlwaysArrow;+ }if (c.clickImpact !== undefined) next.cursorClickImpact = c.clickImpact;if (c.theme !== undefined) next.cursorTheme = c.theme;if (c.show !== undefined) next.cursorShow = c.show;diff --git a/src/lib/ai-edition/stylePresets.test.ts b/src/lib/ai-edition/stylePresets.test.tsindex 36d4be47a..f409b0723 100644--- a/src/lib/ai-edition/stylePresets.test.ts+++ b/src/lib/ai-edition/stylePresets.test.ts@@ -1,4 +1,5 @@import { describe, expect, it } from "vitest";+import { CURSOR_KIND_IDS } from "../cursor/cursorThemes";import {parseStylePresetAppearance,parseStylePresetFile,@@ -40,7 +41,7 @@ function appearance(overrides: Partial<StylePresetAppearance> = {}): StylePresetmotionBlur: 0.35,clickBounce: 1,model3d: false,- alwaysArrow: false,+ asArrow: [],clickImpact: false,},cursorShow: true,@@ -165,6 +166,27 @@ describe("parseStylePresetAppearance", () => {expect(() => read({ ...older, clickImpact: "yes" })).toThrow(/cursor\.clickImpact/);});+ it("reads the cursor kinds drawn as the arrow, and type-checks them", () => {+ const read = (cursor: Record<string, unknown>) =>+ parseStylePresetAppearance({ ...appearance(), cursor: { ...appearance().cursor, ...cursor } })+ .cursor.asArrow;+ // A newer build's kind is dropped, the way an unknown theme falls back to the default.+ expect(read({ asArrow: ["text", "sparkles", "pointer"] })).toEqual(["pointer", "text"]);+ expect(() => read({ asArrow: "text" })).toThrow(/cursor\.asArrow/);+ expect(() => read({ asArrow: [1] })).toThrow(/cursor\.asArrow/);+ });++ // Before the kinds, one switch drew every cursor as the arrow; before that, nothing did.+ it("reads a preset saved before the cursor kinds from its always-arrow switch", () => {+ const { asArrow: _asArrow, ...older } = appearance().cursor;+ const read = (cursor: Record<string, unknown>) =>+ parseStylePresetAppearance({ ...appearance(), cursor }).cursor.asArrow;+ expect(read(older)).toEqual([]);+ expect(read({ ...older, alwaysArrow: false })).toEqual([]);+ expect(read({ ...older, alwaysArrow: true })).toEqual(CURSOR_KIND_IDS);+ expect(() => read({ ...older, alwaysArrow: "yes" })).toThrow(/cursor\.alwaysArrow/);+ });+it("reads a preset saved before the frame existed as frameless, and rejects an unknown frame", () => {const { frame: _frame, ...older } = appearance();expect(parseStylePresetAppearance(older).frame).toBe("none");diff --git a/src/lib/ai-edition/stylePresets.ts b/src/lib/ai-edition/stylePresets.tsindex 40d129484..cc5070e05 100644--- a/src/lib/ai-edition/stylePresets.ts+++ b/src/lib/ai-edition/stylePresets.ts@@ -19,7 +19,12 @@ import type {WebcamSizePreset,} from "../../components/video-editor/types";import { type AspectRatio, isAspectRatio } from "../../utils/aspectRatioUtils";-import { CURSOR_THEME_IDS, DEFAULT_CURSOR_THEME_ID } from "../cursor/cursorThemes";+import {+ CURSOR_THEME_IDS,+ type CursorKind,+ DEFAULT_CURSOR_THEME_ID,+ readCursorAsArrow,+} from "../cursor/cursorThemes";import {clampToBound,type FrameTheme,@@ -197,6 +202,24 @@ function readFrame(source: Fields): { frame: RecordingFrame; frameTheme: FrameThreturn { frame: stored.frame, frameTheme: theme ?? stored.theme ?? "light" };}+/**+ * The cursor kinds drawn as the arrow. A kind this build does not know (a newer build's) is+ * dropped, the way an unknown theme falls back to the default. A preset written before the kinds+ * could be picked carries the one switch there was, or nothing: every cursor as recorded.+ */+function readAsArrow(cursor: Fields): CursorKind[] {+ const value = cursor.asArrow;+ if (value === undefined) {+ const always =+ cursor.alwaysArrow === undefined ? false : readBoolean(cursor, "alwaysArrow", "cursor.");+ return readCursorAsArrow(undefined, always);+ }+ if (!Array.isArray(value) || value.some((kind) => typeof kind !== "string")) {+ throw new TypeError("Style preset cursor.asArrow must be a list of cursor kinds.");+ }+ return readCursorAsArrow(value);+}+const HEX_COLOR_RE = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;const COLOR_FUNCTION_RE = /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(.*\)$/i;const GRADIENT_RE = /^(?:repeating-)?(?:linear|radial|conic)-gradient\(.*\)$/i;@@ -257,7 +280,8 @@ export function parseStylePresetWallpaper(value: unknown, key = "wallpaper"): st* otherwise sound (the editor does the same when it renders one). The others postdate the* first version-1 files, so a preset saved before one of them existed carries no choice about* it and gets the value that means "unchanged": `cursor.model3d` may be absent (the flat- * cursor), `wallpaperMotion` too (a still wallpaper, which is exactly what "none" means),+ * cursor), `cursor.asArrow` too (every cursor as recorded, see `readAsArrow`),+ * `wallpaperMotion` too (a still wallpaper, which is exactly what "none" means),* `frame` as well (no frame, see `readFrame`), and `depthOfField` keeps the factory* value (on). A present but ill-typed value is still refused. Unknown extra keys are dropped.*/@@ -304,9 +328,7 @@ export function parseStylePresetAppearance(value: unknown): StylePresetAppearancclickBounce: readNumber(cursor, "clickBounce", CURSOR_BOUNDS.clickBounce, "cursor."),// Presets written before the 3D cursor existed meant the flat one.model3d: cursor.model3d === undefined ? false : readBoolean(cursor, "model3d", "cursor."),- // Presets written before the option existed kept every cursor state.- alwaysArrow:- cursor.alwaysArrow === undefined ? false : readBoolean(cursor, "alwaysArrow", "cursor."),+ asArrow: readAsArrow(cursor),// Presets written before the option existed gave clicks no impact.clickImpact:cursor.clickImpact === undefined ? false : readBoolean(cursor, "clickImpact", "cursor."),@@ -401,6 +423,8 @@ export const LOOK_LEGACY_EDITOR_KEYS = ["cursorMotionBlur","cursorClickBounce","cursorModel3d",+ "cursorAsArrow",+ // A project saved before the kinds could be picked holds its look here instead."cursorAlwaysArrow","cursorClickImpact","cursorShow",@@ -418,7 +442,7 @@ export function stylePresetLegacyEditor(appearance: StylePresetAppearance): FielcursorMotionBlur: cursor.motionBlur,cursorClickBounce: cursor.clickBounce,cursorModel3d: cursor.model3d,- cursorAlwaysArrow: cursor.alwaysArrow,+ cursorAsArrow: cursor.asArrow,cursorClickImpact: cursor.clickImpact,};}diff --git a/src/lib/ai-edition/stylePresetsEditor.test.ts b/src/lib/ai-edition/stylePresetsEditor.test.tsindex cbb5b2e29..4f29e457f 100644--- a/src/lib/ai-edition/stylePresetsEditor.test.ts+++ b/src/lib/ai-edition/stylePresetsEditor.test.ts@@ -1,4 +1,5 @@import { describe, expect, it } from "vitest";+import { CURSOR_KIND_IDS } from "../cursor/cursorThemes";import { createEmptyDocument } from "./schema";import {DEFAULT_EDITOR_SETTINGS,@@ -56,7 +57,7 @@ function styledSettings(): EditorSettingsSnapshot {motionBlur: 0.9,clickBounce: 1.5,model3d: true,- alwaysArrow: false,+ asArrow: ["text"],clickImpact: true,},cursorShow: false,@@ -135,7 +136,11 @@ describe("new-project look (main-process side)", () => {it("writes a preset's look under the keys the editor reads, without the format", () => {const appearance = stylePresetAppearanceFromSettings(styledSettings());const legacy = stylePresetLegacyEditor(appearance);- expect(Object.keys(legacy).sort()).toEqual([...LOOK_LEGACY_EDITOR_KEYS].sort());+ // Every look key but the old always-arrow switch: only a project saved before the cursor+ // kinds holds that one.+ expect(Object.keys(legacy).sort()).toEqual(+ LOOK_LEGACY_EDITOR_KEYS.filter((key) => key !== "cursorAlwaysArrow").sort(),+ );const read = getEditorSettings(docWith(legacy));expect(stylePresetAppearanceFromSettings(read)).toEqual({...appearance,@@ -163,4 +168,9 @@ describe("new-project look (main-process side)", () => {}expect(lookFromLegacyEditor(null)).toEqual({});});++ it("carries the old always-arrow switch of a project saved before the cursor kinds", () => {+ const look = lookFromLegacyEditor({ cursorAlwaysArrow: true, cropRegion: { x: 0.2 } });+ expect(getEditorSettings(docWith(look)).cursor.asArrow).toEqual(CURSOR_KIND_IDS);+ });});diff --git a/src/lib/ai-edition/stylePresetsEditor.ts b/src/lib/ai-edition/stylePresetsEditor.tsindex c38caed53..c8a2a217c 100644--- a/src/lib/ai-edition/stylePresetsEditor.ts+++ b/src/lib/ai-edition/stylePresetsEditor.ts@@ -40,7 +40,7 @@ export function stylePresetAppearanceFromSettings(motionBlur: settings.cursor.motionBlur,clickBounce: settings.cursor.clickBounce,model3d: settings.cursor.model3d,- alwaysArrow: settings.cursor.alwaysArrow,+ asArrow: [...settings.cursor.asArrow],clickImpact: settings.cursor.clickImpact,},cursorShow: settings.cursorShow,diff --git a/src/lib/cursor/cursorThemes.test.ts b/src/lib/cursor/cursorThemes.test.tsindex 96268fab0..a342323ac 100644--- a/src/lib/cursor/cursorThemes.test.ts+++ b/src/lib/cursor/cursorThemes.test.ts@@ -2,11 +2,14 @@ import { readFileSync } from "node:fs";import { join } from "node:path";import { describe, expect, it } from "vitest";import {+ CURSOR_KIND_IDS,+ CURSOR_KINDS,CURSOR_THEMES,type CursorTheme,DEFAULT_CURSOR_SPRITES,DEFAULT_CURSOR_THEME_ID,normalizeCursorThemeId,+ readCursorAsArrow,resolveCursorSprites,themePickerPreviewAssets,} from "./cursorThemes";@@ -65,7 +68,7 @@ describe("normalizeCursorThemeId", () => {// knows the same names): in 3D the scene names the model, and the sprite stays the flat art.it.each(CURSOR_THEMES)("names the sculpted 3D arrow and hand of $name", (theme) => {const flat = resolveCursorSprites(theme.id);- const sprites = resolveCursorSprites(theme.id, false, true);+ const sprites = resolveCursorSprites(theme.id, [], true);for (const state of ["arrow", "pointer"] as const) {expect(theme.assets[state]?.sculpted).toBe(true);expect(sprites[state]).toEqual({ ...flat[state], sculpt: `${theme.id}/${state}` });@@ -75,14 +78,57 @@ describe("normalizeCursorThemeId", () => {});it("leaves the default art to the extruded sprite in 3D", () => {- for (const sprite of Object.values(- resolveCursorSprites(DEFAULT_CURSOR_THEME_ID, false, true),- )) {+ for (const sprite of Object.values(resolveCursorSprites(DEFAULT_CURSOR_THEME_ID, [], true))) {expect(sprite.sculpt).toBeUndefined();}});});+describe("cursor kinds", () => {+ // "Arrow only" must leave nothing but the arrow: a state outside every kind would keep its+ // own sprite whatever the user picks.+ it("puts every cursor state but the arrow in exactly one kind", () => {+ const grouped = Object.values(CURSOR_KINDS).flat();+ expect(new Set(grouped).size).toBe(grouped.length);+ expect([...grouped, "arrow"].sort()).toEqual(Object.keys(DEFAULT_CURSOR_SPRITES).sort());+ });++ it("draws the kinds it is given with the theme's arrow, and every other state as itself", () => {+ const theme = CURSOR_THEMES[0];+ const flat = resolveCursorSprites(theme.id);+ const sprites = resolveCursorSprites(theme.id, ["pointer", "resize"]);+ for (const type of ["pointer", ...CURSOR_KINDS.resize] as const) {+ expect(sprites[type], type).toEqual(flat.arrow);+ }+ expect(sprites.text).toBe(DEFAULT_CURSOR_SPRITES.text);+ expect(sprites["open-hand"]).toBe(DEFAULT_CURSOR_SPRITES["open-hand"]);+ });++ it("gives a kind drawn as the arrow the arrow's 3D model", () => {+ const theme = CURSOR_THEMES[0];+ const sprites = resolveCursorSprites(theme.id, ["text"], true);+ expect(sprites.text.sculpt).toBe(`${theme.id}/arrow`);+ });+});++describe("readCursorAsArrow", () => {+ it("keeps the known kinds, once each, in the order of CURSOR_KINDS", () => {+ expect(readCursorAsArrow(["text", "sparkles", "pointer", "text", 7])).toEqual([+ "pointer",+ "text",+ ]);+ expect(readCursorAsArrow("text")).toEqual([]);+ });++ // The single switch the kinds replaced: on meant every one of them, off or absent none.+ it("reads the old always-arrow switch when there is no list", () => {+ expect(readCursorAsArrow(undefined, true)).toEqual(CURSOR_KIND_IDS);+ expect(readCursorAsArrow(undefined, false)).toEqual([]);+ expect(readCursorAsArrow(undefined)).toEqual([]);+ expect(readCursorAsArrow(["busy"], true)).toEqual(["busy"]);+ });+});+describe("themePickerPreviewAssets", () => {it("a pack with its own hand exposes distinct arrow and pointer", () => {const theme: CursorTheme = {diff --git a/src/lib/cursor/cursorThemes.ts b/src/lib/cursor/cursorThemes.tsindex 1bcef09ea..52fd23bde 100644--- a/src/lib/cursor/cursorThemes.ts+++ b/src/lib/cursor/cursorThemes.ts@@ -91,6 +91,37 @@ export const DEFAULT_CURSOR_SPRITES: Record<NativeCursorType, CursorSprite> = {"up-arrow": { assetPath: "cursors/default/up-arrow.png", hotspotX: 0.5, hotspotY: 0.069 },};+/**+ * The cursors a project can draw as recorded or as the arrow, grouped the way they read on+ * screen: the four resize directions and the move cross are one "resize", the open and closed+ * hands one "grab". The arrow is not one of them: it is what the others turn into.+ */+export const CURSOR_KINDS = {+ pointer: ["pointer"],+ text: ["text"],+ grab: ["open-hand", "closed-hand"],+ resize: ["resize-ew", "resize-ns", "resize-nwse", "resize-nesw", "move"],+ busy: ["wait", "app-starting"],+ crosshair: ["crosshair"],+ "not-allowed": ["not-allowed"],+ help: ["help"],+ "up-arrow": ["up-arrow"],+} as const satisfies Record<string, readonly Exclude<NativeCursorType, "arrow">[]>;++export type CursorKind = keyof typeof CURSOR_KINDS;++export const CURSOR_KIND_IDS = Object.keys(CURSOR_KINDS) as CursorKind[];++/**+ * The kinds a project draws as the arrow, from what it stored: known ids only, once each, in+ * `CURSOR_KINDS` order. `alwaysArrow` is the single switch that came before the kinds could be+ * picked: on meant all of them.+ */+export function readCursorAsArrow(asArrow: unknown, alwaysArrow?: unknown): CursorKind[] {+ if (asArrow === undefined) return alwaysArrow === true ? [...CURSOR_KIND_IDS] : [];+ return Array.isArray(asArrow) ? CURSOR_KIND_IDS.filter((kind) => asArrow.includes(kind)) : [];+}+/*** Bundled cursor themes. These five packs are original OpenScreen artwork. Their raster* masters live in design/cursors/ and are prepared by scripts/generate-original-cursor-themes.mjs.@@ -268,7 +299,7 @@ export function normalizeCursorThemeId(id: unknown): string {*/export function resolveCursorSprites(themeId: string | null | undefined,- alwaysArrow = false,+ asArrow: readonly CursorKind[] = [],model3d = false,): Record<NativeCursorType, CursorSprite> {const sprites = { ...DEFAULT_CURSOR_SPRITES };@@ -285,10 +316,10 @@ export function resolveCursorSprites(...(model3d && asset.sculpted ? { sculpt: `${themeId}/${type}` } : {}),};}- // "Always use arrow": one consistent pointer for the whole recording, the I-beam and the- // hand included. Done on the table the compositor reads, so it needs no mode of its own.- if (alwaysArrow) {- for (const type of Object.keys(sprites) as NativeCursorType[]) {+ // A kind drawn as the arrow takes the arrow's sprite, with the theme's art and its 3D model.+ // Done on the table the compositor reads, so it needs no mode of its own.+ for (const kind of asArrow) {+ for (const type of CURSOR_KINDS[kind]) {sprites[type] = sprites.arrow;}}diff --git a/src/lib/projectDefaults.ts b/src/lib/projectDefaults.tsindex b6babe149..cbcb490b6 100644--- a/src/lib/projectDefaults.ts+++ b/src/lib/projectDefaults.ts@@ -1,3 +1,5 @@+import type { CursorKind } from "./cursor/cursorThemes";+/*** The frame drawn around the recording, a project setting like the wallpaper. "none" draws* nothing and renders exactly as before the setting existed.@@ -195,7 +197,7 @@ export interface ProjectAppearanceDefaults {motionBlur: number;clickBounce: number;model3d: boolean;- alwaysArrow: boolean;+ asArrow: CursorKind[];clickImpact: boolean;autoHide: boolean;};@@ -242,7 +244,8 @@ export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {// A light tap: 2.5 squashed the arrow to 40% and threw it to 140% in 260 ms on every click.clickBounce: 1,model3d: false,- alwaysArrow: false,+ // Every cursor as recorded.+ asArrow: [],clickImpact: false,autoHide: false,},diff --git a/src/native/browserShim.presets.test.ts b/src/native/browserShim.presets.test.tsindex c7464a103..d69a11368 100644--- a/src/native/browserShim.presets.test.ts+++ b/src/native/browserShim.presets.test.ts@@ -36,7 +36,7 @@ const APPEARANCE: StylePresetAppearance = {motionBlur: 0.35,clickBounce: 1,model3d: false,- alwaysArrow: false,+ asArrow: [],clickImpact: false,},cursorShow: true,diff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.tsindex 5a1296fdb..39c6c99bd 100644--- a/src/native/sceneDescription.test.ts+++ b/src/native/sceneDescription.test.ts@@ -18,7 +18,7 @@ import type {AxcutZoomRegion,} from "@/lib/ai-edition/schema";import { axcutSchemaVersion } from "@/lib/ai-edition/schema";-import { DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";+import { CURSOR_KIND_IDS, DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";import { DEVICE_FRAMES } from "@/lib/projectDefaults";import { getFocusBoundsForScale } from "@/lib/zoomMath/focusUtils";import {@@ -1288,7 +1288,7 @@ describe("buildSceneDescription.settings mapping", () => {cursorMotionBlur: 0.5,cursorClickBounce: 1.5,cursorClipToBounds: true,- cursorAlwaysArrow: true,+ cursorAsArrow: ["text", "pointer"],},});const cursor = buildSceneDescription(doc).cursor;@@ -1298,7 +1298,14 @@ describe("buildSceneDescription.settings mapping", () => {expect(cursor.clickBounce).toBe(1.5);// The option is gone: a project that had it on now overflows like every other one.expect(cursor.clipToBounds).toBe(false);- expect(cursor.alwaysArrow).toBe(true);+ expect(cursor.asArrow).toEqual(["pointer", "text"]);+ });++ // The single switch that came before the kinds: on drew every one of them as the arrow.+ it("reads the old always-arrow switch as every cursor kind", () => {+ const on = makeDoc({ legacyEditor: { cursorAlwaysArrow: true } });+ expect(buildSceneDescription(on).cursor.asArrow).toEqual(CURSOR_KIND_IDS);+ expect(buildSceneDescription(makeDoc({})).cursor.asArrow).toEqual([]);});it("maps show / theme / shape / mirror through to layout+cursor", () => {diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.tsindex 633abea35..309a93332 100644--- a/src/native/sceneDescription.ts+++ b/src/native/sceneDescription.ts@@ -59,6 +59,7 @@ import {resolveWebcamReactiveZoom,webcamSizeToFraction,} from "@/lib/compositeLayout";+import type { CursorKind } from "@/lib/cursor/cursorThemes";import { parseCssGradient, resolveLinearGradientAngle } from "@/lib/exporter/gradientParser";import type { FrameTheme, RecordingFrame, WebcamAnchor } from "@/lib/projectDefaults";import { resolveTextFontFamily } from "@/lib/textFonts";@@ -440,8 +441,9 @@ export interface SceneCursor {* the default theme's arrow; any other cursor keeps its flat sprite.*/model3d: boolean;- /** Every cursor state drawn with the arrow sprite (resolved app-side, see compositorViewService). */- alwaysArrow: boolean;+ /** The kinds drawn with the arrow sprite (`CURSOR_KINDS`, resolved app-side, see+ * compositorViewService). */+ asArrow: CursorKind[];/** Each click gives the screen an impact, under every camera (`scene.rs`* `SceneCursor::click_impact`). Omitted (not `false`) when off. */clickImpact?: true;@@ -1242,7 +1244,7 @@ export function buildSceneDescription(motionBlur: settings.cursor.motionBlur,clickBounce: settings.cursor.clickBounce,model3d: settings.cursor.model3d,- alwaysArrow: settings.cursor.alwaysArrow,+ asArrow: settings.cursor.asArrow,...(settings.cursor.clickImpact ? { clickImpact: true as const } : {}),// The "Keep inside frame" option is gone: the cursor always overflows into the// background. The field stays because the compositor's scene requires it.