diff --git a/lib/ui/widgets/digitalposition.js b/lib/ui/widgets/digitalposition.js index 302155f..ca0fd73 100644 --- a/lib/ui/widgets/digitalposition.js +++ b/lib/ui/widgets/digitalposition.js @@ -45,6 +45,26 @@ function displayDMS(value, coordType, displayUnit) { return result; } + +function displayDDM(value, coordType, displayUnit) { + var valDeg, degPadSize, valMin, valDecMin, result, coordDir + + if (!value) { + return '--.--' + } + + coordDir = getCoordDir(value, coordType) + degPadSize = (coordType === coordTypeLongitude) ? 3 : 2 + value = parseFloat(value); + value = Math.abs(value); + valDeg = String(Math.floor(value)).padStart(degPadSize, '0') + result = valDeg + '\u00b0' + ' ' + valDecMin = Number((value - valDeg) *60).toFixed(4); + result += String(valDecMin).padStart(7, '0') + "'" +' ' + coordDir + return result; +} + + function displayDD(value, coordType, displayUnit, displaySign) { var degPadSize, result, coordDir; @@ -97,6 +117,14 @@ var positionFormats = [ label: "DDirM'S''ddd", fontSize: 15 } + }, + function(positionObject) { + return { + latitude: displayDDM(positionObject.latitude, coordTypeLatitude, false), + longitude: displayDDM(positionObject.longitude, coordTypeLongitude, false), + label: "D\u00b0 M.mmmm' Dir", + fontSize: 15 + } } ] @@ -225,6 +253,8 @@ export default { 'navigation.position', 'navigation.courseGreatCircle.nextPoint.position', 'navigation.courseGreatCircle.previousPoint.position', + 'navigation.courseRhumbline.nextPoint', + 'navigation.courseRhumbline.previousPoint', 'navigation.anchor.position' ] }