Ver código fonte

fix filter bug

Michael Wang 3 anos atrás
pai
commit
f291518087
2 arquivos alterados com 4 adições e 4 exclusões
  1. 2 2
      src/features/mark/CommonMarkBody.vue
  2. 2 2
      src/utils/utils.ts

+ 2 - 2
src/features/mark/CommonMarkBody.vue

@@ -319,9 +319,9 @@ async function processSplitConfig() {
   // 要转变为 [[0, 0.3]] | [[0, 0.55], [0.45, 0.55]] | [[0, 0.35], [0.33, 0.35], [0.66, 0.35]]
   const splitConfigPairs = store.setting.splitConfig
     .map<[number, number]>((v, index, ary) =>
-      index % 2 === 0 ? [v, ary[index + 1]] : [0, 0]
+      index % 2 === 0 ? [v, ary[index + 1]] : [-1, -1]
     )
-    .filter((v) => v[0] > 0 && v[1] > 0);
+    .filter((v) => v[0] > -1);
 
   // 最大的 splitConfig 的宽度
   const maxSplitConfig = Math.max(

+ 2 - 2
src/utils/utils.ts

@@ -217,9 +217,9 @@ export async function preDrawImage(_currentTask: Task) {
 
     const splitConfigPairs = store.setting.splitConfig
       .map<[number, number]>((v, index, ary) =>
-        index % 2 === 0 ? [v, ary[index + 1]] : [0, 0]
+        index % 2 === 0 ? [v, ary[index + 1]] : [-1, -1]
       )
-      .filter((v) => v[0] > 0 && v[1] > 0);
+      .filter((v) => v[0] > -1);
 
     const maxSplitConfig = Math.max(...store.setting.splitConfig);
     maxSliceWidth =