Ask your WordPress questions! Pay money and get answers fast! (more info)

Leaflet/Google Maps - zoom stops after changing several levels

  • SOLVED

Please have a look at https://www.mapsmarker.com/dev/pro/2015/02/13/google-map-test/
On average I can only zoom out 4 times before the zoom buttons get unresponsive - zooming in or out is than not possible anymore :-/

Unfortunately I do not see any console errors.

The (beautified) javascript for displaying google maps within leaflet can be found at https://gist.github.com/robertharm/5a469a4652a60f414696 (it is a bit different from the actual google leaflet plugin, but has worked so far without any issues)

Zoom on maps using OpenStreetMap as basemap work flawlessly though, see example at https://www.mapsmarker.com/dev/pro/2014/12/15/shortcode-override-test/

Can anyone please give me a hint why the map zoom suddenly breaks? Tried with latest firefox, Chrome and IE - no difference :-/

Update: after you zoom out 4 levels, map panning also freezes. And: if you change to OpenStreetMap, then zoom out more than 4 levels and switch back to Google basemap, the map also freezes.

Answers (3)

2015-02-13

wsenjer answers:

I think the problem in the Leaflet library. The bug is not officially solved. But for now you can add this line in the leaflet-addons.js in the Google object extension after line 53 , this will solve the problem, but you must update the library in the next release.

L.polyline([[0, 0], ]).addTo(this._map);


wsenjer comments:

I think the problem in the Leaflet library. The bug is not officially solved. But for now you can add this line in the leaflet-addons.js in the Google object extension after line 53 , this will solve the problem, but you must update the library in the next release.

L.polyline([[0, 0], ]).addTo(this._map);


Robert Harm comments:

thanks - that solved the issue!

2015-02-13

Bard answers:

I didn't see wrong by Chrome.
By the way, nice plugin.


Robert Harm comments:

zooming in to maximum detail level works in chrome, you´re right - anyway please zoom out 4 levels and afterwards zoom control is also frozen when using chrome :-/
PS: thanks for your feedback :-)

2015-02-13

Bob answers:

It doesn't happens to me every time. But sometime it does.

I am using chrome.


Bob comments:

It does not stuck particularly after 4 times zooming in our zooming out.

It happens to me only when I continuously click "+" or "-" controls.

If everything is loaded properly and I click smoothly, means wait for a little time between two clicks everything works fine.


Robert Harm comments:

thanks for testing - unfortunately this is not enough, I need to find the issue causing this :-/