Browse Source

地图层级修改

wenhongquan 2 years ago
parent
commit
8b10761551
2 changed files with 10 additions and 9 deletions
  1. 1 1
      src/components/MapView/index.tsx
  2. 9 8
      src/components/MarkerMap/index.tsx

+ 1 - 1
src/components/MapView/index.tsx

@@ -91,7 +91,7 @@ export default defineComponent({
           '/service/solu/style/id/' +
           (import.meta.env.VITE_MAP_SOLUTION as string) /*底图样式*/,
         center: [118.29564, 33.97441] /*地图中心点*/,
-        zoom: 11 /*地图默认缩放等级*/,
+        zoom: 16 /*地图默认缩放等级*/,
         pitch: 0 /*地图俯仰角度*/,
         maxZoom: 17 /*地图最大缩放等级*/,
         minZoom: 3 /*地图最小缩放等级*/,

+ 9 - 8
src/components/MarkerMap/index.tsx

@@ -929,16 +929,17 @@ export default defineComponent({
 
       
       handleFitBounds();
-      
-      try {
-        state.map?.setZoom(11);
-        state.map?.setCenter({
-          lng: parseFloat(markers[0].locations?.split(',')[0] ?? '0'),
-          lat: parseFloat(markers[0].locations?.split(',')[1] ?? '0'),
-        });
+      if (type === '应急事件') {
+        try {
+          state.map?.setZoom(14);
+          state.map?.setCenter({
+            lng: parseFloat(markers[0].locations?.split(',')[0] ?? '0'),
+            lat: parseFloat(markers[0].locations?.split(',')[1] ?? '0'),
+          });
         
-      } catch (E) { 
+        } catch (E) {
 
+        }
       }