feat(canvas): 画布主题 - 与工作台外观隔离并提高连线对比

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ddCat
2026-09-16 22:59:34 +08:00
parent da0531f6eb
commit cb405e9b6a
54 changed files with 207 additions and 134 deletions

View File

@@ -18,7 +18,7 @@ import {
type CanvasEmotionEditRegion,
type CanvasFaceBox,
} from "@/lib/canvas/canvas-emotion";
import { useThemeStore } from "@/stores/use-theme-store";
import { useActiveTheme } from "@/stores/canvas/use-canvas-theme-store";
export type CanvasImageEmotionPayload = CanvasEmotionParams & {
label: string;
@@ -54,7 +54,7 @@ type CanvasNodeEmotionPanelProps = {
};
export function CanvasNodeEmotionPanel({ dataUrl, imageWidth, imageHeight, characters, activeCharacterId, preset, generating, error, onSelectCharacter, onManualSelect, onPresetChange, onClose, onConfirm }: CanvasNodeEmotionPanelProps) {
const theme = canvasThemes[useThemeStore((state) => state.theme)];
const theme = canvasThemes[useActiveTheme()];
const reducedMotion = useReducedMotion();
return (
<SpotlightSurface
@@ -129,7 +129,7 @@ function FaceThumbnail({ dataUrl, imageWidth, imageHeight, box }: { dataUrl: str
}
function EmotionPad({ preset, onChange }: { preset: CanvasEmotionPreset; onChange: (preset: CanvasEmotionPreset) => void }) {
const theme = canvasThemes[useThemeStore((state) => state.theme)];
const theme = canvasThemes[useActiveTheme()];
const reducedMotion = useReducedMotion();
const [pointer, setPointer] = useState<{ x: number; y: number } | null>(null);
const [dragging, setDragging] = useState(false);
@@ -190,7 +190,7 @@ function EmotionPad({ preset, onChange }: { preset: CanvasEmotionPreset; onChang
}
function EmotionHeadPreview({ preset }: { preset: CanvasEmotionPreset }) {
const theme = canvasThemes[useThemeStore((state) => state.theme)];
const theme = canvasThemes[useActiveTheme()];
return (
<div className="relative overflow-hidden rounded-[var(--r-lg)] border" style={{ background: "#26272a", borderColor: theme.toolbar.border }}>
<Canvas frameloop="demand" dpr={[1, 1.5]} camera={{ fov: 38, near: 0.1, far: 20, position: [0, 0, 4.15] }} gl={{ antialias: true, alpha: false, powerPreference: "high-performance" }}>