feat: 优化时间轴

This commit is contained in:
tongtong committed 2026-09-18 00:52:28 +08:00
1 parent e66e3374bf
commit 8645ea3007
19 files changed
+1538 -391

No files matched your search

+10 -15
View File
@@ -128,7 +128,7 @@ it("uses the fullscreen button to collapse the side panels instead of entering b
);
});
it("creates a new camera before storing viewport capsule screenshots from director view", async () => {
it("stores viewport capsule screenshots on the active camera without creating a new one from director view", async () => {
const user = userEvent.setup();
const anchorClick = vi.spyOn(HTMLAnchorElement.prototype, "click").mockImplementation(() => {});
const snapshot = {
@@ -142,7 +142,7 @@ it("creates a new camera before storing viewport capsule screenshots from direct
dataUrl: "data:image/png;base64,current-camera",
meta: {
mode: "camera" as const,
cameraId: "cam_2",
cameraId: "cam_1",
fov: 64,
position: [3, 2, 1] as [number, number, number],
target: [0, 1, -2] as [number, number, number],
@@ -156,30 +156,25 @@ it("creates a new camera before storing viewport capsule screenshots from direct
await user.click(screen.getByRole("button", { name: "当前视角截图" }));
await waitFor(() => {
expect(handler).toHaveBeenCalledWith({ preset: "current", source: "camera-panel", cameraId: "cam_2" });
expect(handler).toHaveBeenCalledWith({ preset: "current", source: "camera-panel", cameraId: "cam_1" });
});
const state = useDirectorStore.getState();
const originalCamera = state.project.cameras[0];
const newCamera = state.project.cameras[1];
const activeCamera = state.project.cameras[0];
expect(anchorClick).not.toHaveBeenCalled();
expect(state.viewMode).toBe("camera");
expect(state.project.activeCameraId).toBe("cam_2");
expect(state.selectedObjectId).toBe("cam_object_2");
expect(originalCamera?.captures).toEqual([]);
expect(newCamera?.fov).toBe(64);
expect(newCamera?.transform.position).toEqual(getCameraRigPositionFromViewSnapshot(snapshot));
expect(getCameraViewSnapshotFromShot(newCamera)).toEqual(snapshot);
expect(newCamera?.captures).toEqual([
expect(state.project.cameras).toHaveLength(1);
expect(state.project.activeCameraId).toBe("cam_1");
expect(activeCamera?.captures).toEqual([
{
id: "cam_2-capture-01",
id: "cam_1-capture-01",
index: 1,
name: "机位02-截图01",
name: "机位01-截图01",
dataUrl: "data:image/png;base64,current-camera",
},
]);
expect(newCamera?.lastCaptureUrl).toBe("data:image/png;base64,current-camera");
expect(activeCamera?.lastCaptureUrl).toBe("data:image/png;base64,current-camera");
});
it("stores viewport capsule screenshots in the current camera while already in camera view", async () => {