| | |
| | | * 返回marker对象数组 |
| | | * @param L leaflet对象 |
| | | */ |
| | | |
| | | this.init = async (layer, L) => { |
| | | this.animalService = new AnimalService({ |
| | | L: L, |
| | |
| | | className: 'company-bindTooltip', |
| | | iconSize: 16 |
| | | }) |
| | | |
| | | const marker = L.marker([positionX, positionY], { |
| | | /* icon: L.icon({ |
| | | iconUrl: iconUrl, |
| | | iconSize: [30, 30], |
| | | iconAnchor: [15, 15] |
| | | }), */ |
| | | icon: myIcon, |
| | | test: data[i] |
| | | }) |
| | | /* const htmls = '<ul><li>' + data[i].name + '</li></ul>' |
| | | marker.bindTooltip(htmls, { |
| | | permanent: true, |
| | | offset: [0, 5], |
| | | direction: 'bottom', |
| | | className: 'company-bindTooltip' |
| | | }) */ |
| | | // layer.addLayer(marker) |
| | | if (window.map.getZoom() <= 5) { |
| | | layer.addLayer(marker) |
| | | } else if (window.map.getZoom() >= 12) { |
| | | layer.removeLayer() |
| | | } |
| | | } |
| | | } |
| | | /* |
| | |
| | | * |
| | | * */ |
| | | this.clickListener = (e) => { |
| | | console.log(e) |
| | | window.map.setView(e.latlng, 13) |
| | | if (window.map.getZoom() >= 12) { |
| | | e.layer.remove() |
| | | } |
| | | // if (window.map.getZoom() <= 5) { |
| | | // e.layer.addLayer() |
| | | // } else if (window.map.getZoom() >= 12) { |
| | | // e.layer.removeLayer() |
| | | // console.log(e) |
| | | window.map.setView(e.latlng, 15) |
| | | // if (window.map.getZoom() >= 10) { |
| | | // window.map.removeLayer(e.layer) |
| | | // e.layer.remove() |
| | | // } else if (window.map.getZoom() < 10) { |
| | | // window.map.addLayer(e.layer) |
| | | // } |
| | | // const dataValue = { |
| | | // StoragePlaceId: e.layer.options.test.name |