diff --git a/client/src/panels/mouseinfopanel.ts b/client/src/panels/mouseinfopanel.ts index ef7a9656..023ca085 100644 --- a/client/src/panels/mouseinfopanel.ts +++ b/client/src/panels/mouseinfopanel.ts @@ -72,6 +72,41 @@ export class MouseInfoPanel extends Panel { el.dataset.distanceUnits = "nm"; } } + + const refMouseLat = document.getElementById( "ref-mouse-position-latitude" ); + const mouseLat = document.getElementById( "mouse-position-latitude" ); + + if ( refMouseLat && mouseLat ) { + + let matches = String( mousePosition.lat ).match( /^\-?(\d+)\.(\d{2})(\d{2})(\d{2})/ ); + + if ( matches && matches.length ) { + mouseLat.dataset.dd = matches[1]; + mouseLat.dataset.mm = matches[2]; + mouseLat.dataset.ss = matches[3]; + mouseLat.dataset.sss = matches[4]; + } + + refMouseLat.dataset.label = ( mousePosition.lat < 0 ) ? "S" : "N"; + + } + + const refMouseLng = document.getElementById( "ref-mouse-position-longitude" ); + const mouseLng = document.getElementById( "mouse-position-longitude" ); + + if ( refMouseLng && mouseLng ) { + + let matches = String( mousePosition.lng ).match( /^\-?(\d+)\.(\d{2})(\d{2})(\d{2})/ ); + + if ( matches && matches.length ) { + mouseLng.dataset.dd = matches[1]; + mouseLng.dataset.mm = matches[2]; + mouseLng.dataset.ss = matches[3]; + mouseLng.dataset.sss = matches[4]; + } + + refMouseLng.dataset.label = ( mousePosition.lng < 0 ) ? "W" : "E"; + } } #onMapClick(e: any) diff --git a/client/views/mouseinfopanel.ejs b/client/views/mouseinfopanel.ejs index 40d96ec7..ecf62d24 100644 --- a/client/views/mouseinfopanel.ejs +++ b/client/views/mouseinfopanel.ejs @@ -20,9 +20,9 @@
-
+
-
+