faster distance calc

This commit is contained in:
Fedor Katurov 2020-01-14 10:40:33 +07:00
parent 2e9b332012
commit 34f98fb08b
8 changed files with 101 additions and 80 deletions

View file

@ -1,4 +1,4 @@
import { Map, LayerGroup, Layer, FeatureGroup } from 'leaflet';
import { Map, FeatureGroup, FitBoundsOptions } from 'leaflet';
export class MapContainer extends Map {
constructor(props) {
@ -21,8 +21,16 @@ export class MapContainer extends Map {
const bounds = layers[i].getBounds();
if (Object.keys(bounds).length == 2) return bounds;
}
return null;
};
fitVisibleBounds = (options: FitBoundsOptions) => {
const bounds = this.getVisibleBounds();
if (!bounds) return;
this.fitBounds(bounds, options)
}
public clickable = true;
public routeLayer = new FeatureGroup();