oussama kamal
oussama kamal

Reputation: 1037

Prevent google map polygon from editing.

I have a drawing tool in my google map for drawing polygons.

right now when I draw a polygon I see circles around it that make the polygon editable.

enter image description here

Is there a settings to draw a polygon and have it fixed in the map I mean not able to be edited.

My code:

// Creates a drawing manager attached to the map that allows the user to draw Polygons
    drawingManager = new google.maps.drawing.DrawingManager({
        drawingControlOptions: {
            drawingModes: [
                google.maps.drawing.OverlayType.POLYGON
            ]
        },
        polygonOptions: polyOptions,
        map: map
    });

Thanks

Upvotes: 1

Views: 1371

Answers (1)

Matej P.
Matej P.

Reputation: 5383

There is editable, draggable and clickable attribute of polygon options. Set all of them to false and you won't me able to edit, drag and not even click the polygon. If you want to allow clicking you can leave that at true.

polyOptions: {
   clickable: true,
   draggable: true,
   editable: true,
   //there can be other option like fillColor, fillOpacity...
}

Upvotes: 3

Related Questions