zhangjie пре 2 недеља
родитељ
комит
3b818f03e2
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      src/features/mark/composables/useMakeTrack.ts

+ 3 - 3
src/features/mark/composables/useMakeTrack.ts

@@ -163,11 +163,11 @@ export default function useMakeTrack() {
     }
   }
 
-  function getRandomPosition(area: SplitConfig) {
+  function getRandomPosition(area: SplitConfig, yCenter = false) {
     const { x, y, w, h } = area;
     return {
       x: x + w / 4 + (Math.random() * w) / 2,
-      y: y + h / 4 + (Math.random() * h) / 2,
+      y: yCenter ? y + h / 2 : y + h / 4 + (Math.random() * h) / 2,
     };
   }
 
@@ -241,7 +241,7 @@ export default function useMakeTrack() {
     if (!imageSize) return;
 
     // 不存在时,在第一个评卷区的中心50%的区域随机一个点
-    const { x, y } = getRandomPosition(area);
+    const { x, y } = getRandomPosition(area, true);
     const track: Track = {
       id: getTrackId({
         mainNumber: question.mainNumber,