14 lines
601 B
TypeScript
14 lines
601 B
TypeScript
import type { Artboard } from "@core/artboard";
|
|
import type { ViewportState } from "@editor/state";
|
|
import { renderCheckerboard } from "./checkerboard";
|
|
import { documentRectToScreenRect } from "./screen-rect";
|
|
import type { WebGlRendererContext } from "./types";
|
|
|
|
export function renderArtboard(context: WebGlRendererContext, artboard: Artboard, viewport: ViewportState) {
|
|
const rect = documentRectToScreenRect(context.canvas, artboard.bounds, viewport);
|
|
|
|
if (artboard.backgroundColor === "transparent") {
|
|
renderCheckerboard(context, rect, Math.max(4, Math.round(12 * viewport.zoom)));
|
|
}
|
|
}
|