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

Target Feature Group (+ Additional Events) #118

Open
QbDesu opened this issue Mar 21, 2018 · 0 comments
Open

Target Feature Group (+ Additional Events) #118

QbDesu opened this issue Mar 21, 2018 · 0 comments

Comments

@QbDesu
Copy link

QbDesu commented Mar 21, 2018

I would like to be able to have FreeDraw put the polygon layers on a specific layer/feature group because as of now it is hard-coded to add them to the map directly.
https://github.com/Wildhoney/Leaflet.FreeDraw/blob/master/src/helpers/Polygon.js#L73-L75

const polygon = new Polygon(latLngs, {
    ...defaultOptions, ...options, className: 'leaflet-polygon'
}).addTo(map);

It would be way nicer to handle that way.

Also a simple events like freeDraw.on("drawcommit", e => console.log(e.layer)) would be nice.
The events I would like to see are:

  • drawstart - self-explanatory I think, maybe include the start latlng
  • drawend - triggered whenever drawing is stopped, contain recorded latlngs
  • drawcancel - triggered whenever drawing is canceled, contain recorded latlngs
  • drawcommit - triggered whenever drawing is canceled, contain recorded latlngs, ALSO contain the newly created polygon layer if available(!)
  • editstart, editend, editcancel(?), editcommit

Maybe also have an option to not submit the drawn area when the mouse leaves the map but instead cancel or do nothing.

I would also do it but I would rather have you do it because I hardly know anything about the project and would rather not have to learn all the details to do it. The most important part to me is the target feature group.

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

No branches or pull requests

1 participant