派生自 wuyushui/SewerAndRainNetwork

QibolinCzp
2021-05-14 bd82dff04b90e3eb1973f43ecc3fdfb8172bcdd7
src/utils/utils.js
@@ -24,6 +24,43 @@
}
/**
 * 脉冲效果
 */
export function pulseEffect (xy) {
  let times = 5
  const colors = ['#98FB98', '#ff0000']
  // 插件 效果实现
  var pulsingIcon = window.L.icon.pulse({
    iconSize: [20, 20],
    color: colors[0],
    fillColor: ''
  })
  var picGroupMarker = window.L.marker(xy, { icon: pulsingIcon }).addTo(window.map)
  // 定时
  var timeInterval = setInterval(() => {
    if (times > 0) {
      times--
    } else {
      clearInterval(timeInterval)
      picGroupMarker.remove()
    }
  }, 1000)
}
/**
 * 设置弹窗平移位置
 * @param pos
 * @param value
 */
export function setPanTo (pos, value) {
  var position = pos
  position = window.map.latLngToLayerPoint(position)
  position.y += value
  position = window.map.layerPointToLatLng(position)
  window.map.flyTo(position)
}
/**
 * 复制对象
 * @param obj
 * @returns {{}}