added display of lat/lon in JS popup (#113)

This commit is contained in:
Bernhard R. Fischer 2020-02-16 12:21:35 +01:00 committed by GitHub
parent f9ae256a9f
commit 4540820189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

1
images/position.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 0c-4.198 0-8 3.403-8 7.602 0 4.198 3.469 9.21 8 16.398 4.531-7.188 8-12.2 8-16.398 0-4.199-3.801-7.602-8-7.602zm0 11c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3z"/></svg>

After

Width:  |  Height:  |  Size: 279 B

View File

@ -188,6 +188,7 @@ export default class MapViewModel extends ViewModel {
${(pos.speed !== null) ? `<img class="icon" alt="${$._('speed')}" title="${$._('speed')}" src="images/speed_dark.svg">${$.getLocaleSpeed(pos.speed, true)}<br>` : ''}
${(pos.altitude !== null) ? `<img class="icon" alt="${$._('altitude')}" title="${$._('altitude')}" src="images/altitude_dark.svg">${$.getLocaleAltitude(pos.altitude, true)}<br>` : ''}
${(pos.accuracy !== null) ? `<img class="icon" alt="${$._('accuracy')}" title="${$._('accuracy')}" src="images/accuracy_dark.svg">${$.getLocaleAccuracy(pos.accuracy, true)}${provider}<br>` : ''}
<img class="icon" alt="${$._('position')}" title="${$._('position')}" src="images/position.svg"> ${MapViewModel.coordStr(pos.latitude, 0)} ${MapViewModel.coordStr(pos.longitude, 1)}<br>
</div>${stats}</div>
<div id="pfooter"><div>${$._('pointof', id + 1, count)}</div><div>${editLink}</div></div>`;
const node = document.createElement('div');
@ -259,4 +260,26 @@ export default class MapViewModel extends ViewModel {
this.api.updateSize();
}
}
static coordStr(pos, islon)
{
var ipos = Math.floor(pos);
var dec = ((pos - Math.floor(pos)) * 60).toFixed(1);
var dir;
var pad;
if (islon)
{
dir = pos < 0 ? 'W' : 'E';
pad = pos < 10 ? '00' : (pos < 100 ? '0' : '');
}
else
{
dir = pos < 0 ? 'S' : 'N';
pad = pos < 10 ? '0' : '';
}
return pad + ipos + '° ' + (dec < 10 ? '0' : '') + dec + dir;
}
}

View File

@ -62,6 +62,7 @@ $lang["close"] = "close";
$lang["time"] = "Time";
$lang["speed"] = "Speed";
$lang["accuracy"] = "Accuracy";
$lang["position"] = "Position";
$lang["altitude"] = "Altitude";
$lang["ttime"] = "Total time";
$lang["aspeed"] = "Average speed";