Remove marker Bug if map.markerZoomAnimation = false
See original GitHub issueOnly tested on Master. If you initialize the map with markerZoomAnimation = false the map will fire the event zoomanim even for the removed markers when you zoom in and out.
https://playground-leaflet.rhcloud.com/juzu/1/edit?html,js,output
Zoom in and out on that map for 10 seconds, no problems.
After 10 seconds the marker is removed.
Now if you try to zoom you get an error in the console: error Script error. (line 0)
I don’t know how to link proper errors from that website, but on my website this is the error i get in the console:
'Uncaught TypeError: Cannot read property '_latLngToNewLayerPoint' of null
@ https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Marker.js#L290`
I think this is happening because when we add a marker this is happening: https://github.com/Leaflet/Leaflet/blob/master/src/layer/Layer.js#L86 is True so https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Marker.js#L124 gets set. so it’s registering zoomanim https://github.com/Leaflet/Leaflet/blob/master/src/layer/Layer.js#L89 Then https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Marker.js#L101 is False But when we remove the marker this is what is going on: https://github.com/Leaflet/Leaflet/blob/master/src/layer/Layer.js#L171 is going to: https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Marker.js#L123 which is false so it’s not removing the handler for the zoomanim event.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I solved the question by adding this code to project (anywhere , just sure it will be used)
is happenig again