From 73c8d3f55d5a675174a61342f3cea712ed5bc0eb Mon Sep 17 00:00:00 2001
From: QibolinCzp <qibolin02429@126.com>
Date: 星期五, 14 五月 2021 10:49:54 +0800
Subject: [PATCH] 问题修改

---
 src/components/LayerController/service/AnimalService.js |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/components/LayerController/service/AnimalService.js b/src/components/LayerController/service/AnimalService.js
index 9a80b7f..3de6468 100644
--- a/src/components/LayerController/service/AnimalService.js
+++ b/src/components/LayerController/service/AnimalService.js
@@ -4,8 +4,9 @@
 class AnimalService {
   constructor (config) {
     this.intervals = [] // 瀹氭椂鍣ㄥ垪琛�
+    // todo 杩欑鎯呭喌涓�鑸敤 window绾х殑L銆乵ap杩樻槸浼犻�掑憿
     this.L = config.L
-    this.layer = config.layer
+    this.layer = window.map
     this.times = config.times || 5
     this.colors = ['#98FB98', '#ff0000']
   }
@@ -32,6 +33,19 @@
       }
     }, 1000)
   }
+
+  /**
+   * 璁剧疆寮圭獥骞崇Щ浣嶇疆
+   * @param pos
+   * @param value
+   */
+  setPanTo = (pos, value) => {
+    var position = pos
+    position = this.layer.latLngToLayerPoint(position)
+    position.y += value
+    position = this.layer.layerPointToLatLng(position)
+    this.layer.flyTo(position)
+  }
 }
 
 export default AnimalService

--
Gitblit v1.8.0