|
@@ -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)
|
|
|
}
|