Browse Source

重新计算了extent

napier 3 years ago
parent
commit
4a3fc2e676
1 changed files with 8 additions and 13 deletions
  1. 8 13
      src/components/map.vue

+ 8 - 13
src/components/map.vue

@@ -213,27 +213,22 @@ export default {
      */
     initMap: function () {
       // PNG范围
-      let leftTop = [11592187.538105225, 3592590.111732335]
-      let rightBottom = [11594513.693708975, 3587420.877057335]
-      // 经纬度
-      // let leftTop = [104.13439162531515, 30.690273107307597]
-      // let rightBottom = [104.15523854491164, 30.650437034690334]
+      let leftTop = [11592477.7183495723, 3592272.11710943282]
+      let rightBottom = [11594803.873953322, 3587102.882434433]
+      // extent 右下角
       rightBottom = this.getExtentFromPNG(leftTop, rightBottom)
-      // leftTop = olProj.fromLonLat(leftTop)
-      // rightBottom = olProj.fromLonLat(rightBottom)
       // 根据设备的不同设置地图范围
       const MOBILE = [leftTop[0], rightBottom[1], rightBottom[0], leftTop[1]]
-      // const PC = [11591064, 3589994, 11595665, 3592078]
-      const PC = [11591064, 3589994, 11596565, 3592078]
+      const PC = [11591354.180244347,
+        3589676.005377098,
+        11596855.180244347,
+        3591760.005377098
+      ]
       let extent = this.$store.state.isMobile ? MOBILE : PC
       let center = [
         (extent[0] + extent[2]) / 2,
         (extent[1] + extent[3]) / 2
       ]
-      // let center = [
-      //   (leftTop[0] + rightBottom[0]) / 2,
-      //   (leftTop[1] + rightBottom[1]) / 2
-      // ]
       let zoom = this.$store.state.isMobile ? 14.5 : 15.5
 
       map = new Map({