diff --git a/components/agents/AgentPsdTemplateEditorDialog.tsx b/components/agents/AgentPsdTemplateEditorDialog.tsx index c16864f58..e647a4204 100644 --- a/components/agents/AgentPsdTemplateEditorDialog.tsx +++ b/components/agents/AgentPsdTemplateEditorDialog.tsx @@ -39,6 +39,8 @@ import { } from "@/lib/agents/psd-template-config"; const fetcher = (url: string) => fetch(url, { cache: "no-store" }).then((res) => res.json()); +const PREVIEW_VIEWPORT_PADDING = 56; +const PREVIEW_STAGE_MAX_SCALE = 0.82; function createInitialState(template: AgentPsdTemplate | null, sourceImageUrl: string) { const imageAssignments: Record = {}; @@ -309,12 +311,12 @@ export function AgentPsdTemplateEditorDialog({ const updateScale = () => { const rect = element.getBoundingClientRect(); - const availableWidth = Math.max(240, rect.width - 32); - const availableHeight = Math.max(240, rect.height - 32); + const availableWidth = Math.max(240, rect.width - PREVIEW_VIEWPORT_PADDING); + const availableHeight = Math.max(240, rect.height - PREVIEW_VIEWPORT_PADDING); const nextScale = Math.min( availableWidth / Math.max(1, selectedTemplate.width), availableHeight / Math.max(1, selectedTemplate.height), - 1 + PREVIEW_STAGE_MAX_SCALE ); setStageScale(Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1); }; @@ -469,11 +471,6 @@ export function AgentPsdTemplateEditorDialog({ ) : null} -
- 操作方式更接近 PS: - 直接点击模板里的图片区域去替换图片,点击模板里的文字区域直接改现有文字。 -
- + + ) : ( +
+
+ {selectedTextLayer ? ( + + ) : ( + + )} +
+
还未导出成品图
+
+ 在模板画布里完成替换后,点击“应用模板并导出”,这里会显示最终图片。
- - - - ) : ( -
-
- {selectedTextLayer ? ( - - ) : ( - - )} -
-
还未导出成品图
-
- 在模板画布里完成替换后,点击“应用模板并导出”,这里会显示最终图片。 -
-
- )} + )} + - +