bill преди 4 месеца
родител
ревизия
614d98c600
променени са 3 файла, в които са добавени 20 реда и са изтрити 15 реда
  1. 4 2
      src/hook/use-fly.ts
  2. 1 1
      src/views/animation/index.vue
  3. 15 12
      src/views/tagging/hot/sign.vue

+ 4 - 2
src/hook/use-fly.ts

@@ -22,7 +22,8 @@ let stopFly: (() => void) | null = null;
 export const flyTagging = (tagging: Tagging, callback?: () => void) => {
   stopFly && stopFly();
   const positions = getTaggingPositions(tagging);
-
+  console.error('fly tagging')
+  let timeout: any
   let isStop = false;
   const flyIndex = (i: number) => {
     if (isStop || i >= positions.length) {
@@ -39,13 +40,14 @@ export const flyTagging = (tagging: Tagging, callback?: () => void) => {
     const pop = showTaggingPositionsStack.push(ref(new WeakSet([position])));
     flyTaggingPosition(position);
 
-    setTimeout(() => {
+    timeout = setTimeout(() => {
       pop();
       flyIndex(i + 1);
     }, 2000);
   };
   flyIndex(0);
   stopFly = () => {
+    clearTimeout(timeout)
     isStop = true;
     stopFly = null;
   };

+ 1 - 1
src/views/animation/index.vue

@@ -22,7 +22,7 @@
     />
     <GlobalFrame
       class="global-frame"
-      v-if="activeAttrib?.key !== 'frames' && !play"
+      v-if="activeAttrib?.key !== 'frames' && !play && focusAM"
       :data="{ id: '0', name: 'global-frame', time: 0 }"
       :frame-action="frameAction"
       @change-frame-action="(action) => (frameAction = action.action)"

+ 15 - 12
src/views/tagging/hot/sign.vue

@@ -33,7 +33,7 @@
 
 <script setup lang="ts">
 import { getFileUrl, getUrlType, MetaType } from "@/utils";
-import { computed, ref, watchEffect, nextTick } from "vue";
+import { computed, ref, watchEffect, nextTick, watch } from "vue";
 import { getResource, showTaggingPositionsStack } from "@/env";
 import { getTaggingPosNode, sdk } from "@/sdk";
 import {
@@ -86,19 +86,22 @@ const actions = {
   delete: () => emit("delete"),
 };
 
-watchEffect((onCleanup) => {
-  if (props.selected) {
-    const success = () => emit("select", false);
-    const stop = flyTagging(props.tagging, success);
-    const keyupHandler = (ev: KeyboardEvent) => ev.code === "Escape" && success();
+watch(
+  () => props.selected,
+  (selected, _a, onCleanup) => {
+    if (selected) {
+      const success = () => emit("select", false);
+      const stop = flyTagging(props.tagging, success);
+      const keyupHandler = (ev: KeyboardEvent) => ev.code === "Escape" && success();
 
-    document.documentElement.addEventListener("keyup", keyupHandler, false);
-    onCleanup(() => {
-      stop();
-      document.documentElement.removeEventListener("keyup", keyupHandler, false);
-    });
+      document.documentElement.addEventListener("keyup", keyupHandler, false);
+      onCleanup(() => {
+        stop();
+        document.documentElement.removeEventListener("keyup", keyupHandler, false);
+      });
+    }
   }
-});
+);
 </script>
 
 <style lang="scss" scoped src="./style.scss"></style>