diff --git a/components/canvas/RealtimeCanvasDialog.tsx b/components/canvas/RealtimeCanvasDialog.tsx
index 0aa1b5795..7f30eb1b7 100644
--- a/components/canvas/RealtimeCanvasDialog.tsx
+++ b/components/canvas/RealtimeCanvasDialog.tsx
@@ -34,7 +34,6 @@ import {
Upload,
ChevronDown,
ChevronUp,
- RefreshCw,
Sparkles,
Save,
Trash2,
@@ -115,7 +114,6 @@ const FALLBACK_PROMPT =
const CANVAS_BACKGROUND = "#ffffff";
const DEFAULT_BRUSH_COLOR = "#18181b";
const DRAW_LAYER_ID = "__draw_layer__";
-const CANVAS_BACKGROUND_PRESETS = ["#ffffff", "#f4f4f5", "#fdf2f8", "#ecfeff", "#f0fdf4"] as const;
const REALTIME_PROJECTS_STORAGE_KEY = "ai-chatbot:realtime-canvas-projects";
function cloneImageLayers(layers: ImageLayer[]) {
@@ -2208,17 +2206,6 @@ export function RealtimeCanvasDialog({
[importFilesAsLayers]
);
- const handleCanvasBackgroundChange = useCallback(
- (nextColor: string) => {
- canvasBackgroundRef.current = nextColor;
- setCanvasBackground(nextColor);
- saveHistory(undefined, nextColor);
- markCanvasDirty(null);
- scheduleFlush(true);
- },
- [markCanvasDirty, saveHistory, scheduleFlush]
- );
-
const handleDownloadCanvas = useCallback(async () => {
const compositeCanvas = await buildCompositeCanvas();
if (!compositeCanvas) return;
@@ -2357,18 +2344,6 @@ export function RealtimeCanvasDialog({
>
- {standalone ? (
-
- ) : null}
@@ -2379,7 +2354,10 @@ export function RealtimeCanvasDialog({
"h-8 w-8 rounded-full text-zinc-600 hover:bg-zinc-100",
brushMode === "brush" && "bg-black text-white hover:bg-black"
)}
- onClick={() => setBrushMode("brush")}
+ onClick={() => {
+ setSelectedLayerId(DRAW_LAYER_ID);
+ setBrushMode("brush");
+ }}
title="画笔"
>
@@ -2391,7 +2369,10 @@ export function RealtimeCanvasDialog({
"h-8 w-8 rounded-full text-zinc-600 hover:bg-zinc-100",
brushMode === "eraser" && "bg-black text-white hover:bg-black"
)}
- onClick={() => setBrushMode("eraser")}
+ onClick={() => {
+ setSelectedLayerId(DRAW_LAYER_ID);
+ setBrushMode("eraser");
+ }}
title="橡皮"
>
@@ -2403,7 +2384,10 @@ export function RealtimeCanvasDialog({
"h-8 w-8 rounded-full text-zinc-600 hover:bg-zinc-100",
brushMode === "rect" && "bg-black text-white hover:bg-black"
)}
- onClick={() => setBrushMode("rect")}
+ onClick={() => {
+ setSelectedLayerId(DRAW_LAYER_ID);
+ setBrushMode("rect");
+ }}
title="矩形"
>
@@ -2415,7 +2399,10 @@ export function RealtimeCanvasDialog({
"h-8 w-8 rounded-full text-zinc-600 hover:bg-zinc-100",
brushMode === "circle" && "bg-black text-white hover:bg-black"
)}
- onClick={() => setBrushMode("circle")}
+ onClick={() => {
+ setSelectedLayerId(DRAW_LAYER_ID);
+ setBrushMode("circle");
+ }}
title="圆形"
>
@@ -2427,7 +2414,10 @@ export function RealtimeCanvasDialog({
"h-8 w-8 rounded-full text-zinc-600 hover:bg-zinc-100",
brushMode === "line" && "bg-black text-white hover:bg-black"
)}
- onClick={() => setBrushMode("line")}
+ onClick={() => {
+ setSelectedLayerId(DRAW_LAYER_ID);
+ setBrushMode("line");
+ }}
title="直线"
>
@@ -2471,21 +2461,6 @@ export function RealtimeCanvasDialog({
thumbClassName="h-5 w-5 border border-zinc-300 bg-white shadow-sm"
/>
-
- {CANVAS_BACKGROUND_PRESETS.map((color) => (
-
@@ -2498,15 +2473,6 @@ export function RealtimeCanvasDialog({
>
-
-
+ {standalone ? (
+
+
+
+ ) : null}
+
@@ -2690,7 +2662,7 @@ export function RealtimeCanvasDialog({
/>
-
+
@@ -2699,22 +2671,7 @@ export function RealtimeCanvasDialog({
{imageLayers.length} 张
-
-
+
{imageLayers.length === 0 ? (
暂无图层