|
@@ -1,6 +1,6 @@
|
|
|
import { sdk } from './sdk'
|
|
|
import { fuseModels, taggings, isEdit, sysBus, getFuseModelShowVariable, SceneType } from '@/store'
|
|
|
-import { toRaw, watchEffect, ref, watch, nextTick } from 'vue'
|
|
|
+import { toRaw, ref, watch, nextTick } from 'vue'
|
|
|
import { viewModeStack, custom, getResource } from '@/env'
|
|
|
import {
|
|
|
mount,
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
shallowWatchArray,
|
|
|
arrayChildEffectScope,
|
|
|
showLoad,
|
|
|
- hideLoad
|
|
|
+ hideLoad,
|
|
|
+ deepIsRevise,
|
|
|
+ round
|
|
|
} from '@/utils'
|
|
|
|
|
|
import TaggingComponent from '@/components/tagging/list.vue'
|
|
@@ -53,8 +55,32 @@ const associationModels = (sdk: SDK) => {
|
|
|
sceneModelMap.set(itemRaw, sceneModel)
|
|
|
|
|
|
sceneModel.bus.on('transformChanged', transform => {
|
|
|
- unSet(() => Object.assign(item, transform))
|
|
|
+ transform = { ...transform }
|
|
|
+ if (transform.rotation) {
|
|
|
+ transform.rotation = {
|
|
|
+ x: round(transform.rotation.x, 5),
|
|
|
+ y: round(transform.rotation.y, 5),
|
|
|
+ z: round(transform.rotation.z, 5),
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (transform.position) {
|
|
|
+ transform.position = {
|
|
|
+ x: round(transform.position.x, 5),
|
|
|
+ y: round(transform.position.y, 5),
|
|
|
+ z: round(transform.position.z, 5),
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const updateKeys = Object.keys(transform)
|
|
|
+ const update: any = {}
|
|
|
+ for (const key of updateKeys) {
|
|
|
+ update[key] = (item as any)[key]
|
|
|
+ }
|
|
|
+ if (deepIsRevise(update, transform)) {
|
|
|
+ unSet(() => Object.assign(item, transform))
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
sceneModel.bus.on('changeSelect', select => {
|
|
|
if (custom.currentModel === item && !select) {
|
|
|
custom.currentModel = null
|
|
@@ -89,8 +115,8 @@ const associationModels = (sdk: SDK) => {
|
|
|
watch(() => item.bottom, () => isUnSet || getSceneModel(item)?.changeBottom(item.bottom), {immediate: true})
|
|
|
watch(() => item.opacity, () => isUnSet || getSceneModel(item)?.changeOpacity(item.opacity), {immediate: true})
|
|
|
watch(() => item.scale, () => isUnSet || getSceneModel(item)?.changeScale(item.scale), {immediate: true})
|
|
|
- watch(() => item.position, () => isUnSet || getSceneModel(item)?.changePosition(item.position), {immediate: true})
|
|
|
- watch(() => item.rotation, () => isUnSet || getSceneModel(item)?.changeRotation(item.rotation), {immediate: true})
|
|
|
+ // watch(() => item.position, () => isUnSet || getSceneModel(item)?.changePosition(item.position), {immediate: true})
|
|
|
+ // watch(() => item.rotation, () => isUnSet || getSceneModel(item)?.changeRotation(item.rotation), {immediate: true})
|
|
|
watch(() => modelShow.value, () => isUnSet || getSceneModel(item)?.changeShow(modelShow.value), {immediate: true})
|
|
|
stopLoadedWatch()
|
|
|
}
|