zhangjie преди 1 година
родител
ревизия
4b5c930ac7
променени са 2 файла, в които са добавени 36 реда и са изтрити 2 реда
  1. 29 0
      src/features/mark/CommonMarkBody.vue
  2. 7 2
      src/features/mark/MarkDrawTrack.vue

+ 29 - 0
src/features/mark/CommonMarkBody.vue

@@ -36,6 +36,7 @@
               :dx="item.dx"
               :dy="item.dy"
               @deleteSpecialtag="(tag) => deleteSpecialtag(item, tag)"
+              @click-specialtag="(event) => clickSpecialtag(event, item)"
             />
             <div
               v-if="isCustomSpecialTag"
@@ -474,6 +475,16 @@ const deleteSpecialtag = (item, tag) => {
   if (stagIndex === -1) return;
   store.currentTaskEnsured.markResult.specialTagList.splice(tagIndex, 1);
 };
+const clickSpecialtag = (event: MouseEvent, item: SliceImage) => {
+  // console.log(event);
+  const e = {
+    target: event.target.offsetParent.childNodes[0],
+    offsetX: event.offsetX + event.target.offsetLeft,
+    offsetY: event.offsetY + event.target.offsetTop,
+  };
+
+  makeTrack(e as MouseEvent, item, maxSliceWidth, theFinalHeight);
+};
 
 const clearEmptySpecialTag = (item) => {
   item.tagList
@@ -661,6 +672,8 @@ let curImageTarget: HTMLElement = null;
 let curSliceImagesWithTrackItem: SliceImage = $ref(null);
 
 const specialLenStyle = $computed(() => {
+  if (specialPoint.ex <= specialPoint.x) return { display: "none" };
+
   const width =
     specialPoint.ex > specialPoint.x ? specialPoint.ex - specialPoint.x : 0;
   return {
@@ -673,6 +686,9 @@ const specialLenStyle = $computed(() => {
   };
 });
 const specialCircleStyle = $computed(() => {
+  if (specialPoint.ex <= specialPoint.x || specialPoint.ey <= specialPoint.y)
+    return { display: "none" };
+
   const width =
     specialPoint.ex > specialPoint.x ? specialPoint.ex - specialPoint.x : 0;
   const height =
@@ -700,6 +716,19 @@ function specialMouseMove({ left, top }) {
   specialPoint.ey = top + specialPoint.y;
 }
 function specialMouseStop(e: MouseEvent) {
+  if (
+    store.currentSpecialTagType === "LINE" &&
+    specialPoint.ex <= specialPoint.x
+  ) {
+    return;
+  }
+  if (
+    store.currentSpecialTagType === "CIRCLE" &&
+    (specialPoint.ex <= specialPoint.x || specialPoint.ey <= specialPoint.y)
+  ) {
+    return;
+  }
+
   const track: SpecialTag = {
     tagName: "",
     tagType: store.currentSpecialTagType,

+ 7 - 2
src/features/mark/MarkDrawTrack.vue

@@ -50,8 +50,9 @@
     ></div>
     <div
       v-else-if="tag.tagType === 'CIRCLE'"
-      class="special-line"
+      class="special-circle"
       :style="computeSpecialCircleStyle(tag)"
+      @click="circleTagClickHandle"
     ></div>
     <div
       v-else
@@ -85,7 +86,7 @@ const props = defineProps<{
   dx: number;
   dy: number;
 }>();
-const emit = defineEmits(["delete-specialtag"]);
+const emit = defineEmits(["delete-specialtag", "click-specialtag"]);
 
 const { trackList } = toRefs(props);
 
@@ -175,6 +176,10 @@ const specialTagBlur = (tag) => {
   emit("delete-specialtag", tag);
 };
 
+const circleTagClickHandle = (event: MouseEvent) => {
+  emit("click-specialtag", event);
+};
+
 watch(
   () => store.focusTracks,
   () => {