Forum Replies Created
-
AuthorPosts
-
Cool, I’ll email you.
And on Stack Overflow
http://stackoverflow.com/questions/8831382/google-maps-v3-delete-vertex-on-polygon
From what I can tell this doesn’t work. But I did find a solution on known issues with Google Drawing editor.
In there I found a solution below. But I don’t know where to put the code. Any advice.
Copy and paste below *****************
Google Maps now provides a “PolyMouseEvent” callback object on events that are triggered from a Polygon or Polyline.
To build on the other answers which suggested a solution involving a right click, all you would need to do is the following in the latest versions of the V3 API:
// this assumes
my_polyis an normal google.maps.Polygon or Polylinevar deleteNode = function(mev) { if (mev.vertex != null) { my_poly.getPath().removeAt(mev.vertex); } } google.maps.event.addListener(my_poly, 'rightclick', deleteNode);You’ll notice that any complex calculations on whether or not we are near the point are no longer necesary, as the Google Maps API is now telling us which vertex we’ve clicked on.
Note: this will only work while the Polyline/Polygon is in edit mode. (Which is when the vertices you might want to delete are visible.)
Also, anyway to continue drawing a line once you’ve saved it? Snapping and continuing to draw on the same shape, rather than creating a new shape when I restart?
-
AuthorPosts
