bill 5 mesiacov pred
rodič
commit
1f3d51d42a

+ 1 - 1
src/components/tagging/sign-new.vue

@@ -219,7 +219,7 @@ const iconClickHandler = () => {
 };
 
 onUnmounted(() => {
-  tag.destory();
+  tag.destroy();
 });
 
 defineExpose(tag);

+ 10 - 0
src/sdk/association/animation.ts

@@ -350,6 +350,16 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
   );
 };
 
+export const endTime = computed(() => {
+  const amsEndTime = ams.value.map((am) => {
+    const endPoints = [...am.frames, ...am.actions, ...am.subtitles, ...am.paths].map(
+      (item) => item.time + (item.duration || 0)
+    );
+    return Math.max(...endPoints);
+  })
+  return Math.max(...amsEndTime) + 1
+})
+
 export const currentTime = ref(0);
 export const associationAnimation = (sdk: SDK, el: HTMLDivElement) => {
   animationGroup = sdk.createAnimationGroup();

+ 1 - 1
src/sdk/sdk.ts

@@ -358,7 +358,7 @@ export type Tagging3D = {
   // 距离相机位置
   getCameraDisSquared: () => number;
   // 标注销毁
-  destory: () => void;
+  destroy: () => void;
 };
 
 // 动画组对象

+ 9 - 2
src/views/animation/bottom.vue

@@ -88,7 +88,7 @@
 <script lang="ts" setup>
 import { Slider } from "ant-design-vue";
 import { computed, ref, watch, watchEffect } from "vue";
-import { AnimationModel } from "@/store/animation";
+import { ams, AnimationModel } from "@/store/animation";
 import Renderer from "@/components/drawing/renderer.vue";
 import Time from "@/components/drawing-time/time.vue";
 import TimeCurrent from "@/components/drawing-time/current.vue";
@@ -97,7 +97,7 @@ import TimeLineFrame from "@/components/drawing-time-line/frame.vue";
 import TimeLineAction from "@/components/drawing-time-line/action.vue";
 import empty from "@/components/drawing-time-line/empty.vue";
 import { Active } from "./type";
-import { animationGroup } from "@/sdk/association/animation";
+import { animationGroup, currentTime, endTime } from "@/sdk/association/animation";
 import { onlyId } from "@/components/drawing/hook";
 
 const props = defineProps<{
@@ -157,6 +157,13 @@ const play = ref(false);
 
 watch(play, (_a, _b, onCleanup) => {
   play.value ? animationGroup.play() : animationGroup.pause();
+  onCleanup(
+    watchEffect(() => {
+      if (currentTime.value >= endTime.value) {
+        play.value = false;
+      }
+    })
+  );
 
   // let isDes = false;
   // let prevNow = Date.now();