user101289
user101289

Reputation: 10422

onChange event for Google Maps APIv3 drawing manager

I'm using the GMaps API v 3 Drawing Manager to let users draw shapes on a map.

I can use the complete events to trigger actions when a shape is added to the map (eg. overlaycomplete or polygoncomplete)-- but I am also allowing the user to edit the completed shapes.

Is there a way to trigger an action when a shape is changed? I can't see any way to fire another function when a shape is modified.

Upvotes: 7

Views: 12552

Answers (1)

dimusic
dimusic

Reputation: 4133

List of editing events can be found here:

Editable events

Dragging events

Here is an example how to use it with DrawingManager when a circle's radius has changed:

google.maps.event.addListener(drawingManager, 'circlecomplete', function (circle) {
  google.maps.event.addListener(circle, 'radius_changed', function () {
    console.log('radius changed');
  });
});

http://jsfiddle.net/Vvk4d/

You can use the same approach for polygons/rectangles.

Upvotes: 13

Related Questions