Skip to content
Discussion options

You must be logged in to vote

I solved it with the following code.
Basically, I added a control to the map letting the user choose the color.

Everytime the user clicks on a different color button, Line.setOptions(...) gets called to set the right color for the line and for the text I just set it on the event "map.on(pm:create)".

let currentChoosenColor = "#0000ff"; // Default blue
const colorControl = L.control({ position: 'topright' });

colorControl.onAdd = function () 
     const div = L.DomUtil.create('div', 'leaflet-bar');
      ...
     [div.style options]
     ...

    //Set color options 
    const colors = [
        { name: 'Blue', value: '#0000ff' },
        { name: 'Red', value: '#ff0000' },
        { name…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Falke-Design
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant