Browse Source

feat: 轨迹图区域调整

zhangjie 2 months ago
parent
commit
b2debefecf
2 changed files with 24 additions and 1 deletions
  1. 1 0
      src/features/track/TrackBody.vue
  2. 23 1
      src/features/track/composables/useTrackTag.ts

+ 1 - 0
src/features/track/TrackBody.vue

@@ -325,6 +325,7 @@ watch(() => markStore.currentTask, renderPaperAndMark);
   font-weight: bold;
   line-height: 1;
   color: #f53f3f;
+  flex-shrink: 0;
 }
 .mark-info p {
   margin: 0;

+ 23 - 1
src/features/track/composables/useTrackTag.ts

@@ -169,7 +169,29 @@ export default function useTrackTag() {
     const combinePictureConfigList: QuestionArea[] =
       combinePictureConfig(pictureConfigs);
     // console.log(combinePictureConfigList);
-    return combinePictureConfigList;
+    return shrinkQuestionArea(combinePictureConfigList);
+  }
+
+  // 缩小区域
+  // 给定区域向中心缩小到原来的0.9倍,高度为原来的0.94倍
+  function shrinkQuestionArea(pictureConfigs: QuestionArea[]) {
+    const shrinkPictureConfigList: QuestionArea[] = [];
+    pictureConfigs.forEach((item) => {
+      const { x, y, w, h } = item;
+      const newX = x + w / 2;
+      const newY = y + h / 2;
+      const newW = w * 0.9;
+      const newH = h * 0.94;
+      shrinkPictureConfigList.push({
+        i: item.i,
+        x: newX - newW / 2,
+        y: newY - newH / 2,
+        w: newW,
+        h: newH,
+        qStruct: item.qStruct,
+      });
+    });
+    return shrinkPictureConfigList;
   }
 
   // 获取属于填空题的试题号