From caa9b5489331d1538d9c769f1dcf92ece62f0573 Mon Sep 17 00:00:00 2001 From: Daishi Kato Date: Wed, 24 Jun 2020 17:16:03 +0900 Subject: [PATCH] do not render grid on export (#1814) --- src/renderer/renderScene.ts | 8 +++++--- src/scene/export.ts | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/renderer/renderScene.ts b/src/renderer/renderScene.ts index 5cc00b9c..7aaf2cf5 100644 --- a/src/renderer/renderScene.ts +++ b/src/renderer/renderScene.ts @@ -74,7 +74,7 @@ const strokeCircle = ( context.stroke(); }; -const renderGrid = ( +const strokeGrid = ( context: CanvasRenderingContext2D, gridSize: number, offsetX: number, @@ -148,10 +148,12 @@ export const renderScene = ( // Should not be turned on for export operations and similar, because it // doesn't guarantee pixel-perfect output. renderOptimizations = false, + renderGrid = true, }: { renderScrollbars?: boolean; renderSelection?: boolean; renderOptimizations?: boolean; + renderGrid?: boolean; } = {}, ) => { if (!canvas) { @@ -191,8 +193,8 @@ export const renderScene = ( context.scale(sceneState.zoom, sceneState.zoom); // Grid - if (appState.gridSize) { - renderGrid( + if (renderGrid && appState.gridSize) { + strokeGrid( context, appState.gridSize, -Math.ceil(zoomTranslationX / sceneState.zoom / appState.gridSize) * diff --git a/src/scene/export.ts b/src/scene/export.ts index 3caa6bcc..2e294046 100644 --- a/src/scene/export.ts +++ b/src/scene/export.ts @@ -72,6 +72,7 @@ export const exportToCanvas = ( renderScrollbars: false, renderSelection: false, renderOptimizations: false, + renderGrid: false, }, );