Hi,
It looks like Leaflet master (and 1.0.0-beta.2) sometimes fires twice zoomEnd event after a zoom in our out, whether using the mouse wheel, zoom control buttons, or programmatical map.zoomIn() / map.zoomOut().
However, Leaflet 1.0.0-b1 does not seem to have this issue (nor stable).
I am using FF and Chrome on Ubuntu.
This is a regression introduced by 4eb39d531255a6deaf3f3c56fb24933d44f5eccc. It might be possible to hack around it by setting the _animatingZoom flag to false exactly when _onZoomTransitionEnd is called, but then you _might_ hit the crazy iOS tile loading race condition that e15097dc1acc9cb80cab72bdbdb7355c77f1a9d0 fixed :-S
Any solution to this? It impacts other libraries. Se e.g.
@IvanSanchez why does it get called twice if the _onZoomTransitionEnd sets _animatingZoom to false?
@mourner it's now only set through an anim frame, see https://github.com/Leaflet/Leaflet/commit/e15097dc1acc9cb80cab72bdbdb7355c77f1a9d0
I'm a bit worried about mixing setTimeout and requestAnimFrame, but I've no plan B to suggest (and I've no iOS at hand to investigate) :(
Given the conversation here https://github.com/Leaflet/Leaflet/pull/3897 I'm tempted to suggest to remove the iOS hack until proven it's still needed in master.
Thoughts?
The original fix (3e200bed22bdb1f59e54f37c93b4fce034fd7ee4) protects a call to _resetView, while the current code in master doesn't call _resetView directly, but only indirectly by when calling _moveEnd.
How about just calling the _moveEnd inside the requestAnimFrame? Might of course introduce some other race.
Most helpful comment
Any solution to this? It impacts other libraries. Se e.g.
https://github.com/Leaflet/Leaflet.markercluster/issues/646