maydemirx / leaflet-tag-filter-button

Adds tag filter control for layers (marker, geojson features etc.) to LeafLet.
leaflet-tag-filter-button.vercel.app
MIT License
53 stars 23 forks source link

The custom icon doesn't show with tags #34

Closed thecheapers closed 4 years ago

thecheapers commented 4 years ago

Hello,

Thank you for this amazing plugin for leaflet. It's very interesting and helpful. I have an issue and I don't know how to resolve it. The tag filtering is not working if I put the array in third position of the L.marker function. I would like to add custom icons but it doesn't work with the following code.

var icon_custom = L.icon({iconUrl: element.category_img, iconSize:[38, 45], iconAnchor:[0, 0],popupAnchor:[0, 0]}); var marker = L.marker([element.lat, element.lng],{icon:icon_custom},{ tags: [element.category_name]});

Could you help me with it ?

thecheapers commented 4 years ago

Actually I found how to solve it using this function: marker.setIcon(icon_custom);