1

I am trying to disable drawing any polygon on map until user selects any radio option displayed in image below. So How can I cancel drawing or disable user to draw anything on map?

enter image description here

vinita jain
  • 163
  • 2
  • 18

1 Answers1

2

You could use

 var drawControl = new L.Control.Draw({
            draw: false
        });

to disable drawing altogether or just disable the polygon with

var drawControl = new L.Control.Draw({
            position: 'topleft',
            draw: {
                polygon: false,
            ...

To trigger this behavior from your radio buttons, you will have to add some extra logic of course.

Merion
  • 195
  • 2
  • 10
  • Thanks @Merion, Appreciate your help. – vinita jain Jun 19 '20 at 23:21
  • 1
    You're welcome. If this answer solved your problem, accepting the answer and/or upvoting would be appreciated. If not, please elaborate on your problem and what you tried so far. Then I or others might be able to help. – Merion Jun 20 '20 at 20:36