From bd82dff04b90e3eb1973f43ecc3fdfb8172bcdd7 Mon Sep 17 00:00:00 2001 From: QibolinCzp <qibolin02429@126.com> Date: 星期五, 14 五月 2021 14:40:58 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/utils/utils.js | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index ef770cb..2328fd0 100644 --- a/src/utils/utils.js +++ b/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 {{}} -- Gitblit v1.8.0