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

View File

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