bill 7 months ago
parent
commit
1c205a90a2
6 changed files with 58 additions and 13 deletions
  1. BIN
      public/images/satellite.jpg
  2. BIN
      public/images/standard.jpg
  3. 46 0
      src/app.vue
  4. 0 3
      src/sdk/association/setting.ts
  5. 3 1
      src/sdk/index.ts
  6. 9 9
      src/store/path.ts

BIN
public/images/satellite.jpg


BIN
public/images/standard.jpg


+ 46 - 0
src/app.vue

@@ -24,6 +24,14 @@
           <!-- </keep-alive> -->
         </router-view>
       </div>
+
+      <span
+        class="taggle map-type"
+        @click="isStandard = !isStandard"
+        @touchend="isStandard = !isStandard"
+      >
+        <img :src="isStandard ? '/images/satellite.jpg' : '/images/standard.jpg'" />
+      </span>
     </ui-editor-layout>
 
     <PwdModel v-if="inputPwd" @close="inputPwd = false" />
@@ -39,6 +47,14 @@ import { loadPack, needMounts } from "@/utils";
 import { ConfigProvider } from "ant-design-vue";
 import PwdModel from "@/layout/pwd.vue";
 import { config } from "./config";
+import { sdk, sdkLoaded } from "./sdk";
+
+const isStandard = ref(true);
+watchEffect(() => {
+  if (sdkLoaded.value) {
+    sdk.switchMapType(isStandard.value ? "satellite" : "standard");
+  }
+});
 
 const loaded = ref(false);
 const inputPwd = ref(false);
@@ -147,4 +163,34 @@ const layoutStyles = computed(() => {
     background-color: #ccc;
   }
 }
+
+.taggle {
+  position: absolute;
+  font-size: 16px;
+  color: #fff;
+  background: rgba(0, 0, 0, 0.2);
+  z-index: 9999999;
+  width: 30px;
+  height: 30px;
+  display: flex;
+  align-items: center;
+  overflow: hidden;
+  justify-content: center;
+  border-radius: 3px;
+  cursor: pointer;
+
+  &.map-type {
+    transition: all 0.3s ease;
+    top: calc(var(--header-top) + var(--editor-head-height) + 10px);
+    right: calc(var(--editor-toolbox-width) + var(--editor-menu-right) + 10px);
+    width: 42px;
+    height: 42px;
+
+    img {
+      width: 100%;
+      height: 100%;
+      object-fit: cover;
+    }
+  }
+}
 </style>

+ 0 - 3
src/sdk/association/setting.ts

@@ -7,9 +7,6 @@ export const associationSetting = (sdk: SDK, mountEl: HTMLDivElement) => {
   watchEffect(() => {
     setting.value?.fov && sdk.setCameraFov(setting.value.fov);
   });
-  watchEffect(() => {
-    setting.value?.mapType && sdk.switchMapType && sdk.switchMapType(setting.value.mapType);
-  });
   sdk.hideGrid()
 
   const stopWatchPose = watchEffect(() => {

+ 3 - 1
src/sdk/index.ts

@@ -1,5 +1,6 @@
 import { initialSDK as initialSDKRaw, sdk } from './sdk'
 import { setupAssociation } from './association'
+import { ref } from 'vue'
 
 
 //import * as GaussianSplats3D from '@/assets//lib/gaussian/gaussian-splats-3d.module.js' 
@@ -25,11 +26,12 @@ const presetViewElement = (layout: HTMLDivElement) => {
   return el
 }
 
+export const sdkLoaded = ref(false)
 
 export const initialSDK: typeof initialSDKRaw = async (props) => {
-  console.log(props)
   const sdk = await initialSDKRaw(props)
   setupAssociation(presetViewElement(props.layout), sdk)
+  sdkLoaded.value = true
   return sdk
 }
 

+ 9 - 9
src/store/path.ts

@@ -32,15 +32,15 @@ export const getPathIsShow = (path: Path) => {
   if (!custom.showPaths && custom.showPath !== path.id) return false;
 
   return true;
-  const modelIds = path.points.map(item => item.modelId)
-  if (path.linePosition?.modelId) {
-    modelIds.push(path.linePosition.modelId)
-  }
-  return modelIds.every(modelId =>  {
-    if (modelId === '-100') return true;
-    const model = getFuseModel(modelId)
-    return model && getFuseModelShowVariable(model).value
-  })
+  // const modelIds = path.points.map(item => item.modelId)
+  // if (path.linePosition?.modelId) {
+  //   modelIds.push(path.linePosition.modelId)
+  // }
+  // return modelIds.every(modelId =>  {
+  //   if (modelId === '-100') return true;
+  //   const model = getFuseModel(modelId)
+  //   return model && getFuseModelShowVariable(model).value
+  // })
 }
 
 export const createPath = (path: Partial<Path> = {}): Path => {