Leaflet.awesome-markers icon indicating copy to clipboard operation
Leaflet.awesome-markers copied to clipboard

let programmer specify the id of the icon

Open mfrasca opened this issue 8 years ago • 0 comments

(disclaimer: I'm not a JS programmer, I generally work with C/C++, Python, Pascal) my understanding is that when you create a marker and you add it to a map, an icon is created and put in the DOM. I am building a user interface (http://gardens.ghini.me / http://github.com/Ghini/ghini.web) that would let the user select items on the map and I want to highlight their selection. I am thinking of achieving this by the element id and a jquery selector. my element id comes from a database. is there a deeper reasoning behind the fact that we cannot do this?

this does not work:

    var marker = L.marker([item.lat, item.lon],
                          item);
    marker.addTo(l).bindPopup(models[g].text.formatU(item),
                              {marker: marker});
    var marker_id = generate_guid(item._id);
    marker._icon.id = marker_id;

because the _icon property of the marker is not immediately available.

mfrasca avatar Dec 21 '16 22:12 mfrasca