当我加载页面后放大时,会发生这种情况:
https://gyazo.com/76b0458b1cd836a3b3d6ddaa493585da https://gyazo.com/76b0458b1cd836a3b3d6ddaa493585da(我是用鼠标滚轮放大和缩小的)
然而,当我用鼠标稍微移动地图后,问题就消失了,一切功能都完美......直到我重新加载页面。
有谁知道为什么会发生这种情况?
在这里我设法重现了这个问题:plnkr.co/edit/RD9yyEPY0Q1Udo57
(第一次加载后刷新预览窗口即可看到问题)
删除这两行后就不会出现问题。
<link rel="stylesheet" href="https://xguaita.github.io/Leaflet.MapCenterCoord/dist/L.Control.MapCenterCoord.min.css">
<script src="https://xguaita.github.io/Leaflet.MapCenterCoord/dist/L.Control.MapCenterCoord.min.js"></script>
因此,重新加载页面时地图居中似乎发生了偏移,并且您已经移动了地图。
也许您可以在单独的图层上添加中心信息?!
L.control.mapCenterCoord({
icon: true,
position: 'top'
}).addTo(mymap); << is the reason for the flickering
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)