Prechádzať zdrojové kódy

Merge branch 'release_1.3.0' of http://git.qmth.com.cn/markingcloud/stmms-proxy into release_1.3.1_pdf_without_double

刘洋 1 rok pred
rodič
commit
61e4d9489b
1 zmenil súbory, kde vykonal 5 pridanie a 4 odobranie
  1. 5 4
      src/lib/watermark.ts

+ 5 - 4
src/lib/watermark.ts

@@ -63,9 +63,10 @@ export async function addWatermark(
   // console.log(size);
   const imgData = gm(image);
   const drawText = (l: number, t: number, content: string) => {
-    const top = t < 30 ? 30 : t > imageHeight ? imageHeight : t;
-    const left = l > imageWidth - 30 ? imageWidth - 30 : l;
-    imgData.drawText(left, top + 30, content);
+    const len = (content || "").length;
+    const top = t < 25 ? 50 : t + 25 > imageHeight ? imageHeight : t + 25;
+    const left = l > imageWidth - 25 ? imageWidth - 25 * len : l;
+    imgData.drawText(left, top, content);
   };
   //添加第一页的得分明细
   if (index == 1) {
@@ -241,7 +242,7 @@ export async function addWatermark(
   }
   //显示评卷标记
   if (student.tags != undefined && student.tags[index] != undefined) {
-    const fontSize = 60;
+    const fontSize = 50;
     const height = fontSize + 10;
     // imgData.font(fontFile, fontSize).fill(color);
     const tags = student.tags[index];