From d7bbfe6156fa57f9ce5b1771a9c09498faaf91a9 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 07 Mar 2023 11:21:19 +0800
Subject: [PATCH] 视角开关锁定

---
 src/components/map/index.vue |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 390898b..fddbd59 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2022-08-18 17:00:30
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-03-07 10:56:33
+ * @LastEditTime: 2023-03-07 11:18:45
  * @FilePath: \srs-police-affairs\src\components\map\index.vue
  * @Description: 公用地图组件
  * 
@@ -54,6 +54,9 @@
                             <span :class="{ on: tilesetLayerType == 'high' }">高精</span>
                         </div>
                     </div>
+                </div>
+                <div class="angle-btn">
+                    是否锁定视角:<el-checkbox v-model="angleCheck" @change="angleChange"></el-checkbox>
                 </div>
             </div>
         </div>
@@ -206,7 +209,8 @@
             carTotal: 0,
             showImgBtn: false,
             imgtype: 0,
-            tilesetLayerType: ''
+            tilesetLayerType: '',
+            angleCheck: true
         }
     },
 
@@ -525,6 +529,25 @@
     },
 
     methods: {
+        angleChange (e) {
+            if (e) {
+                global.viewer.camera.flyTo({
+                    destination: global.viewer.camera.position,
+                    orientation: {
+                        heading: global.viewer.camera.heading,
+                        pitch: -45,
+                        roll: global.viewer.camera.roll
+                    },
+                    duration: 0.0
+                })
+
+                global.viewer.setPitchRange(-90, -45)
+            } else {
+                global.viewer.setPitchRange(-90, 0)
+            }
+
+            this.showImgBtn = false
+        },
         /**
          * @description: 高精度模型和轻量模型切换
          * @param {*} type

--
Gitblit v1.9.3