Skip to content

Commit

Permalink
center map to europe #103
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickakk committed May 30, 2024
1 parent 60e0d7c commit 1ca6910
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webroot/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ class Map {
if (this.app.status == 'index') {
if (this.app.filter.isEmpty()) {
let zoom = this.map.getZoom();
// locate to user location
// set default zoom and center, in case no user location access
this.map.setView(new L.LatLng(52.506, 12.917), 4);
// locate to user location
this.map.locate({ setView: true, maxZoom: zoom });
this.map.on('locationfound', function () {
this.map.stopLocate();
}.bind(this));
}.bind(this));
}
}
}
Expand Down

0 comments on commit 1ca6910

Please sign in to comment.