@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.cjs
CHANGED
|
@@ -12590,8 +12590,8 @@ class PixldocsRenderer {
|
|
|
12590
12590
|
return;
|
|
12591
12591
|
}
|
|
12592
12592
|
const exportCanvas = document.createElement("canvas");
|
|
12593
|
-
exportCanvas.width =
|
|
12594
|
-
exportCanvas.height =
|
|
12593
|
+
exportCanvas.width = Math.round(canvasWidth * pixelRatio);
|
|
12594
|
+
exportCanvas.height = Math.round(canvasHeight * pixelRatio);
|
|
12595
12595
|
const exportCtx = exportCanvas.getContext("2d");
|
|
12596
12596
|
if (!exportCtx) {
|
|
12597
12597
|
cleanup();
|
|
@@ -12599,10 +12599,10 @@ class PixldocsRenderer {
|
|
|
12599
12599
|
return;
|
|
12600
12600
|
}
|
|
12601
12601
|
exportCtx.save();
|
|
12602
|
-
exportCtx.scale(
|
|
12602
|
+
exportCtx.scale(exportCanvas.width / canvasWidth, exportCanvas.height / canvasHeight);
|
|
12603
12603
|
this.paintPageBackground(exportCtx, config.pages[pageIndex], canvasWidth, canvasHeight);
|
|
12604
12604
|
exportCtx.restore();
|
|
12605
|
-
exportCtx.drawImage(sourceCanvas, 0, 0);
|
|
12605
|
+
exportCtx.drawImage(sourceCanvas, 0, 0, exportCanvas.width, exportCanvas.height);
|
|
12606
12606
|
const mimeType = format === "jpeg" ? "image/jpeg" : format === "webp" ? "image/webp" : "image/png";
|
|
12607
12607
|
const dataUrl = exportCanvas.toDataURL(mimeType, quality);
|
|
12608
12608
|
cleanup();
|
|
@@ -12618,7 +12618,7 @@ class PixldocsRenderer {
|
|
|
12618
12618
|
react.createElement(PreviewCanvas2, {
|
|
12619
12619
|
config,
|
|
12620
12620
|
pageIndex,
|
|
12621
|
-
zoom:
|
|
12621
|
+
zoom: 1,
|
|
12622
12622
|
absoluteZoom: true,
|
|
12623
12623
|
onReady
|
|
12624
12624
|
})
|