Moved minimap rendering to offscreen canvas

This commit is contained in:
tk338g
2021-02-19 21:07:09 +03:00
parent 3b0aff0ac6
commit 6a8680f500
15 changed files with 28144 additions and 175 deletions

View File

@@ -32,7 +32,10 @@ export const exportToCanvas = (
createCanvas: (
width: number,
height: number,
) => { canvas: HTMLCanvasElement; scale: number } = (width, height) => {
) => { canvas: HTMLCanvasElement | OffscreenCanvas; scale: number } = (
width,
height,
) => {
const tempCanvas = document.createElement("canvas");
tempCanvas.width = width * scale;
tempCanvas.height = height * scale;
@@ -57,7 +60,7 @@ export const exportToCanvas = (
appState,
null,
newScale,
rough.canvas(tempCanvas),
rough.canvas((tempCanvas as unknown) as HTMLCanvasElement),
tempCanvas,
{
viewBackgroundColor: exportBackground ? viewBackgroundColor : null,