Reputation: 1374
How can I set the rules to drawingManager, which user can draw a polygon after a specific zoom. for example user has to reach zoom 18 and then the DrawingManager allow to draw a polygon.
function DrawingTools() {
myDrawingManager = new google.maps.drawing.DrawingManager({
drawingMode: null,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.RIGHT_TOP,
drawingModes: [
google.maps.drawing.OverlayType.POLYGON,
]
},
polygonOptions: {
draggable: true,
editable: true,
fillColor: '#cccccc',
fillOpacity: 0.5,
strokeColor: '#000000'
}
});
myDrawingManager.setMap(map);
}
Thank you
Upvotes: 1
Views: 206
Reputation: 31912
Have an event listener for when the map zoom level changes.
google.maps.event.addListener(map, 'zoom_changed', function() {
if (map.getZoom() >= 18) {
DrawingTools();
}
});
Upvotes: 1