DESKTOP-6LTVLN7\Liumouren 2 rokov pred
rodič
commit
b7bdc0b1b7
1 zmenil súbory, kde vykonal 7 pridanie a 6 odobranie
  1. 7 6
      src/components/map/MapHolder.vue

+ 7 - 6
src/components/map/MapHolder.vue

@@ -558,10 +558,9 @@ export default {
 
       map2DViewer.map = L.map("map2DViewer", {
         crs: crs,
-        center: [31.074472887639914, 121.72521988031804],
-        zoom: 1,
-        minZoom: 0,
-        maxZoom: 9,
+        zoom: 2,
+        minZoom: 1,
+        maxZoom: 6,
         attributionControl: false,
         zoomControl: false
         // preferCanvas: true,
@@ -656,7 +655,7 @@ export default {
     },
     setView: function (coord, zoom) {
       // console.log(coord, "位置");
-      let center = L.latLng(coord[0], coord[1]);
+      let center = L.latLng(coord[0]-0.1915, coord[1]);
       map2DViewer.map.setView(center, zoom);
     },
     renderPolygon: function (feature) {
@@ -676,8 +675,9 @@ export default {
       }).addTo(map2DViewer.groups["浦东新区_polygon"]);
 
       center = JSON.parse(JSON.stringify(center)).geometry.coordinates;
+      center[0] -= 0.1915;
       // center = coordinate.wgs84_to_shcj(center[0],center[1]);
-      center = this.w84Proj4ToShanghai(center);
+      // center = this.w84Proj4ToShanghai(center);
       console.log("center",center);
 
       center.reverse();
@@ -712,6 +712,7 @@ export default {
     latLngsToReverse: function (latlngsAry) {
       var tempLatlngsAry = JSON.parse(JSON.stringify(latlngsAry));
       if (typeof tempLatlngsAry[0] != "object") {
+        tempLatlngsAry[0] -= 0.1915;
         return tempLatlngsAry.reverse();
       } else {
         for (var i = 0, l = tempLatlngsAry.length; i < l; i++) {