Преглед изворни кода

模块切换视角恢复初始值

lkk пре 6 месеци
родитељ
комит
599629398c
1 измењених фајлова са 21 додато и 6 уклоњено
  1. 21 6
      src/views/map3d.vue

+ 21 - 6
src/views/map3d.vue

@@ -189,26 +189,42 @@ export default {
     this.updateTime();
     this.updateTime();
   },
   },
   methods: {
   methods: {
+    getFly() {
+      viewer.camera.flyTo({
+        //定位到范围中心点
+        destination: {
+          x: -2040463.7901390342,
+          y: 5793227.819015942,
+          z: 1894583.1762108966,
+        },
+        orientation: {
+          heading: 0.000005686606919574899,
+          pitch: -0.41034310444770905,
+          roll: 0.0,
+        },
+      });
+    },
     viewerChange(isbig) {
     viewerChange(isbig) {
       // this.$refs.routeViewRef[ isbig ? 'switchPack_down':'switchPack_up']()
       // this.$refs.routeViewRef[ isbig ? 'switchPack_down':'switchPack_up']()
       this.$refs.routeViewRef["switch"]();
       this.$refs.routeViewRef["switch"]();
     },
     },
     handleMenuSelect(item) {
     handleMenuSelect(item) {
       this.$router.push({ path: item });
       this.$router.push({ path: item });
-
+      this.getFly();
       // 菜单切换的时候取消左或者右高亮菜单
       // 菜单切换的时候取消左或者右高亮菜单
-      var lis = document.querySelectorAll('.el-menu-demo1 li');
+      var lis = document.querySelectorAll(".el-menu-demo1 li");
       // console.log(lis, "lis");
       // console.log(lis, "lis");
 
 
       lis.forEach(function (li) {
       lis.forEach(function (li) {
-        li.classList.remove('is-active');
+        li.classList.remove("is-active");
       });
       });
     },
     },
     handleMenuSelect1(item) {
     handleMenuSelect1(item) {
       this.$router.push({ path: item });
       this.$router.push({ path: item });
-      var lis = document.querySelectorAll('.el-menu-demo li');
+      this.getFly();
+      var lis = document.querySelectorAll(".el-menu-demo li");
       lis.forEach(function (li) {
       lis.forEach(function (li) {
-        li.classList.remove('is-active');
+        li.classList.remove("is-active");
       });
       });
     },
     },
     updateTime() {
     updateTime() {
@@ -565,7 +581,6 @@ export default {
   border: none !important;
   border: none !important;
   text-align: center !important;
   text-align: center !important;
 }
 }
-
 </style>
 </style>
 <style>
 <style>
 .el-menu--popup {
 .el-menu--popup {