How to add onClick on the "Draw Shape" button of the Google Maps Api?

Asked

Viewed 71 times

0

I would like to add the "onClick" event in the "Draw Shape" of the "Drawing Controller" from google maps api v3.

I could not find in the documentation and there is no right click on the button to check if you have an "id".

Someone would know how to do this?

1 answer

0

You just pick up the shape, pointing your variable. For example, let’s say you have a location pointer. You call his variable and enter an event with:

Marker.addListener('click', Function() { //code of actions here... });

I advise you to iterate on the points or objects you want to have actions. Create a function for this right away, because then you’ll see that you’ll need it on a larger scale.

  • In case I can do the following: - Check Drawing getMode, In case the Drawing button for 'Polygon' does something. It works like this?

  • Yes, you can, but you need to find some kind of reference

Browser other questions tagged

You are not signed in. Login or sign up in order to post.