Reputation: 53
After having looked at the following question and answer (Initiate polygon drawing from custom button) , trying the code and getting no results I am not sure what I am doing wrong. My code is as follows:
//button function
$(".btn > .icon-circle-blank").click(function(event){
//stub for gmap radius drawing
drawingManager.setDrawingMode(google.maps.drawing.OverlayType.CIRCLE);
})
I am able to initialize the drawing tools with
var drawingManager = new google.maps.drawing.DrawingManager({
drawingControl: true,
drawingControlOptions: {
drawingModes: [
google.maps.drawing.OverlayType.CIRCLE,
google.maps.drawing.OverlayType.POLYGON,
google.maps.drawing.OverlayType.RECTANGLE
]
}
});
Usually I have drawingControl set to false and my custom button is not on the map.
Thanks for your help!
Upvotes: 1
Views: 1122
Reputation: 3429
Is your click function getting called at all? It looks like it's set to fire when the icon is clicked, rather than the button.
Update: drawingManager
is outside the scope of your click
functions. Since those event handlers are part of the page initialization, I recommend moving them inside the initialize
function.
Upvotes: 1