|
@@ -32,32 +32,30 @@ const Canvas3d = defineComponent({
|
|
|
emits: ["init"],
|
|
|
setup(props, { emit }) {
|
|
|
const state = reactive({ loaded: false });
|
|
|
- const { actions, components } = useQueditor();
|
|
|
- actions.initPack(props.pack);
|
|
|
- // const hooks = useScenePackPreview(props.pack, "1", {
|
|
|
- // onPackLoaded: () => {
|
|
|
- // const app = queen3d.getAppInstance();
|
|
|
- // if (!app) return;
|
|
|
-
|
|
|
- // // app.setNoZoom(true);
|
|
|
- // app.setNoPan(true);
|
|
|
-
|
|
|
- // app.getFeaturesManager()?.enableGizmo(false);
|
|
|
- // queen3d.setControllerZoom(0.5, 7);
|
|
|
- // let target = osg.vec3.create();
|
|
|
- // queen3d.getControllerTarget(target);
|
|
|
- // target[0] = 0;
|
|
|
- // target[1] = 0;
|
|
|
- // console.log(target);
|
|
|
- // queen3d.setControllerTarget(target);
|
|
|
-
|
|
|
- // queen3d.picker.enable = false;
|
|
|
- // queen3d.redraw();
|
|
|
- // state.loaded = true;
|
|
|
- // emit("init", true);
|
|
|
- // },
|
|
|
- // backgroundTransparent: true,
|
|
|
- // });
|
|
|
+ const { actions, components, controls, store } = useQueditor();
|
|
|
+ store.showLoading = false;
|
|
|
+ const initQueen = async () => {
|
|
|
+ actions.initPack(props.pack.source);
|
|
|
+ actions.on("initQueen3dScene:success", () => {
|
|
|
+ const queen3d = controls.queen3dCtrl.queen3d;
|
|
|
+ const app = controls.queen3dCtrl.queen3d.getAppInstance();
|
|
|
+
|
|
|
+ app.setNoPan(true);
|
|
|
+
|
|
|
+ queen3d.setTransparntBg();
|
|
|
+
|
|
|
+ queen3d.setControllerZoom(0.5, 6);
|
|
|
+
|
|
|
+ if (queen3d.picker) {
|
|
|
+ queen3d.picker.enable = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ queen3d.redraw();
|
|
|
+ state.loaded = true;
|
|
|
+ emit("init", true);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ initQueen();
|
|
|
|
|
|
return () => (
|
|
|
<components.Viewport.Canvas
|
|
@@ -76,8 +74,8 @@ export default defineComponent({
|
|
|
const state = reactive({ loaded: false, loading: true });
|
|
|
const { actions } = useList();
|
|
|
onMounted(async () => {
|
|
|
- packRef.value = await actions.loadPack3d({ meshId: meshId } as any);
|
|
|
-
|
|
|
+ const res = await actions.loadPack3d({ meshId: meshId } as any);
|
|
|
+ packRef.value = res?.data;
|
|
|
state.loaded = true;
|
|
|
document.addEventListener("mousedown", () => {
|
|
|
window.parent.postMessage(JSON.stringify({ type: "start", dialogId }));
|
|
@@ -93,33 +91,36 @@ export default defineComponent({
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- return () => (
|
|
|
- <>
|
|
|
- {state.loaded && (
|
|
|
- <Canvas3d
|
|
|
- pack={packRef.value}
|
|
|
- onInit={(v) => {
|
|
|
- state.loading = false;
|
|
|
- }}
|
|
|
- />
|
|
|
- )}
|
|
|
- {state.loading && (
|
|
|
- <Spin
|
|
|
- class={loadingStyle}
|
|
|
- indicator={
|
|
|
- <LoadingOutlined style={{ fontSize: "40px", color: "#fff" }} />
|
|
|
- }
|
|
|
- />
|
|
|
- )}
|
|
|
- </>
|
|
|
- );
|
|
|
+ return () => {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ {state.loaded && (
|
|
|
+ <Canvas3d
|
|
|
+ pack={packRef.value}
|
|
|
+ onInit={(v) => {
|
|
|
+ state.loading = false;
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+
|
|
|
+ {state.loading && (
|
|
|
+ <Spin
|
|
|
+ class={loadingStyle}
|
|
|
+ indicator={
|
|
|
+ <LoadingOutlined style={{ fontSize: "40px", color: "#fff" }} />
|
|
|
+ }
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ );
|
|
|
+ };
|
|
|
},
|
|
|
});
|
|
|
|
|
|
-const rootStyle = css`
|
|
|
- padding: 30px;
|
|
|
- background-color: red;
|
|
|
-`;
|
|
|
+// const rootStyle = css`
|
|
|
+// padding: 30px;
|
|
|
+// background-color: red;
|
|
|
+// `;
|
|
|
|
|
|
const loadingStyle = css`
|
|
|
position: absolute;
|