From 20cdb83586daabfb15fc056c4c97eb8e7ccaf928 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 20 三月 2026 17:07:16 +0800
Subject: [PATCH] 2026.3.20

---
 src/utils/map/util.js |   93 ++++++++++++++++++++++------------------------
 1 files changed, 45 insertions(+), 48 deletions(-)

diff --git a/src/utils/map/util.js b/src/utils/map/util.js
index 9e83951..9f207c8 100644
--- a/src/utils/map/util.js
+++ b/src/utils/map/util.js
@@ -1,5 +1,5 @@
-import { map, AMap, isDragging } from '@/utils/map/index';
-import marks from '@/utils/map/marks';
+import { map, AMap, isDragging } from '@/utils/map/index'
+import marks from '@/utils/map/marks'
 
 /**
  * 鍧愭爣闆嗗悎鐨勬渶瑗垮崡瑙掑拰鏈�涓滃寳瑙�
@@ -7,35 +7,35 @@
  *  list 鏄帴鍙h幏鍙栫殑鐐� 鐨勬暟缁�
  */
 const getBound = (list) => {
-  const offset = 0.005;
-  let south = null;
-  let west = null;
-  let north = null;
-  let east = null;
+  const offset = 0.05
+  let south = null
+  let west = null
+  let north = null
+  let east = null
   for (let item of list) {
     // 鎺掗櫎鏃犳晥缁忕含搴�
     if (item[0] == 0 && item[1] == 0) {
-      continue;
+      continue
     }
     if ((west && item[0] < west) || !west) {
-      west = item[0] - offset;
+      west = item[0] - offset
     }
     if ((south && item[1] < south) || !south) {
-      south = item[1] - offset;
+      south = item[1] - offset
     }
     if ((east && item[0] > east) || !east) {
-      east = item[0] + offset;
+      east = item[0] + offset
     }
     if ((north && item[1] > north) || !north) {
-      north = item[1] + offset;
+      north = item[1] + offset
     }
   }
   if (!south || !west || !north || !east) {
-    return { sw: null, ne: null };
+    return { sw: null, ne: null }
   } else {
-    return { sw: [west, south], ne: [east, north] };
+    return { sw: [west, south], ne: [east, north] }
   }
-};
+}
 
 /**
  * 鏍规嵁涓績鐐瑰嚭鍙戠殑鍗婂緞锛屽緱鍒板悎閫傜殑鍦板浘缂╂斁绯绘暟
@@ -45,64 +45,61 @@
  */
 const distanceToZoom = (d) => {
   let baseDis = 250,
-    z = 0;
+    z = 0
   while (baseDis < d) {
-    baseDis *= 2;
-    z++;
+    baseDis *= 2
+    z++
   }
 
   // 澶氫綑鐨勫湴鍥剧缉鏀剧郴鏁�
-  const x = (baseDis - d) / (baseDis / 2);
-  z -= x;
-  z = z < 0 ? 0 : z;
+  const x = (baseDis - d) / (baseDis / 2)
+  z -= x
+  z = z < 0 ? 0 : z
 
-  z = 18 - z;
-  z = z < 3 ? 3 : z;
-  return z;
-};
+  z = 18 - z
+  z = z < 3 ? 3 : z
+  return z
+}
 
 export default {
   setCenter(lnglat, ignore = false) {
     if (!ignore && isDragging) {
-      return;
+      return
     }
-    var now = new Date();
-    if (
-      this.lasttime == undefined ||
-      now.getTime() - this.lasttime.getTime() >= 200
-    ) {
-      map.setCenter(lnglat);
-      this.lasttime = now;
+    var now = new Date()
+    if (this.lasttime == undefined || now.getTime() - this.lasttime.getTime() >= 200) {
+      map.setCenter(lnglat)
+      this.lasttime = now
     }
   },
   addViews(view) {
-    map.add(view);
+    map.add(view)
   },
   removeViews(view) {
-    map.remove(view);
+    map.remove(view)
   },
   clearMap() {
-    marks.clearMassMarks();
-    map.clearMap();
+    marks.clearMassMarks()
+    map.clearMap()
   },
   setFitView(views) {
     if (views) {
-      map.setFitView(views);
+      map.setFitView(views)
     } else {
-      map.setFitView();
+      map.setFitView()
     }
   },
   setFitSector({ p, r }) {
-    this.setCenter(p);
-    const z = distanceToZoom(r);
-    map.setZoom(z);
+    this.setCenter(p)
+    const z = distanceToZoom(r)
+    map.setZoom(z)
   },
   setBound(lnglats_GD) {
-    const { sw, ne } = getBound(lnglats_GD);
+    const { sw, ne } = getBound(lnglats_GD)
     if (!sw || !ne) {
-      return;
+      return
     }
-    var mybounds = new AMap.Bounds(sw, ne); // sw, ne > [xxx,xxx], [xxx,xxx]
-    map.setBounds(mybounds);
-  }
-};
+    var mybounds = new AMap.Bounds(sw, ne) // sw, ne > [xxx,xxx], [xxx,xxx]
+    map.setBounds(mybounds)
+  },
+}

--
Gitblit v1.9.3