派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-30 bfd90be7b80fa5391681530c62e3761742879fcf
src/components/LayerController/logic/Company.js
@@ -14,7 +14,6 @@
   * 返回marker对象数组
   * @param L leaflet对象
   */
  this.init = async (layer, L) => {
    this.animalService = new AnimalService({
      L: L,
@@ -40,29 +39,11 @@
        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()
      }
      layer.addLayer(marker)
    }
  }
  /*
@@ -80,15 +61,13 @@
  *
  * */
  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