Leaflet shapes move when zooming

Viewed 430

When I zoom in after loading the page, this happens:

https://gyazo.com/76b0458b1cd836a3b3d6ddaa493585da (I zoomed in and out with the mouse wheel)

However, after I move the map with the mouse just a bit, the issue is gone and everything functions perfectly... until I reload the page.

Does anyone have an idea why could this be happening?

Here I managed to recreate the issue: plnkr.co/edit/RD9yyEPY0Q1Udo57 (refresh the preview window after loading for the first time to see the issue)

1 Answers

Problem doesnt occur when you remove these 2 lines.

<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>

hence it seems like the map centering is offset when reloading the page and you already moved the map. maybe you can add the center infos on a seperate layer?!

 L.control.mapCenterCoord({
   icon: true,
   position: 'top'
 }).addTo(mymap); << is the reason for the flickering
Related