Skip to content

Commit d99f77d

Browse files
authored
Increase pixel ratio for png export (#556)
1 parent 21a68e9 commit d99f77d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/EditorHeader/ControlPanel.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
DB,
4444
IMPORT_FROM,
4545
noteWidth,
46+
pngExportPixelRatio,
4647
} from "../../data/constants";
4748
import jsPDF from "jspdf";
4849
import { useHotkeys } from "react-hotkeys-hook";
@@ -493,7 +494,9 @@ export default function ControlPanel({
493494
}));
494495
};
495496
const copyAsImage = () => {
496-
toPng(document.getElementById("canvas")).then(function (dataUrl) {
497+
toPng(document.getElementById("canvas"), {
498+
pixelRatio: pngExportPixelRatio,
499+
}).then(function (dataUrl) {
497500
const blob = dataURItoBlob(dataUrl);
498501
navigator.clipboard
499502
.write([new ClipboardItem({ "image/png": blob })])
@@ -996,7 +999,9 @@ export default function ControlPanel({
996999
{
9971000
name: "PNG",
9981001
function: () => {
999-
toPng(document.getElementById("canvas")).then(function (dataUrl) {
1002+
toPng(document.getElementById("canvas"), {
1003+
pixelRatio: pngExportPixelRatio,
1004+
}).then(function (dataUrl) {
10001005
setExportData((prev) => ({
10011006
...prev,
10021007
data: dataUrl,

src/data/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const gridSize = 24;
2222
export const gridCircleRadius = 0.85;
2323
export const tableFieldHeight = 36;
2424
export const tableColorStripHeight = 7;
25+
export const pngExportPixelRatio = 4;
2526

2627
export const Cardinality = {
2728
ONE_TO_ONE: "one_to_one",

0 commit comments

Comments
 (0)