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

This commit is contained in:
ddcat666
2026-09-24 10:07:05 +08:00
parent 3ef40e1d21
commit 32a2e44040
9 changed files with 158 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { changeAgentPanelLayout, clampAgentPanelLayout, restoreAgentPanelLayout } from "@/lib/canvas/agent-panel-layout";
import { changeAgentPanelLayout, clampAgentPanelLayout, defaultAgentPanelLayout, restoreAgentPanelLayout } from "@/lib/canvas/agent-panel-layout";
import { agentErrorPresentation, agentSubmissionErrorTitle } from "@/lib/canvas/agent-error-presentation";
import { ApiError } from "@/services/api/request";
@@ -15,6 +15,10 @@ describe("Agent window layout", () => {
expect(layout.height).toBe(626);
expect(layout.top).toBe(12);
});
it("offers a compact reset without altering a saved window until requested", () => {
expect(restoreAgentPanelLayout(JSON.stringify(start), viewport)).toEqual(start);
expect(defaultAgentPanelLayout(viewport)).toEqual({ left: 848, top: 148, width: 420, height: 640 });
});
it("keeps the bottom/right anchor when resizing from top/left", () => {
const layout = changeAgentPanelLayout(start, "northwest", -120, 60, viewport);
expect(layout).toEqual({ left: 696, top: 128, width: 568, height: 660 });