Setting iconAnchor makes no effect
Hi, great work in this!
I am having a little problem here, when I try to set an iconAnchor, the html icon doesn't change its position. What is wrong?
const newIcon = new L.HtmlIcon({
html: getUserIcon(user.photo, user.status),
iconAnchor: [90, 90]
});
const marker = new L.Marker([user.position.lat, user.position.lng], { icon: newIcon });
map.addLayer(marker);
I'm seeing the same issue. Setting the popupAnchor appears to work properly, but setting the iconAnchor appears to have no effect. Any chance there's an obvious fix for this? I'm happy to do the work and submit a PR, just not super familiar enough with Leaflet to know what's wrong.
@dwnoble
I found the issue by comparing against the L.Icon source code and have implemented a fix that appears to be working for me. I have added a PR #2 and would appreciate if you could merge it to help out @raapperez and whoever else may use this!
Thanks! John
@dwnoble
Would you mind to merge the PR I submitted? It solves this issue that probably affects more people than are looking for the solution here.
I struggled a while with this and afterwards figured out that Leaflet has DivIcon (http://leafletjs.com/reference-1.2.0.html#divicon). Probably this plugin here is not necessary anymore.