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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With