Skip to content

Commit

Permalink
Fix geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
cblakkan committed Apr 27, 2024
1 parent b5d1dd4 commit 056f422
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@

if ( window.navigator ){
window.navigator.geolocation.getCurrentPosition(function(position){
let minLat, minLong = MAX_BOUNDS[0];
let maxLat, maxLong = MAX_BOUNDS[1];
let inBoundsLat = position.coords.latitude >= minLat && position.coords.latitude <= maxLat;
let inBoundsLong = position.coords.longitude >= minLong && position.coords.longitude <= maxLong;
let [minLong, minLat] = MAX_BOUNDS[0];
let [maxLong, maxLat] = MAX_BOUNDS[1];
let inBoundsLat = minLat <= position.coords.latitude && position.coords.latitude <= maxLat;
let inBoundsLong = minLong <= position.coords.longitude && position.coords.longitude <= maxLong;
if ( inBoundsLat && inBoundsLong ){
map.flyTo({center: [position.coords.latitude, position.coords.longitude]});
map.flyTo({center: [position.coords.longitude, position.coords.latitude]});
}
});
}
Expand Down

0 comments on commit 056f422

Please sign in to comment.