瀏覽代碼

小优化

刘洋 1 年之前
父節點
當前提交
34877a1846
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/lib/watermark.ts

+ 2 - 2
src/lib/watermark.ts

@@ -82,7 +82,7 @@ export async function addWatermark(
     // const maxX = imageWidth / 2 - x * 2;
     let dynamicX = x;
     const maxStartX = imageWidth - fontSize * 0.7 * 5;
-    const nextLineStartX = x + fontSize * 0.7 * 2;
+    const nextLineStartX = x + fontSize * 0.7 * 4;
     const height = fontSize + 10;
     //计算总分
     const totalScore =
@@ -141,7 +141,7 @@ export async function addWatermark(
               y += height;
             }
             drawText(
-              (dynamicX += (v.score + joinStr).length * fontSize * 0.7),
+              (dynamicX += (v.score + " ").length * fontSize * 0.7),
               y,
               v.score + joinStr
             );