Sfoglia il codice sorgente

fix 高比宽大的裁切bug

Michael Wang 3 anni fa
parent
commit
cac2d48962
1 ha cambiato i file con 6 aggiunte e 5 eliminazioni
  1. 6 5
      src/features/mark/CommonMarkBody.vue

+ 6 - 5
src/features/mark/CommonMarkBody.vue

@@ -312,9 +312,10 @@ async function processSplitConfig() {
       const indexInSliceUrls = store.currentTask.sliceUrls.indexOf(url) + 1;
       const indexInSliceUrls = store.currentTask.sliceUrls.indexOf(url) + 1;
       const image = images[indexInSliceUrls - 1];
       const image = images[indexInSliceUrls - 1];
       let shouldBreak = false;
       let shouldBreak = false;
+      let [splitConfigStart, splitConfigEnd] = config;
       if (image.naturalHeight > image.naturalWidth) {
       if (image.naturalHeight > image.naturalWidth) {
-        config[0] = 0;
-        config[1] = 1;
+        splitConfigStart = 0;
+        splitConfigEnd = 1;
         shouldBreak = true;
         shouldBreak = true;
       }
       }
 
 
@@ -322,7 +323,7 @@ async function processSplitConfig() {
 
 
       const dataUrl = await getDataUrlForSplitConfig(
       const dataUrl = await getDataUrlForSplitConfig(
         image,
         image,
-        config,
+        [splitConfigStart, splitConfigEnd],
         maxSliceWidth,
         maxSliceWidth,
         url
         url
       );
       );
@@ -370,10 +371,10 @@ async function processSplitConfig() {
         // originalImageHeight: image.naturalHeight,
         // originalImageHeight: image.naturalHeight,
         sliceImageWidth: sliceImageRendered.naturalWidth,
         sliceImageWidth: sliceImageRendered.naturalWidth,
         sliceImageHeight: sliceImageRendered.naturalHeight,
         sliceImageHeight: sliceImageRendered.naturalHeight,
-        dx: image.naturalWidth * config[0],
+        dx: image.naturalWidth * splitConfigStart,
         dy: 0,
         dy: 0,
         accumTopHeight,
         accumTopHeight,
-        effectiveWidth: image.naturalWidth * config[1],
+        effectiveWidth: image.naturalWidth * splitConfigEnd,
       });
       });
       accumTopHeight = accumBottomHeight;
       accumTopHeight = accumBottomHeight;