Browse Source

轨迹相距过近,不允许点击

Michael Wang 4 years ago
parent
commit
61610603fc
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/features/mark/MarkBody.vue

+ 12 - 0
src/features/mark/MarkBody.vue

@@ -365,6 +365,18 @@ export default defineComponent({
         console.log("不在有效宽度内,轨迹不生效");
         return;
       }
+      if (
+        item.trackList.some((t) => {
+          return (
+            Math.pow(Math.abs(t.offsetX - track.offsetX), 2) +
+              Math.pow(Math.abs(t.offsetY - track.offsetY), 2) <
+            500
+          );
+        })
+      ) {
+        console.log("两个轨迹相距过近");
+        return;
+      }
       // 是否保留当前的轨迹分
       const ifKeepScore =
         Math.round(