|
|
@@ -25,7 +25,7 @@ import { currentLayout, RoutesName } from "@/router";
|
|
|
import { unsetFactory } from "@/utils/unset";
|
|
|
import { getTaggingPosNode, taggingGroup } from "./tagging";
|
|
|
|
|
|
-export const us = unsetFactory()
|
|
|
+export const us = unsetFactory();
|
|
|
|
|
|
// -----------------模型关联--------------------
|
|
|
|
|
|
@@ -62,8 +62,7 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
const itemRaw = toRaw(item);
|
|
|
let sceneModel: SceneModel;
|
|
|
try {
|
|
|
-
|
|
|
- console.error('addMode', itemRaw)
|
|
|
+ console.error("addMode", itemRaw);
|
|
|
sceneModel = sdk.addModel({
|
|
|
...itemRaw,
|
|
|
...modelRange,
|
|
|
@@ -87,10 +86,12 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
|
|
|
sceneModelMap.set(itemRaw, sceneModel);
|
|
|
|
|
|
- let stop = true
|
|
|
- setTimeout(() => {
|
|
|
- stop = false
|
|
|
- }, 3000)
|
|
|
+ let stop = true;
|
|
|
+ sceneModel.bus.on("loadDone", () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ stop = false;
|
|
|
+ }, 3000);
|
|
|
+ });
|
|
|
let changeId: NodeJS.Timeout;
|
|
|
sceneModel.bus.on("transformChanged", (transform) => {
|
|
|
clearTimeout(changeId);
|
|
|
@@ -117,9 +118,9 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
if (transform.scale) {
|
|
|
transform.scale = round(transform.scale, 2);
|
|
|
|
|
|
- taggingPositions.value.forEach(position => {
|
|
|
- getTaggingPosNode(position)?.bus.emit('scaleChanged', true)
|
|
|
- })
|
|
|
+ taggingPositions.value.forEach((position) => {
|
|
|
+ getTaggingPosNode(position)?.bus.emit("scaleChanged", true);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
const updateKeys = Object.keys(transform);
|
|
|
@@ -129,13 +130,12 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
}
|
|
|
|
|
|
if (deepIsRevise(update, transform)) {
|
|
|
- console.error('change', item)
|
|
|
+ console.error("change", item);
|
|
|
if (stop) {
|
|
|
us.unSet(() => Object.assign(item, transform));
|
|
|
} else {
|
|
|
- Object.assign(item, transform)
|
|
|
+ Object.assign(item, transform);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}, 16);
|
|
|
});
|
|
|
@@ -143,11 +143,11 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
sceneModel.bus.on("changeSelect", (select) => {
|
|
|
us.unSet(() => {
|
|
|
// if (custom.showMode === "fuse") {
|
|
|
- if (custom.currentModel === item && !select) {
|
|
|
- custom.currentModel = null;
|
|
|
- } else if (custom.currentModel !== item && select) {
|
|
|
- custom.currentModel = item;
|
|
|
- }
|
|
|
+ if (custom.currentModel === item && !select) {
|
|
|
+ custom.currentModel = null;
|
|
|
+ } else if (custom.currentModel !== item && select) {
|
|
|
+ custom.currentModel = item;
|
|
|
+ }
|
|
|
// }
|
|
|
});
|
|
|
});
|
|
|
@@ -175,7 +175,7 @@ const setModels = (sdk: SDK, models: FuseModels, oldModels: FuseModels) => {
|
|
|
export const activeModel = (status: {
|
|
|
showMode: "fuse" | "pano";
|
|
|
active?: FuseModel;
|
|
|
- fore?: boolean
|
|
|
+ fore?: boolean;
|
|
|
}) => {
|
|
|
const oldStatus = {
|
|
|
showMode: custom.showMode,
|
|
|
@@ -198,30 +198,31 @@ export const activeModel = (status: {
|
|
|
if (model && status.active === oldStatus.active) {
|
|
|
if (status.showMode === "pano") {
|
|
|
if (model) {
|
|
|
- console.error('--->', model)
|
|
|
- model.changeSelect(false)
|
|
|
+ console.error("--->", model);
|
|
|
+ model.changeSelect(false);
|
|
|
model.flyInPano();
|
|
|
}
|
|
|
} else {
|
|
|
if (model) {
|
|
|
model.flyOutPano();
|
|
|
- custom.currentModel === status.active && model.changeSelect(true)
|
|
|
+ custom.currentModel === status.active && model.changeSelect(true);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (oldStatus.showMode !== status.showMode) {
|
|
|
if (oldStatus.showMode === "pano") {
|
|
|
if (oldModel) {
|
|
|
- console.error('---> a', oldModel)
|
|
|
+ console.error("---> a", oldModel);
|
|
|
oldModel.flyOutPano();
|
|
|
- custom.currentModel === oldStatus.active && oldModel.changeSelect(true)
|
|
|
+ custom.currentModel === oldStatus.active &&
|
|
|
+ oldModel.changeSelect(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (status.showMode === "pano") {
|
|
|
if (model) {
|
|
|
- console.error('---> b', oldModel)
|
|
|
- model.changeSelect(false)
|
|
|
+ console.error("---> b", oldModel);
|
|
|
+ model.changeSelect(false);
|
|
|
model.flyInPano();
|
|
|
}
|
|
|
} else {
|
|
|
@@ -231,7 +232,7 @@ export const activeModel = (status: {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
if (status.showMode !== "pano" && model) {
|
|
|
- if (oldStatus.showMode !== 'pano' || status.fore) {
|
|
|
+ if (oldStatus.showMode !== "pano" || status.fore) {
|
|
|
model && model.changeSelect(true);
|
|
|
}
|
|
|
}
|
|
|
@@ -244,19 +245,22 @@ export const activeModel = (status: {
|
|
|
export const associationModels = (sdk: SDK) => {
|
|
|
sdk.sceneBus.on("modeChange", (data) => {
|
|
|
if (data.active || data.model) {
|
|
|
- activeModel({ active: getFuseModel(data.active || data.model)!, showMode: data.mode })
|
|
|
+ activeModel({
|
|
|
+ active: getFuseModel(data.active || data.model)!,
|
|
|
+ showMode: data.mode,
|
|
|
+ });
|
|
|
}
|
|
|
custom.showMode = data.mode;
|
|
|
|
|
|
- console.error('modeChange', data, (data.active || data.model))
|
|
|
- if ((data.active || data.model) && data.mode === 'pano') {
|
|
|
- (data.active || data.model).changeSelect(false)
|
|
|
+ console.error("modeChange", data, data.active || data.model);
|
|
|
+ if ((data.active || data.model) && data.mode === "pano") {
|
|
|
+ (data.active || data.model).changeSelect(false);
|
|
|
}
|
|
|
});
|
|
|
sdk.sceneBus.on("panoModelChange", (data) => {
|
|
|
custom.showMode = "pano";
|
|
|
custom.currentModel = getFuseModel(data)!;
|
|
|
- data.changeSelect(false)
|
|
|
+ data.changeSelect(false);
|
|
|
// activeModel({ active: getFuseModel(data)!, showMode: 'pano' })
|
|
|
});
|
|
|
|
|
|
@@ -288,15 +292,19 @@ export const associationModels = (sdk: SDK) => {
|
|
|
watch(
|
|
|
() => item.scale,
|
|
|
() => {
|
|
|
- us.isUnSet || getSceneModel(item)?.changeScale(item.scale)
|
|
|
+ us.isUnSet || getSceneModel(item)?.changeScale(item.scale);
|
|
|
}
|
|
|
// { immediate: true }
|
|
|
- );
|
|
|
+ );
|
|
|
watch(
|
|
|
() => item.position,
|
|
|
() => {
|
|
|
if (!us.isUnSet) {
|
|
|
- console.log('position', item.raw.modelTitle, toRaw(item.position))
|
|
|
+ console.log(
|
|
|
+ "position",
|
|
|
+ item.raw.modelTitle,
|
|
|
+ toRaw(item.position)
|
|
|
+ );
|
|
|
getSceneModel(item)?.changePosition(item.position);
|
|
|
}
|
|
|
}
|
|
|
@@ -331,22 +339,21 @@ export const associationModels = (sdk: SDK) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-
|
|
|
export const getSupportPano = (model: FuseModel) => {
|
|
|
-const supportPano = ref(false);
|
|
|
-const show = getFuseModelShowVariable(model);
|
|
|
-watchEffect(() => {
|
|
|
- if (!show.value) {
|
|
|
- supportPano.value = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- const sceneModel = getSceneModel(model);
|
|
|
- const support = sceneModel?.supportPano();
|
|
|
- supportPano.value = !!support;
|
|
|
+ const supportPano = ref(false);
|
|
|
+ const show = getFuseModelShowVariable(model);
|
|
|
+ watchEffect(() => {
|
|
|
+ if (!show.value) {
|
|
|
+ supportPano.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const sceneModel = getSceneModel(model);
|
|
|
+ const support = sceneModel?.supportPano();
|
|
|
+ supportPano.value = !!support;
|
|
|
|
|
|
- sceneModel?.bus.on("loadDone", () => {
|
|
|
- supportPano.value = sceneModel?.supportPano();
|
|
|
+ sceneModel?.bus.on("loadDone", () => {
|
|
|
+ supportPano.value = sceneModel?.supportPano();
|
|
|
+ });
|
|
|
});
|
|
|
-});
|
|
|
-return supportPano
|
|
|
-}
|
|
|
+ return supportPano;
|
|
|
+};
|