tangning hace 10 horas
padre
commit
404520cd7c
Se han modificado 2 ficheros con 13 adiciones y 13 borrados
  1. 12 12
      src/view/case/photos/canvas-photo-editor.js
  2. 1 1
      src/view/case/photos/index.vue

+ 12 - 12
src/view/case/photos/canvas-photo-editor.js

@@ -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();
               }

+ 1 - 1
src/view/case/photos/index.vue

@@ -404,7 +404,7 @@ onMounted(async () => {
   if (canvas.value) {
     // 创建编辑器实例
     editor.value = new CanvasPhotoEditor(canvas.value, {
-      pageWidth: 600,
+      pageWidth: 520,
       pageHeight: 840,
       canvasBgColor: "#efefef",
       pageBgColor: "#ffffff",