Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgilbers committed Sep 25, 2024
1 parent dee7c54 commit 220bc23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ function handleOrientation (event) {
const newPosition = calculatePosition(motionArray, userPosition, bias)
userPosition = L.latLng(newPosition.lat, newPosition.lng)
circle.setLatLng(userPosition)
centerPosition()
}

function centerPosition () {
map.flyTo(userPosition, map.getZoom())
}

Expand All @@ -306,7 +310,7 @@ let compass = false
*/
window.toggleCompass = () => {
if (!isCentered) {
map.flyTo(userPosition, map.getZoom())
centerPosition()
return
}

Expand Down

0 comments on commit 220bc23

Please sign in to comment.