From 07a0b054953d628a1e4b34c88b974166927ea62d Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期二, 30 三月 2021 11:37:46 +0800
Subject: [PATCH] 弹框修改

---
 src/components/BaseNav/SolidWaste/SolidWaste.js |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/components/BaseNav/SolidWaste/SolidWaste.js b/src/components/BaseNav/SolidWaste/SolidWaste.js
index 54107a5..6df5e3e 100644
--- a/src/components/BaseNav/SolidWaste/SolidWaste.js
+++ b/src/components/BaseNav/SolidWaste/SolidWaste.js
@@ -52,20 +52,24 @@
         // var url = Icon.options.iconUrl
 
         const marker = this.L.marker([positionX, positionY], { icon: Icon })
-
         // 鍒掕繃鍑虹幇 灞曠ず鏁版嵁
         marker.bindTooltip(data[i].Name, {
           permanent: true,
-          offset: [0, 16],
-          direction: 'bottom',
+          offset: [0, -16],
+          direction: 'top',
           className: ''
         })
         // 鐐瑰嚮 浜嬩欢
         marker.on('click', (e) => {
           try {
-            console.log(e)
+            // console.log(e)
+            // console.log(this.map.getCenter())
+            // console.log(this.map.setCenter([e.target.getLatLng().lat, e.target.getLatLng().lng]))
+            // this.map.flyTo([e.target.getLatLng().lat, e.target.getLatLng().lng])
+            // this.map.panTo([e.target.getLatLng().lat, e.target.getLatLng().lng], 100)
+            this.setPanTo(e.target.getLatLng(), 30)
             this.EffectOfPulse(e.target.getLatLng())
-            this.SolidWastePopup.setData(data[i])
+            this.SolidWastePopup.setData(data[i], 'gufei')
             return this.SolidWastePopup.$el
           } catch (error) {
             console.log(error)
@@ -75,6 +79,16 @@
         this.SolidWasteLayerGroup.addLayer(marker)
       }
     }
+  }
+
+  // panTo
+  setPanTo (pos, value) {
+    var position = pos
+    position = this.map.latLngToLayerPoint(position)
+    position.y += value
+    position = this.map.layerPointToLatLng(position)
+    this.map.setView(position)
+    // this.map.flyTo(position)
   }
 
   // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃�
@@ -106,7 +120,7 @@
 
   // 鑴夊啿鏁堟灉璁剧疆瀹炵幇
   EffectOfPulse (position, markers, layerGroup) {
-    // // 鍖哄垎鐩存帴鎵ц 鍜屽垽鏂墽琛岀殑涓嶅悓鍖哄埆
+    // 鍖哄垎鐩存帴鎵ц 鍜屽垽鏂墽琛岀殑涓嶅悓鍖哄埆
     var differentColor = ''
     if (markers) {
       differentColor = '#ff0000'
@@ -140,7 +154,6 @@
     var HeightLightTime = 5
     var PulseNumber = 5
     const pulseinterver = setInterval((e) => {
-      console.log(e)
       if (PulseNumber > 0) {
         PulseNumber--
       } else {

--
Gitblit v1.8.0