Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(cursor): preview each theme by its main arrow only, centered

EtienneLescotb14bebea954e
diff --git a/src/components/ai-edition/CursorPane.preview.test.tsx b/src/components/ai-edition/CursorPane.preview.test.tsx
index 83d829ad3..fa222938f 100644
--- a/src/components/ai-edition/CursorPane.preview.test.tsx
+++ b/src/components/ai-edition/CursorPane.preview.test.tsx
@@ -47,7 +47,7 @@ describe("CursorPane theme picker", () => {
expect(screen.getByRole("button", { name: "Default" })).toBeTruthy();
for (const theme of CURSOR_THEMES) {
const button = screen.getByRole("button", { name: theme.name });
- expect(button.querySelectorAll("img")).toHaveLength(2);
+ expect(button.querySelectorAll("img")).toHaveLength(1);
}
});
});
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.css
index d200dc755..182980e5d 100644
--- a/src/components/ai-edition/NewEditorShell.module.css
+++ b/src/components/ai-edition/NewEditorShell.module.css
@@ -1471,12 +1471,6 @@ textarea.control {
transition: border-color 150ms ease, box-shadow 150ms ease;
color: var(--muted);
}
-.cursorCellPreviews {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 2px;
-}
.cursorCell:hover { border-color: var(--border-hi); color: var(--fg-2); }
.cursorCell:disabled { opacity: 0.5; cursor: not-allowed; }
.cursorCell:disabled:hover { border-color: transparent; color: var(--muted); }
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 0d56e6e3e..6fb1fcaff 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -3811,25 +3811,20 @@ export function CursorPane() {
// handlers below push diffs live. Sizes are sent as direct scales (1 = fixture default).
// Synchro initiale : cf. NativeCompositorOverlay (`pushAllNativeParams`).
- // Built-in "Default" plus each bundled theme. When arrow and pointer art
- // differ, both sprites are shown so a pack is not previewed as arrow-only.
+ // Built-in "Default" plus each bundled theme, previewed by its main arrow only.
const cursorThemeOptions = useMemo(
() => [
{
id: DEFAULT_CURSOR_THEME_ID,
name: ts("cursor.themeDefault"),
- previewUrls: [defaultCursorPreviewUrl],
+ previewUrl: defaultCursorPreviewUrl,
},
...CURSOR_THEMES.map((theme) => {
- const preview = themePickerPreviewAssets(theme);
- const urls = [
- preview.arrow ? safeAssetUrl(preview.arrow) : defaultCursorPreviewUrl,
- ...(preview.pointer ? [safeAssetUrl(preview.pointer)] : []),
- ];
+ const { arrow } = themePickerPreviewAssets(theme);
return {
id: theme.id,
name: theme.name,
- previewUrls: urls,
+ previewUrl: arrow ? safeAssetUrl(arrow) : defaultCursorPreviewUrl,
};
}),
],
@@ -3917,19 +3912,14 @@ export function CursorPane() {
disabled={!hasDocument}
onClick={() => void set({ cursor: { theme: option.id } })}
>
- <span className={styles.cursorCellPreviews}>
- {option.previewUrls.map((url) => (
- <img
- key={url}
- src={url}
- alt=""
- width={option.previewUrls.length > 1 ? 14 : 20}
- height={option.previewUrls.length > 1 ? 14 : 20}
- draggable={false}
- style={{ objectFit: "contain", pointerEvents: "none" }}
- />
- ))}
- </span>
+ <img
+ src={option.previewUrl}
+ alt=""
+ width={20}
+ height={20}
+ draggable={false}
+ style={{ objectFit: "contain", pointerEvents: "none" }}
+ />
</button>
);
})}