Files
ttstd-3d-director/src/editor/canvas/viewportAspectFrame.test.ts
LKH 3b053c714c init
all

视频

视频

视频

视频

视频

init
2026-07-29 09:17:00 +08:00

19 lines
636 B
TypeScript

import { describe, expect, it } from "vitest";
import { fitFrameWithinViewport } from "./viewportAspectFrame";
describe("fitFrameWithinViewport", () => {
it("keeps framed aspect layouts inside the visible safe area between overlay side panels", () => {
const frame = fitFrameWithinViewport(1000, 700, 16 / 9, 126, {
left: 220,
right: 300,
top: 0,
bottom: 0,
});
expect(frame.left).toBeGreaterThanOrEqual(260);
expect(frame.left + frame.width).toBeLessThanOrEqual(660);
expect(frame.top).toBeGreaterThanOrEqual(40);
expect(frame.top + frame.height).toBeLessThanOrEqual(574);
});
});