bill 10 月之前
父节点
当前提交
b549d34b95
共有 4 个文件被更改,包括 53 次插入51 次删除
  1. 5 5
      src/router/config.ts
  2. 1 1
      src/sdk/association/setting.ts
  3. 1 0
      src/sdk/index.ts
  4. 46 45
      src/views/proportion/index.vue

+ 5 - 5
src/router/config.ts

@@ -52,12 +52,12 @@ export const routes = [
             name: RoutesName.registration,
             component: () => import('@/views/registration/index.vue')
           },
+          {
+            path: paths[RoutesName.proportion],
+            name: RoutesName.proportion,
+            component: () => import('@/views/proportion/index.vue')
+          }
         ]
-      },
-      {
-        path: paths[RoutesName.proportion],
-        name: RoutesName.proportion,
-        component: () => import('@/views/proportion/index.vue')
       }
     ]
   },

+ 1 - 1
src/sdk/association/setting.ts

@@ -23,8 +23,8 @@ export const associationSetting = (sdk: SDK, mountEl: HTMLDivElement) => {
   });
 
   watchEffect(() => {
-    console.log(setting.value!.back);
     const back = setting.value!.back || "map";
+    console.log(setting.value!.back);
     sdk.setBackdrop(
       back,
       back === "map" ? SettingResourceType.map : SettingResourceType.envImage,

+ 1 - 0
src/sdk/index.ts

@@ -27,6 +27,7 @@ const presetViewElement = (layout: HTMLDivElement) => {
 
 
 export const initialSDK: typeof initialSDKRaw = async (props) => {
+  console.log(props)
   const sdk = await initialSDKRaw(props)
   setupAssociation(presetViewElement(props.layout), sdk)
   return sdk

+ 46 - 45
src/views/proportion/index.vue

@@ -1,11 +1,11 @@
 <template>
   <ui-editor-toolbar toolbar v-if="sceneModel">
     <span>长度:</span>
-    <ui-input 
-      type="number" 
-      width="120px" 
-      class="leng-input" 
-      :ctrl="false" 
+    <ui-input
+      type="number"
+      width="120px"
+      class="leng-input"
+      :ctrl="false"
       v-model="length"
     >
       <template #icon>m</template>
@@ -15,74 +15,75 @@
 </template>
 
 <script lang="ts" setup>
-import { Message } from 'bill/index'
-import { useViewStack } from '@/hook'
-import { router, RoutesName } from '@/router'
-import { ref, computed, watch, watchEffect } from 'vue'
-import { getSceneModel } from '@/sdk'
-import { autoSaveFuseModels, FuseModel, getFuseModel, leave } from '@/store'
-import { currentModelStack } from '@/env'
+import { Message } from "bill/index";
+import { useViewStack } from "@/hook";
+import { router, RoutesName } from "@/router";
+import { ref, computed, watch, watchEffect } from "vue";
+import { getSceneModel } from "@/sdk";
+import { autoSaveFuseModels, FuseModel, getFuseModel, leave } from "@/store";
+import { currentModelStack } from "@/env";
 
-import type { ScaleSet } from '@/sdk'
-import { round } from '@/utils'
+import type { ScaleSet } from "@/sdk";
+import { round } from "@/utils";
 
-const isCurrent = computed(() => router.currentRoute.value.name === RoutesName.proportion)
+const isCurrent = computed(
+  () => router.currentRoute.value.name === RoutesName.proportion
+);
 const model = computed(() => {
   if (isCurrent.value) {
-    const modelId = router.currentRoute.value.params.id as string
+    const modelId = router.currentRoute.value.params.id as string;
     if (modelId) {
-      return getFuseModel(modelId)
+      return getFuseModel(modelId);
     }
   }
-})
+});
 
-const sceneModel = computed(() => model.value && getSceneModel(model.value))
+const sceneModel = computed(() => model.value && getSceneModel(model.value));
 
-let scaleSet: ScaleSet | null = null
-const length = ref<number | null>(null)
+let scaleSet: ScaleSet | null = null;
+const length = ref<number | null>(null);
 
 watch(length, () => {
-  const len = length.value
+  const len = length.value;
   if (len !== null) {
-    scaleSet?.setLength(len)
-    length.value = round(len, 2)
+    scaleSet?.setLength(len);
+    length.value = round(len, 2);
   }
-})
+});
 
 const resetMeasure = () => {
-  scaleSet?.startMeasure()
-}
-
+  scaleSet?.startMeasure();
+};
 
 watchEffect((onCleanup) => {
-  const smodel = sceneModel.value
+  const smodel = sceneModel.value;
   if (smodel) {
-    scaleSet = smodel.enterScaleSet()
-    scaleSet.startMeasure()
-    const pop = currentModelStack.push(model as any)
+    scaleSet = smodel.enterScaleSet();
+    scaleSet.startMeasure();
+    const pop = currentModelStack.push(model as any);
 
     onCleanup(() => {
-      smodel.leaveScaleSet()
-      scaleSet = null
-      pop()
-    })
+      smodel.leaveScaleSet();
+      scaleSet = null;
+      pop();
+    });
   } else if (isCurrent.value) {
-    leave()
+    leave();
   }
-})
+});
 
 useViewStack(() => {
-  const hide = Message.show({ msg: '请选择两点标记一段已知长度,并输入真实长度' })
+  const hide = Message.show({ msg: "请选择两点标记一段已知长度,并输入真实长度" });
   return () => {
-    hide()
-    length.value = null
-  }
-})
-useViewStack(autoSaveFuseModels)
+    hide();
+    length.value = null;
+  };
+});
+useViewStack(autoSaveFuseModels);
 </script>
 
 <style lang="scss" scoped>
 .leng-input {
   margin: 0 20px 0 10px;
 }
-</style>
+</style>