bill преди 4 месеца
родител
ревизия
0875f31284
променени са 5 файла, в които са добавени 31 реда и са изтрити 12 реда
  1. 1 1
      src/components/global-search/guide.vue
  2. 1 0
      src/hook/use-fly.ts
  3. 23 7
      src/layout/edit/fuse-left-pano.vue
  4. 5 3
      src/sdk/association/animation.ts
  5. 1 1
      src/views/animation/index.vue

+ 1 - 1
src/components/global-search/guide.vue

@@ -1,5 +1,5 @@
 <template>
-  <GuideSign :guide="data" :edit="false" search @click="flyPlayGuide(data)" />
+  <GuideSign :guide="data" :edit="false" search />
 </template>
 
 <script lang="ts" setup>

+ 1 - 0
src/hook/use-fly.ts

@@ -106,6 +106,7 @@ export const flyView = (view: View) => {
 };
 
 export const flyPlayGuide = (guide: Guide) => {
+  console.error('flyPlay')
   stopFly && stopFly()
   stopFly = () => {
     stopFly = null

+ 23 - 7
src/layout/edit/fuse-left-pano.vue

@@ -15,7 +15,7 @@
 </template>
 
 <script lang="ts" setup>
-import { watchEffect, ref } from "vue";
+import { watchEffect, ref, watch } from "vue";
 import { custom } from "@/env";
 import { activeModel, getSceneModel } from "@/sdk";
 import { fuseModels, getFuseModelShowVariable } from "@/store";
@@ -26,16 +26,32 @@ import { LeftPano } from "@/layout";
 
 import type { FuseModel } from "@/store";
 
-const modelChangeSelect = (model: FuseModel) => {
-  if (getFuseModelShowVariable(model).value) {
-    if (custom.currentModel !== model) {
+watch(
+  () => custom.currentModel,
+  (model, oldModel) => {
+    if (oldModel && getFuseModelShowVariable(oldModel).value) {
+      getSceneModel(oldModel)?.changeSelect(false);
+      activeModel({ showMode: "fuse" });
+    }
+    if (model && getFuseModelShowVariable(model).value) {
       getSceneModel(model)?.changeSelect(true);
       activeModel({ active: model, showMode: "fuse" });
-    } else {
-      getSceneModel(custom.currentModel)?.changeSelect(false);
-      activeModel({ showMode: "fuse" });
     }
   }
+);
+
+const modelChangeSelect = (model: FuseModel) => {
+  custom.currentModel = model === custom.currentModel ? null : model;
+  // if (getFuseModelShowVariable(model).value) {
+  //   if (custom.currentModel !== model) {
+  //     custom.currentModel = null
+  //     getSceneModel(model)?.changeSelect(true);
+  //     activeModel({ active: model, showMode: "fuse" });
+  //   } else {
+  //     getSceneModel(custom.currentModel)?.changeSelect(false);
+  //     activeModel({ showMode: "fuse" });
+  //   }
+  // }
 };
 
 watchEffect(() => {

+ 5 - 3
src/sdk/association/animation.ts

@@ -321,6 +321,7 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
   const show = ref(false);
   const pixel = ref<Pos>();
   const modelShow = ref(true)
+  const textShow = ref(true)
   const stopLoad = watch(
     () => {
       const exists = am.subtitles.some(({ id }) => id === data.id);
@@ -344,6 +345,7 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
         const cleanups = [
           watchEffect(() => {
             layer.innerHTML = data.content;
+            textShow.value = !!layer.textContent?.trim()?.length
             size.value = {
               width: layer.offsetWidth,
               height: layer.offsetHeight,
@@ -362,7 +364,7 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
           }),
           watchEffect(() => {
             layer.style.visibility =
-              pixel.value && show.value && modelShow.value ? "visible" : "hidden";
+              pixel.value && show.value && modelShow.value && textShow.value ? "visible" : "hidden";
           }),
           watchEffect(() => {
             if (pixel.value) {
@@ -393,6 +395,7 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
   const stopAttrib = mergeFuns(
     watch(
       [
+        () => router.currentRoute.value.name,
         currentTime,
         () => amMap[getAMKey(am)]?.am,
         size,
@@ -448,14 +451,13 @@ export const addSubtitle = (data: AnimationModelSubtitle) => {
 export const endTime = computed(() => {
   const amsEndTime = ams.value.map((am) => {
     const endPoints = [
-      ...am.frames,
+      ...am.frames.map(item => ({...item, duration: 0})),
       ...am.actions,
       ...am.subtitles,
       ...am.paths,
     ].map((item) => item.time + (item.duration || 0));
     return Math.max(...endPoints);
   });
-  console.log("amsEndTime", amsEndTime, ams.value);
   return (
     Math.max(...amsEndTime) +
     ((animationGroup.delayEndTime && animationGroup.delayEndTime()) || 0)

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

@@ -238,7 +238,7 @@ const add = <T extends Active["key"]>(
   const attr = getAddTLItemTimeByTime(
     focusAM.value![key],
     currentTime.value,
-    preset.duration || 10
+    typeof preset.duration === "number" ? preset.duration : 10
   );
   if (!attr) {
     Message.error("同一时间内请勿重复添加");