fix(canvas): 人物质感变体自动触发生成,修复缩略图不变 #91 (#92)

- use-canvas-media-tools.ts: createPortraitTextureNode 改为 generatePortraitTextureNode,
  节点创建后立即触发后端生成任务(与情绪/多视角/局部编辑保持一致):
  使用 nodeReferenceImage 获取源图引用,buildPortraitTexturePrompt 构建提示词,
  runBackendCanvasGenerationTask 执行生成,完成后更新缩略图
- project.tsx: 同步重命名 createPortraitTextureNode → generatePortraitTextureNode
- canvas-drawing-excalidraw-editor.tsx: getDimensions 参数补充 number 类型注解
- canvas-drawing-editor-modal.tsx: Pick 类型补充 engine 字段

Co-authored-by: sikongyue <3155157671@qq.com>
This commit is contained in:
爱笑的毛毛虫
2026-08-03 20:11:13 +08:00
committed by GitHub
parent d387b25e2e
commit 9b3ec218e2
4 changed files with 42 additions and 33 deletions

View File

@@ -16,7 +16,7 @@ type CanvasDrawingEditorModalProps = {
projectId: string;
node: CanvasNodeData | null;
onClose: () => void;
onSaved: (nodeId: string, summary: Pick<CanvasDrawingSnapshot, "revision" | "updatedAt" | "shapeCount" | "pageCount">) => void;
onSaved: (nodeId: string, summary: Pick<CanvasDrawingSnapshot, "engine" | "revision" | "updatedAt" | "shapeCount" | "pageCount">) => void;
};
export function CanvasDrawingEditorModal({ open, projectId, node, onClose, onSaved }: CanvasDrawingEditorModalProps) {

View File

@@ -31,7 +31,7 @@ export const CanvasDrawingExcalidrawEditor = forwardRef<CanvasDrawingEditorHandl
files,
mimeType: "image/png",
exportPadding: DRAWING_RENDER_PADDING,
getDimensions: (width, height) => {
getDimensions: (width: number, height: number) => {
const scale = Math.min(4, DRAWING_RENDER_MAX_DIMENSION / Math.max(1, width, height));
outputWidth = Math.max(1, Math.round(width * scale));
outputHeight = Math.max(1, Math.round(height * scale));