Browse Source

do not render grid on export (#1814)

Daishi Kato 4 years ago
parent
commit
caa9b54893
2 changed files with 6 additions and 3 deletions
  1. 5 3
      src/renderer/renderScene.ts
  2. 1 0
      src/scene/export.ts

+ 5 - 3
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) *

+ 1 - 0
src/scene/export.ts

@@ -72,6 +72,7 @@ export const exportToCanvas = (
       renderScrollbars: false,
       renderSelection: false,
       renderOptimizations: false,
+      renderGrid: false,
     },
   );