派生自 wuyushui/SewerAndRainNetwork

QibolinCzp
2021-05-14 73c8d3f55d5a675174a61342f3cea712ed5bc0eb
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