bluehalo / ngx-leaflet-draw

MIT License
88 stars 29 forks source link

Prevent adding new layer to feature group on CREATED event #79

Closed ihrigb closed 4 years ago

ihrigb commented 5 years ago

https://github.com/Asymmetrik/ngx-leaflet-draw/blob/master/src/leaflet-draw/core/leaflet-draw.directive.ts#L66

This line adds a new layer directly to the underlying feature group. This does not align to leaflet draw's default behavior and made me wonder, why I always ended up with two equal layers in my feature group. Now, I guess some apps depend on this and we may not be able to simply remove this, but what about adding an optional property, to be able to disable the default behavior? I will implement a draft for this and link it here.

ihrigb commented 5 years ago

See PR https://github.com/Asymmetrik/ngx-leaflet-draw/pull/80

reblace commented 4 years ago

Addressed this by changing the behavior in v6 to match Leaflet Draw's default behavior. You have to add layers to the feature group yourself and add the feature group to the map. See the README for details.