Hi everyone,
How can i clear drawing manager and allow user to draw one polygon at once
My code goes here
$(".PolygonAdd").click(function (e) {
var drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.POLYGON,
drawingControl: false,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT,
drawingModes: [google.maps.drawing.OverlayType.POLYGON]
},
polygonOptions: {
id: "New Polygon",
fillColor: #1EA448,
fillOpacity: 0.3,
strokeColor: #1EA448,
strokeOpacity: 0.6,
strokeWeight: 4,
clickable: true,
zIndex: 1,
editable: true
}
});
drawingManager.setMap(map);
google.maps.event.addListener(drawingManager, 'overlaycomplete', function (e) {
if (e.type != google.maps.drawing.OverlayType.MARKER) {
drawingManager.setDrawingMode(null);
}
NewPolygon = e.overlay;
NewPolygon.type = e.type;
Polygons[0] = NewPolygon;
google.maps.event.addListener(NewPolygon, 'click', function () {
setSelection(this);
});
drawingManager.setDrawingMode(null);
});
});</pre></pre>
If i click "PolygonAdd" multiple times, I can able to draw polygon multiple times with the tool but this should not happen.
I should able to reset drawing manager. How Can i do this??? Please help me with this
Thanks in advance....