| | |
| | | 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'] |
| | | } |
| | |
| | | } |
| | | }, 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 |