1

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!

Community
  • 1
  • 1
schifferl
  • 53
  • 8

1 Answers1

1

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.

Cianan Sims
  • 3,419
  • 1
  • 21
  • 30
  • Thought that might be the case and so I changed the .btn > .icon-circle-blank to #circle and applied the id in my html. Still google maps give me nothing – schifferl Mar 02 '13 at 09:57
  • @LucasS can you post your html snippet? – Cianan Sims Mar 02 '13 at 18:35
  • http://jsfiddle.net/EHLXH/ and everything works save for font awesome (but its not essential to the code) – schifferl Mar 02 '13 at 22:13
  • @LucasS See my updated answer. That should take care of the problem. Also, check out the dev tools of your browser for easy debugging. – Cianan Sims Mar 02 '13 at 22:25