mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #108 from Pax1601/75-at-mouse-coordinates-not-shown-in-panel
75 at mouse coordinates not shown in panel
This commit is contained in:
@@ -72,6 +72,41 @@ export class MouseInfoPanel extends Panel {
|
||||
el.dataset.distanceUnits = "nm";
|
||||
}
|
||||
}
|
||||
|
||||
const refMouseLat = <HTMLElement>document.getElementById( "ref-mouse-position-latitude" );
|
||||
const mouseLat = <HTMLElement>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 = <HTMLElement>document.getElementById( "ref-mouse-position-longitude" );
|
||||
const mouseLng = <HTMLElement>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)
|
||||
@@ -155,13 +190,30 @@ export class MouseInfoPanel extends Panel {
|
||||
|
||||
#onUnitsSelection(units: Unit[])
|
||||
{
|
||||
if (units.length == 1)
|
||||
this.getElement().querySelector(`#unit-position`)?.classList.toggle("hide", false);
|
||||
const pos = this.getElement().querySelector(`#unit-position`);
|
||||
|
||||
if ( units.length > 1 ) {
|
||||
pos?.setAttribute( "data-message", "(multiple units)" );
|
||||
} else {
|
||||
pos?.removeAttribute( "data-message" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#onClearSelection()
|
||||
{
|
||||
this.#measureBox.classList.toggle("hide", true);
|
||||
this.getElement().querySelector(`#unit-position`)?.classList.toggle("hide", true);
|
||||
|
||||
const pos = this.getElement().querySelector(`#unit-position`);
|
||||
|
||||
|
||||
if ( pos instanceof HTMLElement ) {
|
||||
pos?.removeAttribute( "data-message" );
|
||||
|
||||
pos.dataset.bearing = "---";
|
||||
pos.dataset.distance = "---";
|
||||
pos.dataset.distanceUnits = "nm";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user