mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
faster distance calc
This commit is contained in:
parent
2e9b332012
commit
34f98fb08b
8 changed files with 101 additions and 80 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue