Merge pull request #169 from tuffnerdstuff/bugfix/null-acc-session-expired

setting accuracy circle also when acc == null
This commit is contained in:
Marius Lindvall 2024-05-24 23:05:24 +02:00 committed by GitHub
commit 6b3d8dcbec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 8 deletions

View File

@ -872,19 +872,13 @@ function processUpdate(data, init) {
}
eLastSeen.textContent = unit.split("{{time}}").join(time);
}
shares[user].circle.setStyle({
fillColor: STATE_DEAD_COLOR,
color: STATE_DEAD_COLOR
})
setAccuracyCircleColor(shares[user].circle, STATE_DEAD_COLOR);
} else {
eArrow.className = eArrow.className.split("dead").join(shares[user].state);
if (eLabel !== null) eLabel.className = shares[user].state;
var iconColor = STATE_LIVE_COLOR;
if (shares[user].state == "rough") iconColor = STATE_ROUGH_COLOR;
shares[user].circle.setStyle({
fillColor: iconColor,
color: iconColor
});
setAccuracyCircleColor(shares[user].circle, iconColor);
}
}
}
@ -906,6 +900,15 @@ function processUpdate(data, init) {
}
}
function setAccuracyCircleColor(circle, color) {
if (circle) {
circle.setStyle({
fillColor: color,
color: color
});
}
}
// Calculates the distance between two points on a sphere using the Haversine
// algorithm.
function distance(from, to) {