|
|
@@ -18,7 +18,7 @@ export class CanvasPhotoEditor {
|
|
|
this.ctxOld = null
|
|
|
this.rqWidth = 370
|
|
|
this.rqHeight = 250
|
|
|
- this.pageWidth = options.pageWidth || 600
|
|
|
+ this.pageWidth = options.pageWidth || 520
|
|
|
this.pageHeight = options.pageHeight || 840
|
|
|
this.pageMargin = options.pageMargin || 4
|
|
|
this.imgMargin = 10
|
|
|
@@ -1552,10 +1552,10 @@ export class CanvasPhotoEditor {
|
|
|
const h = img.height * s;
|
|
|
let x = coord.x + (coord.width - w) / 2;
|
|
|
const y = coord.y + (coord.height - h) / 2;
|
|
|
- if (paperType == 'four') {
|
|
|
- w = w / (724 / 840)
|
|
|
- x = x * (724 / 840)
|
|
|
- }
|
|
|
+ // if (paperType == 'four') {
|
|
|
+ // w = w / (724 / 840)
|
|
|
+ // x = x * (724 / 840)
|
|
|
+ // }
|
|
|
ctx.drawImage(img, x, y, w, h);
|
|
|
|
|
|
ctx.restore();
|
|
|
@@ -1659,9 +1659,9 @@ export class CanvasPhotoEditor {
|
|
|
// 创建画布(和PDF导出尺寸逻辑一致)
|
|
|
const pageCanvas = document.createElement("canvas");
|
|
|
let pageWidth = this.pageWidth
|
|
|
- if (paperType === "four") {
|
|
|
- pageWidth = pageWidth * (724 / 840)
|
|
|
- }
|
|
|
+ // if (paperType === "four") {
|
|
|
+ // pageWidth = pageWidth * (724 / 840)
|
|
|
+ // }
|
|
|
pageCanvas.width = pageWidth * DPR * (paperType === "a3" ? 2 : paperType === "a4" ? 1 : 4);
|
|
|
pageCanvas.height = this.pageHeight * DPR * 1;
|
|
|
const ctx = pageCanvas.getContext("2d");
|
|
|
@@ -1718,10 +1718,10 @@ export class CanvasPhotoEditor {
|
|
|
const h = img.height * s;
|
|
|
let x = coord.x + (coord.width - w) / 2;
|
|
|
const y = coord.y + (coord.height - h) / 2;
|
|
|
- if (paperType == 'four') {
|
|
|
- w = w / (724 / 840)
|
|
|
- x = x * (724 / 840)
|
|
|
- }
|
|
|
+ // if (paperType == 'four') {
|
|
|
+ // w = w / (724 / 840)
|
|
|
+ // x = x * (724 / 840)
|
|
|
+ // }
|
|
|
ctx.drawImage(img, x, y, w, h);
|
|
|
ctx.restore();
|
|
|
}
|