1

I did quit research to move the bar out of the leaflet map. So what I did basically is that I created 3 buttons outside the map Div:

  • Draw Polygon
  • Delete
  • Edit

I binded events to the draw Polygon with :

new L.Draw.Polygon(this.map, this.drawOptions.draw.polygon).enable();

But I couldn't do the same with Delete and Edit. I found in a forum that I could use:

new L.EditToolbar.Edit(map, {
            featureGroup: drawControl.options.featureGroup,
            selectedPathOptions: drawControl.options.edit.selectedPathOptions
        })

But I didn't find the typings for L.EditToolbar since I'm developing in Ts. Any Ideas ? I want also to remove the Toolbar from MapDiv without touching to the draw options since they are used by my Draw buttons.

1

The functionality is there, it's just missing the types. You can however write it like this:

let drawEditToolbar = new L["EditToolbar"].Edit(map, {
      featureGroup: drawControl.options.featureGroup,
      selectedPathOptions: drawControl.options.edit.selectedPathOptions
})
drawEditToolbar.enable()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.