Browse Source

GeoInfo: show heading

master
Stephan Bösch-Plepelits 4 years ago
parent
commit
2a00e3c351
  1. 8
      lang/en.json
  2. 5
      src/GeoInfo.js

8
lang/en.json

@ -45,6 +45,14 @@
"header:attributes": "Attributes",
"header:export": "Export",
"header:osm_meta": "OSM Meta",
"heading:N": "N",
"heading:NE": "NE",
"heading:E": "E",
"heading:SE": "SE",
"heading:S": "S",
"heading:SW": "SW",
"heading:W": "W",
"heading:NW": "NW",
"images": "Images",
"invalid value": "invalid value",
"loading": "Loading ...",

5
src/GeoInfo.js

@ -7,6 +7,10 @@ const tabs = require('modulekit-tabs')
const formatUnits = require('./formatUnits')
require('./GeoInfo.css')
function heading (value) {
return [ 'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'N' ][Math.round(value / 45)]
}
register_hook('init', function () {
let tab = new tabs.Tab({
id: 'search',
@ -105,6 +109,7 @@ register_hook('init', function () {
(typeof e.accuracy !== 'undefined' ? (global.options.formatUnitsCoordSpacer || ', ') + '± ' + formatUnits.distance(e.accuracy.toFixed(0)) : '') + '<br/>' +
(typeof e.altitude !== 'undefined' ? '<i class="fas fa-mountain"></i> ' + formatUnits.height(e.altitude) + (typeof e.altitudeAccuracy !== 'undefined' ? ' ± ' + formatUnits.distance(e.altitudeAccuracy) : '') + ' ' : '') +
(typeof e.speed !== 'undefined' ? '<i class="fas fa-tachometer-alt"></i> ' + formatUnits.speed(e.speed) + ' ' : '') +
(typeof e.heading !== 'undefined' ? '<i class="fas fa-compass"></i> ' + lang('heading:' + heading(e.heading)) + ' (' + e.heading.toFixed(0) + '°)' : '') +
'</span>'
domLocation.classList.remove('empty')
}

Loading…
Cancel
Save