From 5cf33b2b4217dbe50e7fa0599e09e0ee8ae63db4 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 15 Feb 2022 15:33:02 +0800
Subject: [PATCH] 样式修改

---
 src/components/mobilemap/index.vue |  141 +++++++++++-----------------------------------
 1 files changed, 34 insertions(+), 107 deletions(-)

diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index a41a9ae..f1560f0 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -31,7 +31,7 @@
     <!-- 盖住左下角 -->
     <div class="cover_mobileMap">智慧社区</div>
     <!-- 指示器 -->
-    <div class="heights">{{ heights }}---{{ heights1 }}</div>
+    <!-- <div class="heights">{{ heights }}---{{ heights1 }}</div> -->
   </div>
 </template>
 <script>
@@ -302,6 +302,24 @@
       });
 
       // 按钮事件
+      let butSetViews = (num) => {
+        viewer.camera.flyTo({
+          destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+            viewer.camera.positionCartographic.longitude,
+            viewer.camera.positionCartographic.latitude,
+            num
+          ),
+          orientation: {
+            // 指向
+            heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+            // 视角
+            pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+            roll: 0.0,
+          },
+          duration: 0.5, // 定位的时间间隔
+        });
+        overii();
+      };
       that.butbut = function () {
         //放大
         document.querySelector(".dc-zoom-controller").children[0].onclick =
@@ -310,60 +328,18 @@
               const height = Math.ceil(
                 viewer.camera.positionCartographic.height
               );
-
-              if (height > 360) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    330
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
-
+              if (height > 180) {
+                butSetViews(160);
                 return;
               }
 
-              if (height > 300) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    270
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
-
+              if (height > 140) {
+                butSetViews(120);
                 return;
               }
 
-              if (height > 240) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    200
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
+              if (height > 100) {
+                butSetViews(80);
               }
             }
           };
@@ -374,56 +350,18 @@
               const height = Math.ceil(
                 viewer.camera.positionCartographic.height
               );
+              console.log(height);
 
-              if (height <= 240) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    270
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
+              if (height <= 100) {
+                butSetViews(120);
               }
 
-              if (height > 240 && height <= 300) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    330
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
+              if (height > 100 && height <= 140) {
+                butSetViews(160);
               }
 
-              if (height > 300 && height < 360) {
-                viewer.camera.setView({
-                  destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
-                    viewer.camera.positionCartographic.longitude,
-                    viewer.camera.positionCartographic.latitude,
-                    400
-                  ),
-                  orientation: {
-                    // 指向
-                    heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
-                    // 视角
-                    pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
-                    roll: 0.0,
-                  },
-                });
+              if (height > 140 && height < 180) {
+                butSetViews(200);
               }
             }
           };
@@ -453,18 +391,6 @@
               },
               duration: 0.5, // 定位的时间间隔
             });
-            // that.$store.dispatch("mapFlyTo", {
-            //   //飞入
-            //   lntLat: [
-            //     viewer.camera.positionCartographic.longitude,
-            //     viewer.camera.positionCartographic.latitude,
-            //     num,
-            //   ],
-            //   heading: 0,
-            //   pitch: -90,
-            //   roll: 0.0,
-            //   noOpen: true,
-            // });
             overii();
           },
           isCameraTime = null;
@@ -478,7 +404,7 @@
             ii++;
             cutHeight = height - startHeight;
             // console.log(cutHeight);
-            console.log(height);
+            // console.log(height);
             that.heights = height;
             that.heights1 = cutHeight;
             // return;
@@ -840,6 +766,7 @@
               video: item.videourl,
               buts: ["定位", "实景", "图集"],
               panoramaurl: item.panoramaurl, //全景
+              fromTo: "mapClick",
             };
             // 定制化窗体
             // console.log(item, useData, "111111");

--
Gitblit v1.9.3