2


I am using Drawing Manager to draw Polyline, Polygon, Circle and Rectangle.

Whenever a polygon is changed ( i.e., I have placed a polygon) and I have dragged or changed the shape of the Polygon. I want an event to fire when the shape of the polygon is changed.

Could some one tell me how to fire an event, when the shape of the polygon is changed?

I have tried "drag" event but did not work for me.

I need same thing for others tools too.

Excuse for english.

Thanks,
Kalyan Basa

Kalyan Basa
  • 307
  • 1
  • 3
  • 14

2 Answers2

1

Old question but found a solution to your problem.

What I did is to add a radius_changed listener inside the circlecomplete listener.
Example:

google.maps.event.addDomListener(drawingManager, 'circlecomplete', function(circle) {
    google.maps.event.addListener(circle, 'radius_changed', function() {
        radius = circle.getRadius();
        alert(radius);
    }); 
});

You see how I add a listener on the created object.

whoan
  • 8,143
  • 4
  • 39
  • 48
fdqps
  • 283
  • 1
  • 2
  • 9
-1

I don't believe there is any way to drag the shapes. They may be made editable, which provides the ability to move vertices, but they aren't draggable.

There are a set of -complete events, one for each type of shape:

  • circlecomplete
  • markercomplete
  • polygoncomplete
  • polylinecomplete
  • rectanglecomplete

and one general event, which is fired when any of the shape types is completed:

  • overlaycomplete

The Developer's Guide includes a section on Drawing Events, that provides drawing event listener code examples.

Sean Mickey
  • 7,618
  • 2
  • 32
  • 58