Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self snapping polygon #34

Open
Agrinotes opened this issue Apr 14, 2016 · 2 comments
Open

Self snapping polygon #34

Agrinotes opened this issue Apr 14, 2016 · 2 comments

Comments

@Agrinotes
Copy link

First of all, I wanted to thank you for this amazing plugin ! I am currently working with Leaflet Draw, and I wanted to know if Leaflet.Snap can snap vertices from a polygon being drawn. A kind of self-snapping feature ? The idea is to help the user close the polygon by snapping the first point... Any idea how to do this ? Thanks in advance !

@mapmeld
Copy link
Contributor

mapmeld commented Apr 21, 2016

@Agroscopik in my experience, as you are first drawing the polygon, your mouse is already snapping to the first point? Example using Leaflet.draw and Leaflet.snap: http://asiafoundation.github.io/SnapEditor/ (click the polygon button on the left to start drawing a polygon)

@Agrinotes
Copy link
Author

Agrinotes commented Apr 21, 2016

@mapmeld thank you for your answer. In your example you need the mouse to be "exactly" hover the first point to finish drawing the polygon. What I need is something like what they have to draw farming fields in https://farmlogs.com/ Even if your mouse is 15px away from the first point (represented by a square in your example), it "snaps" it. It makes it easier to close the polygon. Do you know if Leaflet Snap can do that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants