diff --git a/frontend/react/src/other/utils.ts b/frontend/react/src/other/utils.ts index df0b6577..d2b01d07 100644 --- a/frontend/react/src/other/utils.ts +++ b/frontend/react/src/other/utils.ts @@ -83,6 +83,13 @@ export function ConvertDDToDMS(D: number, lng: boolean) { else return zeroPad(deg, 2) + "°" + zeroPad(min, 2) + "'" + zeroPad(sec, 2) + "." + zeroPad(dec, 2) + '"'; } +export function DDToDDM(decimalDegrees) { + const degrees = Math.trunc(decimalDegrees); + const minutes = Math.abs((decimalDegrees - degrees) * 60); + + return `${Math.abs(degrees)}° ${minutes.toFixed(4)}'`; +} + export function deg2rad(deg: number) { var pi = Math.PI; return deg * (pi / 180); diff --git a/frontend/react/src/ui/components/ollocation.tsx b/frontend/react/src/ui/components/ollocation.tsx index 34e142f5..f6a76ef2 100644 --- a/frontend/react/src/ui/components/ollocation.tsx +++ b/frontend/react/src/ui/components/ollocation.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; import { LatLng } from "leaflet"; -import { ConvertDDToDMS, latLngToMGRS, latLngToUTM, zeroAppend } from "../../other/utils"; +import { ConvertDDToDMS, DDToDDM, latLngToMGRS, latLngToUTM, zeroAppend } from "../../other/utils"; export function OlLocation(props: { location: LatLng; className?: string; referenceSystem?: string; onClick?: () => void }) { const [referenceSystem, setReferenceSystem] = props.referenceSystem ? [props.referenceSystem, () => {}] : useState("LatLngDec"); @@ -82,7 +82,7 @@ export function OlLocation(props: { location: LatLng; className?: string; refere props.onClick ? props.onClick : (ev) => { - setReferenceSystem("MGRS"); + setReferenceSystem("LatLngDDM"); ev.stopPropagation(); } } @@ -109,6 +109,45 @@ export function OlLocation(props: { location: LatLng; className?: string; refere ); + } else if (referenceSystem === "LatLngDDM") { + return ( +
{ + setReferenceSystem("MGRS"); + ev.stopPropagation(); + } + } + > +
+ + {props.location.lat >= 0 ? "N" : "S"} + + {DDToDDM(props.location.lat)} +
+
+ + {props.location.lng >= 0 ? "E" : "W"} + + {DDToDDM(props.location.lng)} +
+
+ ); } else { } } diff --git a/frontend/react/src/ui/modals/keybindmodal.tsx b/frontend/react/src/ui/modals/keybindmodal.tsx index fd98864d..bd4e8a65 100644 --- a/frontend/react/src/ui/modals/keybindmodal.tsx +++ b/frontend/react/src/ui/modals/keybindmodal.tsx @@ -62,7 +62,7 @@ export function KeybindModal(props: { open: boolean }) { return ( -
+
{inUseShortcuts.map((shortcut) => ( - {shortcut.getOptions().label} + {shortcut.getOptions().label} ))}
@@ -105,7 +105,7 @@ export function KeybindModal(props: { open: boolean }) {
)} -
+
{shortcut && (