v.leaflet + v.leaflet.draw - adding labels to drawn elements


I am using v-leaflet with v-leaflet.draw to draw stands on market map. Its great addon but i dont know how to add labels to drawned elements (is it possible?). I want to achive smth like on attached image. Maybe some addStyleName() to drawnElement would help? I am out of ideas how to achive this effect.

Cheers Rafal.


You can do this with Marker and by using “DivIcon” for it. A commit tells more than thousand words?

I agree, pretty hard to find that feature. I should really write a tutorial at some point for the add-on.

BTW. If you are not too long with your app, I’d also suggest to try the alternative drawing plugin:
. It is based an a new Leaflet JS plugin that has some more advanced features like real polygon editing (including holes) and touch device support. It is pretty new, but I’m very pleased with it in my hobby project.


thx Matti. Your solution works great. I will probably switch to L-Editable at next stage of this project :wink: