Best Way To Make Marker Resizable In Leaflet
I am trying to resize my markers every time the map is zoomed in or out. Currently I am using this approach: Iterate all markers in zoomend method. get current icon size Perform
Solution 1:
Looks like there are several previous posts that you guide you:
- Mapbox,leaflet: Increase marker size on Zoom
- is there a way to resize marker icons depending on zoom level in leaflet?
- https://gis.stackexchange.com/questions/171609/resize-divicons-svgs-at-zoom-levels-leaflet
As for your bug, instead of reading the current icon size value
at "zoomstart"
event, you might better remember the previous zoom value and read it only at "zoomend"
event. I am not sure the "zoomstart"
event is fired only once when you scroll (to zoom in/out) successively, while the "zoomend"
event may be fired only at the very end.
Post a Comment for "Best Way To Make Marker Resizable In Leaflet"