Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leaflet - Create custom button to draw

I'm working in a project where is needed to draw polygonal shape. To achive my goal I'm using Leaflet Draw, I already disabled all draw tools except polygon tool, now I need just to customize the tool's icon of the button, I searched a lot but I didn't understand how customize it.

like image 913
gio Avatar asked Oct 16 '25 16:10

gio


1 Answers

Unless somebody comes with something clever, you have to provide an icon (26px) and change the button style.

<style>
.leaflet-draw-toolbar a.leaflet-draw-draw-polyline {
    background-image: url('icon26.png');
    background-size: 26px;
    background-position: 0;
}
</style>

Here is an example

like image 105
YaFred Avatar answered Oct 18 '25 08:10

YaFred



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!