On each newly added vertex you'd need to calculate the "distance from
point to line", the line being the edge of your first polygon and the
point the new mouse click. If the distance is below your desired
threshold then adjust the position of the point.

Here's an old V2 example that does that:
http://maps.forum.nu/gm_mouse_dist_to_line.html

Click a couple of times to create polylines and then move the mouse
around.

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





On Jan 30, 2:35 pm, Tommy Crush <tommycr...@gmail.com> wrote:
> Lets say a user draws a polygon. Great. Easy Stuff.
>
> Now they're drawing another polygon. Basically, I want the point they
> clicked on (to create a corner) to "snap" to the edge of another
> polygon if that polygon's edge is within, say, 5 meters of their
> click.
>
> I need help on planning this out. I'm confident we can implement this,
> but the logic/data structure used is what's escaping me.
>
> Thoughts?
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to