bill 4 mēneši atpakaļ
vecāks
revīzija
f6bb81baf5
1 mainītis faili ar 19 papildinājumiem un 7 dzēšanām
  1. 19 7
      src/components/drawing-time/current.vue

+ 19 - 7
src/components/drawing-time/current.vue

@@ -2,7 +2,6 @@
   <v-arrow
     :ref="(r: any) => arrow[0] = r"
     :config="{
-      points: [currentX, 0, currentX, 10],
       fill: currentColor,
       stroke: currentColor,
       strokeWidth: 1,
@@ -16,12 +15,11 @@
     v-if="!hideLine"
     :ref="(r: any) => arrow[1] = r"
     :config="{
-        points: [currentX, size!.height, currentX, 10],
-        stroke: currentColor,
-        strokeWidth: 2,
-        hitStrokeWidth: 4,
-        ...currentMat
-      }"
+      stroke: currentColor,
+      strokeWidth: 2,
+      hitStrokeWidth: 4,
+      ...currentMat,
+    }"
   />
 </template>
 
@@ -92,4 +90,18 @@ watch(
     viewer.movePixel({ x: offsetX, y: 0 });
   }
 );
+
+watch(
+  () => ({
+    x: currentX.value,
+    h: size.value!.height,
+    shapes: arrow.value.map((item) => item.getNode()),
+  }),
+  ({ x, shapes }) => {
+    if (shapes[0] && shapes[1]) {
+      shapes[0].points([x, 0, x, 10]);
+      shapes[1].points([x, size.value!.height, x, 10]);
+    }
+  }
+);
 </script>