@pixldocs/canvas-renderer 0.5.23 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12571,8 +12571,8 @@ class PixldocsRenderer {
|
|
|
12571
12571
|
return;
|
|
12572
12572
|
}
|
|
12573
12573
|
const exportCanvas = document.createElement("canvas");
|
|
12574
|
-
exportCanvas.width =
|
|
12575
|
-
exportCanvas.height =
|
|
12574
|
+
exportCanvas.width = Math.round(canvasWidth * pixelRatio);
|
|
12575
|
+
exportCanvas.height = Math.round(canvasHeight * pixelRatio);
|
|
12576
12576
|
const exportCtx = exportCanvas.getContext("2d");
|
|
12577
12577
|
if (!exportCtx) {
|
|
12578
12578
|
cleanup();
|
|
@@ -12580,10 +12580,10 @@ class PixldocsRenderer {
|
|
|
12580
12580
|
return;
|
|
12581
12581
|
}
|
|
12582
12582
|
exportCtx.save();
|
|
12583
|
-
exportCtx.scale(
|
|
12583
|
+
exportCtx.scale(exportCanvas.width / canvasWidth, exportCanvas.height / canvasHeight);
|
|
12584
12584
|
this.paintPageBackground(exportCtx, config.pages[pageIndex], canvasWidth, canvasHeight);
|
|
12585
12585
|
exportCtx.restore();
|
|
12586
|
-
exportCtx.drawImage(sourceCanvas, 0, 0);
|
|
12586
|
+
exportCtx.drawImage(sourceCanvas, 0, 0, exportCanvas.width, exportCanvas.height);
|
|
12587
12587
|
const mimeType = format === "jpeg" ? "image/jpeg" : format === "webp" ? "image/webp" : "image/png";
|
|
12588
12588
|
const dataUrl = exportCanvas.toDataURL(mimeType, quality);
|
|
12589
12589
|
cleanup();
|
|
@@ -12599,7 +12599,7 @@ class PixldocsRenderer {
|
|
|
12599
12599
|
createElement(PreviewCanvas2, {
|
|
12600
12600
|
config,
|
|
12601
12601
|
pageIndex,
|
|
12602
|
-
zoom:
|
|
12602
|
+
zoom: 1,
|
|
12603
12603
|
absoluteZoom: true,
|
|
12604
12604
|
onReady
|
|
12605
12605
|
})
|