Yes, but you have to do both, add a vertex and disableEditing().

Try this:
(Mind the word wrap)
..........................................
function disable() {
  if (poly) {
    if (poly.getVertex(0) != poly.getVertex(poly.getVertexCount()-1))
{
      poly.insertVertex(poly.getVertexCount(),poly.getVertex(0));
    }
  }
}
..........................................


--
Marcelo - http://maps.forum.nu
--


On May 1, 6:37 pm, Metheus <[email protected]> wrote:
> The workaround does not end the drawing though.  That is the problem.
> Maybe your setup is working correctly and mine is not?
>
> Try this:
> 1) Click start drawing
> 2) Click on the map to drop a few vertices, but do not close the
> polygon
> 3) Click on workaround button
> 4) Click on the map again
>
> In my browser, the workaround creates another vertex at the same point
> as the last, but the drawing still continues.  When I click on the map
> again, another vertex is created and the drawing of the polygon
> continues.
>
> On May 1, 11:26 am, marcelo <[email protected]> wrote:
>
> > On May 1, 5:40 pm, Metheus <[email protected]> wrote:
>
> > > I replaced the onEvent lines with normal Event.bind calls.  I also
> > > changed the version to 2, but unfortunately neither of these changes
> > > alter the behavior of the code.
>
> > I think that the behavior is correct, and your "workaround" is the
> > correct way to end the drawing programatically.
> > The polygon must end at the same point where it starts, otherwise
> > you're effectively missing a side. It looks as if you have a complete
> > polygon only because it is filled, but if you remove the fill you can
> > see that the polygon is not complete.
> > What your "workaround" does is to effectively close it, in case the
> > user hasn't done so.
>
> > Another way to close it would be to check if the fist vertex equals
> > the last vertex, and if it doesn't then add a last vertex at the same
> > location as the first vertex.
>
> > --
> > Marcelo -http://maps.forum.nu
> > --
--~--~---------~--~----~------------~-------~--~----~
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