Browse Source

地图调整

lipenghui 1 month ago
parent
commit
9249f2d2c0
1 changed files with 5 additions and 9 deletions
  1. 5 9
      src/views/pms/map/Map.vue

+ 5 - 9
src/views/pms/map/Map.vue

@@ -56,7 +56,7 @@ const initMap = () => {
     if ((window as any).BMap) {
       map.value = new (window as any).BMap.Map(mapContainer.value)
       const point = new (window as any).BMap.Point(104.114129, 37.550339)
-      map.value.centerAndZoom(point, 5)
+      map.value.centerAndZoom(point, 5.5)
 
       map.value.enableScrollWheelZoom(true)
       map.value.setMapType((window as any)[mapType.value])
@@ -85,7 +85,7 @@ const initDeviceMarkers = () => {
 
   const zoomLevel = map.value.getZoom()
   debugger
-  if (zoomLevel > 12) {
+  if (zoomLevel > 9) {
     // 高缩放级别下显示单个设备标记
     devices.value.forEach((device) => {
       const point = new (window as any).BMap.Point(device.lng, device.lat)
@@ -238,14 +238,10 @@ const clusterDevices = (devices: IotDeviceVO[], map: any): Cluster[] => {
 }
 
 const getGridSize = (zoom: number): number => {
-  if (zoom <= 5) return 3
-  if (zoom <= 7) return 2
+  if (zoom <= 5) return 2
   if (zoom <= 8) return 1
-  if (zoom <= 9) return 0.09
-  if (zoom <= 10) return 0.08
-  if (zoom < 12) return 0.06
-  if (zoom < 15) return 0.02
-  return 0.01
+  if (zoom < 10) return 0.03
+  return 0.1
 }
 
 const showDeviceInfoWindow = (device: IotDeviceVO, point: any) => {