Skip to content

Commit

Permalink
fix: export.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lencx authored May 25, 2023
1 parent 76c10e3 commit 2d18d7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ async function exportInit() {
await invoke('download_list', { pathname: 'chat.notes.json', filename, id, dir: 'notes' });
}

async function downloadThread({ asF = Format.PNG } = {}) {
async function downloadThread({ as = Format.PNG } = {}) {
const { startLoading, stopLoading } = new window.__LoadingMask('Exporting in progress...');
startLoading();
const elements = new Elements();
await elements.fixLocation();
const pixelRatio = window.devicePixelRatio;
const minRatio = asF === Format.PDF ? 2 : 2.5;
const minRatio = as === Format.PDF ? 2 : 2.5;
window.devicePixelRatio = Math.max(pixelRatio, minRatio);

html2canvas(elements.thread, {
Expand All @@ -185,7 +185,7 @@ async function exportInit() {
window.devicePixelRatio = pixelRatio;
const imgData = canvas.toDataURL('image/png');
requestAnimationFrame(async () => {
if (asF === Format.PDF) {
if (as === Format.PDF) {
await handlePdf(imgData, canvas, pixelRatio);
} else {
await handleImg(imgData);
Expand Down

0 comments on commit 2d18d7f

Please sign in to comment.