Explorar el Código

Merge branch 'local' of http://192.168.0.115:3000/bill/fuse-code into local

xzw hace 3 años
padre
commit
c6ec5f9fb8

+ 1 - 0
src/layout/model-list/index.vue

@@ -61,6 +61,7 @@ const addHandler = async (file: File) => {
 
 const modelChangeSelect = (model: Model) => {
   if (getModelShowVariable(model).value) {
+    console.error('changeSelect',getSceneModel(model), custom.currentModel !== model)
     if (custom.currentModel !== model) {
       getSceneModel(model)?.changeSelect(true)
       custom.currentModel = model

+ 13 - 23
src/sdk/association.ts

@@ -1,9 +1,8 @@
 import { sdk } from './sdk'
-import { models, taggings, isEdit, sysBus, getModelShowVariable, ModelType } from '@/store'
-import { toRaw, watchEffect, ref, watch } from 'vue'
+import { models, isEdit, sysBus, getModelShowVariable, ModelType, backupModels } from '@/store'
+import { toRaw, watchEffect, ref, watch, createApp } from 'vue'
 import { viewModeStack, custom, getResource, showRightCtrlPanoStack } from '@/env'
 import { 
-  mount, 
   diffArrayChange, 
   shallowWatchArray, 
   arrayChildEffectScope,
@@ -11,11 +10,12 @@ import {
   showLoad,
   hideLoad
 } from '@/utils'
+import SDKApp from './index.vue'
+import Components from 'bill/index'
+import { Model } from '@/store'
 
-import TaggingComponent from '@/components/tagging/list.vue'
 
 import type { SDK, SceneModel, SceneGuidePath, ModelAttrRange } from '.'
-import { Model, Tagging } from '@/store'
 
 export const modelRange: ModelAttrRange  = {
   opacityRange: { min: 0, max: 100, step: 0.1 },
@@ -57,6 +57,7 @@ const associationModels = (sdk: SDK) => {
       showLoad()
       sceneModel.bus.on('loadDone', () => {
         item.loaded = true
+        backupModels()
         hideLoad()
       })
       sceneModel.bus.on('loadError', () => {
@@ -83,7 +84,10 @@ const associationModels = (sdk: SDK) => {
           })
           watchEffect(() => getSceneModel(item)?.changeOpacity(item.opacity))
           watchEffect(() => getSceneModel(item)?.changeScale(item.scale))
-          watchEffect(() => getSceneModel(item)?.changeShow(modelShow.value))
+          watchEffect(() => {
+            console.error(getSceneModel(item), 'changeshow', modelShow.value)
+            getSceneModel(item)?.changeShow(modelShow.value)
+          })
           stopLoadedWatch()
         }
       }
@@ -91,22 +95,6 @@ const associationModels = (sdk: SDK) => {
   })
 }
 
-const associationTaggings = (el: HTMLDivElement) => {
-  const getTaggings = () => taggings.value
-  const taggingVMs = new WeakMap<Tagging, ReturnType<typeof mount>>()
-
-  shallowWatchArray(getTaggings, (taggings, oldTaggings) => {
-    const { added, deleted } = diffArrayChange(taggings, oldTaggings)
-    for (const item of added) {
-      taggingVMs.set(toRaw(item), mount(el, TaggingComponent, { tagging: item }))
-    }
-    for (const item of deleted) {
-      const unMount = taggingVMs.get(toRaw(item))
-      unMount && unMount()
-    }
-  })
-}
-
 
 const fullView = async (fn: () => void) => {
   const pop = togetherCallback([
@@ -177,5 +165,7 @@ export const pauseSceneGuide = () => isScenePlayIng.value = false
 
 export const setupAssociation = (mountEl: HTMLDivElement) => {
   associationModels(sdk)
-  associationTaggings(mountEl)
+  const sdkApp = createApp(SDKApp)
+  sdkApp.mount(mountEl)
+  sdkApp.use(Components)
 }

+ 9 - 0
src/sdk/index.vue

@@ -0,0 +1,9 @@
+<template>
+  <Tagging v-for="tagging in taggings" :key="tagging.id" :tagging="tagging" />
+</template>
+
+<script lang="ts" setup>
+import Tagging from '@/components/tagging/list.vue'
+import { taggings } from '@/store'
+
+</script>

+ 2 - 1
src/store/model.ts

@@ -44,11 +44,12 @@ watchPostEffect(() => {
   const loaded = models.value.every(model => model.loaded || model.error)
   modelsLoaded.value = loaded
 })
-watchPostEffect(() => {
+const stopSelectModelWatch = watchPostEffect(() => {
   if (modelsLoaded.value && !custom.currentModel) {
     const defaultModel = models.value.find(model => model.type === ModelType.SWSS)
     if (defaultModel) {
       custom.currentModel = defaultModel
+      stopSelectModelWatch()
     }
   }
 })

+ 1 - 1
src/views/guide/edit-paths.vue

@@ -146,7 +146,7 @@ const addPath = () => {
     current.value = path
     if (paths.value.length > 1) {
       const index = paths.value.length - 2
-      updatePathInfo(index, { speed: paths.value[index].speed })
+      updatePathInfo(index, { time: 3 })
     }
   })
 }

+ 1 - 1
src/views/tagging/images.vue

@@ -38,7 +38,7 @@ export type ImagesProps = {
   hideInfo?: boolean
 }
 
-defineProps<ImagesProps>()
+const props = defineProps<ImagesProps>()
 defineEmits<{
     (e: 'pull', index: number): void
     (e: 'change', i: number): void