fix(canvas): 创作工作区 - 收紧界面密度并改进 Agent 镂空标签

This commit is contained in:
ddcat666 committed 2026-09-24 10:07:05 +08:00
1 parent 357450e52c
commit 703f4f0029
9 files changed
+158 -73

No files matched your search

+7 -1
View File
@@ -20,7 +20,7 @@ export function clampAgentPanelLayout(layout: AgentPanelLayout, viewport: AgentP
}
export function restoreAgentPanelLayout(raw: string | null, viewport: AgentPanelViewport): AgentPanelLayout {
const fallback = { width: 448, height: 720, left: viewport.width - 464, top: viewport.height - 732 };
const fallback = defaultAgentPanelLayout(viewport);
if (!raw) return clampAgentPanelLayout(fallback, viewport);
try {
const parsed: unknown = JSON.parse(raw);
@@ -33,6 +33,12 @@ export function restoreAgentPanelLayout(raw: string | null, viewport: AgentPanel
return clampAgentPanelLayout(fallback, viewport);
}
export function defaultAgentPanelLayout(viewport: AgentPanelViewport): AgentPanelLayout {
const width = 420;
const height = 640;
return clampAgentPanelLayout({ width, height, left: viewport.width - width - MARGIN, top: viewport.height - height - MARGIN }, viewport);
}
export function changeAgentPanelLayout(start: AgentPanelLayout, gesture: AgentPanelGesture, dx: number, dy: number, viewport: AgentPanelViewport): AgentPanelLayout {
if (gesture === "move") return clampAgentPanelLayout({ ...start, left: start.left + dx, top: start.top + dy }, viewport);
const right = start.left + start.width;