thank you Andrew,
I'm using Observer pattern to notify the PolygonManager instance to
trigger the update function to redraw the polygon, I've figured out
the problem, it's not about the PolygonManager class, the problem is
about the ClicksManager class.

On Feb 23, 4:16 pm, Andrew Leach <[email protected]>
wrote:
> On Feb 23, 8:08 am, penelop <[email protected]> wrote:
>
> > Hi,
> > I've created a map that allow user to click on the map and draw a
> > polyline or polygon.
> > I placed a button to help user undo the last click and draw the
> > polygon again, but removeOverlay doesn't work properly, the old
> > polygon still remains on the map.
> > function PolygonManager(gmap,options) {
> >         var map = gmap;
> >         var gPolygon = null; //store reference to the GPolygon
> >             if (gPolygon) {
> >                 map.removeOverlay(gPolygon);
> >             }
>
> gPolygon is a LOCAL reference to the polygon, so it only exists while
> the PolygonManager function is being executed. At the end of each run
> of the function, the reference is destroyed. If you need to pass
> references between function executions, the reference needs to be in a
> global variable.
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to