geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

How to change the color of the shape (polygon or polyline) when click action edit this shape? #1178

Closed hoangdangcodecomplete closed 2 years ago

hoangdangcodecomplete commented 2 years ago
Falke-Design commented 2 years ago

You can change the color of a shape with layer.setStyle({color: 'red'});. Here the setStyle() Doku.

If you want to change it while clicking on the global edit button you can listen on the pm:globaleditmodetoggled event:

map.on('pm:globaleditmodetoggled', (e)=>{
    console.log(e);
});

If you want to listen on a click on the shape you can do following:

layer.on('click', (e)=>{
    console.log(e);
});
hoangdangcodecomplete commented 2 years ago

Thank you so much for your answer, my friend @Falke-Design ! Currently, I am working with react leaflet and have some very important issues that I want to solve for my project. If you have some free time can I ask you a few questions? I really need your help. Thank you again for everything

Falke-Design commented 2 years ago

You can write me a e-mail and I will try to help you. design.falke@gmail.com