Increase pixel ratio for png export (#556)

This commit is contained in:
1ilit
2025-08-19 21:03:27 +04:00
committed by GitHub
parent 21a68e9b13
commit d99f77d0de
2 changed files with 8 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ import {
DB,
IMPORT_FROM,
noteWidth,
pngExportPixelRatio,
} from "../../data/constants";
import jsPDF from "jspdf";
import { useHotkeys } from "react-hotkeys-hook";
@@ -493,7 +494,9 @@ export default function ControlPanel({
}));
};
const copyAsImage = () => {
toPng(document.getElementById("canvas")).then(function (dataUrl) {
toPng(document.getElementById("canvas"), {
pixelRatio: pngExportPixelRatio,
}).then(function (dataUrl) {
const blob = dataURItoBlob(dataUrl);
navigator.clipboard
.write([new ClipboardItem({ "image/png": blob })])
@@ -996,7 +999,9 @@ export default function ControlPanel({
{
name: "PNG",
function: () => {
toPng(document.getElementById("canvas")).then(function (dataUrl) {
toPng(document.getElementById("canvas"), {
pixelRatio: pngExportPixelRatio,
}).then(function (dataUrl) {
setExportData((prev) => ({
...prev,
data: dataUrl,

View File

@@ -22,6 +22,7 @@ export const gridSize = 24;
export const gridCircleRadius = 0.85;
export const tableFieldHeight = 36;
export const tableColorStripHeight = 7;
export const pngExportPixelRatio = 4;
export const Cardinality = {
ONE_TO_ONE: "one_to_one",