Skip to content

Commit

Permalink
Update map.js
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsosousah committed Jun 17, 2024
1 parent 0afa426 commit 88e7b75
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scripts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,6 @@ function getLocation(zoom = true) {
}
//map.getView().setCenter(ol.proj.fromLonLat(pos));
}

// Use GPS heading if user is ruffly in a straight line for the last 5 seconds and over 12kph
if (gpsHeading && speed >= (12 * 1000) / (60 * 60)) {
// Calculate offset between gps heading and compass heading
deviceHeadingOffset = gpsHeading - compassHeading;

// Dev info
document.getElementById("headingSource").innerHTML = "GPS+Compass";
document.getElementById("headingSource").style.backgroundColor = "lightgreen";
}
};

// HTML5 geolocation
Expand Down Expand Up @@ -503,6 +493,16 @@ function startLocationDotRotation() {

if (!pos) return;

// Use GPS heading to update device heading offset if user is ruffly in a straight line for the last 5 seconds and over 12kph
if (gpsHeading && speed >= (12 * 1000) / (60 * 60)) {
// Calculate offset between gps heading and compass heading
deviceHeadingOffset = gpsHeading - compassHeading;

// Dev info
document.getElementById("headingSource").innerHTML = "GPS+Compass";
document.getElementById("headingSource").style.backgroundColor = "lightgreen";
}

// Reset offset if under 5kph
if (!gpsHeading || speed === 0) {
// Reset offset
Expand Down

0 comments on commit 88e7b75

Please sign in to comment.