Skip to content

Conversation

danzel
Copy link
Member

@danzel danzel commented Jun 12, 2013

As of #1726 you cannot use setIcon and pass a new DivIcon. If you do the icon doesn't end up getting updated.
This breaks MarkerCluster which relies heavily on DivIcon.
Also probably breaks leaflet.awesome-markers and some others.

Now we check that the Icon has actual reused the dom element, if it hasn't we do the old behaviour of removing the dom element and adding the new one.
Also made DivIcon reuse the div.

Fixes #1753 and Fixes Leaflet/Leaflet.markercluster#190

mourner added a commit that referenced this pull request Jun 12, 2013
Fix SetIcon with DivIcons
@mourner mourner merged commit 91db6cc into Leaflet:master Jun 12, 2013
@mourner
Copy link
Member

mourner commented Jun 12, 2013

Thanks Dave, very nice fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setIcon with DivIcon no longer works after setIcon icon reuse change MarkerCluster is broken by leaflet setIcon optimisation
2 participants