派生自 wuyushui/SewerAndRainNetwork

ChenZeping02609
2021-05-12 f9f80893f6b29f0aaa8d5f7c1291f91b8f477fe4
src/components/LayerController/service/AnimalService.js
@@ -4,8 +4,9 @@
class AnimalService {
  constructor (config) {
    this.intervals = [] // 定时器列表
    // todo 这种情况一般用 window级的L、map还是传递呢
    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