Reputation: 3284
I'm using ngx-leaflet v4.0.0 and Angular v6.1.10.
I have a map with several basemaps and a few custom overlays. I'm using the LayersControl from ngx-leaflet.
How can a user easily zoom to the bounds of a specific overlay layer? I know I can do it like this:
zoomToHome() {
this.map.flyToBounds(this.homeLayer.getBounds());
this.map.fitBounds(this.homeLayer.getBounds());
}
This is the click function of my custom button. And when adding my layers I save one as my home layer.
I would prefer to have a button in the layer control in front of each layer, when clicked the map goes to its bounds.
Can this be done with the current layers control or should I submit a feature request with Asymmetrik
?
Upvotes: 0
Views: 641
Reputation: 4195
To add this, you'd likely need to find or author a plugin for Leaflet that would implement this functionality to the layers control.
AFAIK, this is not built in to Leaflet currently and ngx-leaflet only intends to expose Leaflet to Angular.io, not implement custom functionality to Leaflet.
Upvotes: 0