From b39da9c5625c72674a189399335b3b07478bee49 Mon Sep 17 00:00:00 2001 From: PeekabooSteam Date: Thu, 9 Mar 2023 17:09:03 +0000 Subject: [PATCH 1/2] Added reciprocal to measure tool --- client/src/panels/mouseinfopanel.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/panels/mouseinfopanel.ts b/client/src/panels/mouseinfopanel.ts index aaebf15b..eb576bea 100644 --- a/client/src/panels/mouseinfopanel.ts +++ b/client/src/panels/mouseinfopanel.ts @@ -1,6 +1,6 @@ import { Icon, LatLng, Marker, Polyline } from "leaflet"; import { getMap, getMissionData, getUnitsManager } from ".."; -import { distance, bearing, zeroPad, zeroAppend } from "../other/utils"; +import { distance, bearing, zeroPad, zeroAppend, reciprocalHeading } from "../other/utils"; import { Unit } from "../units/unit"; import { Panel } from "./panel"; @@ -121,7 +121,10 @@ export class MouseInfoPanel extends Panel { if (angle < -Math.PI / 2) angle = angle + Math.PI; - this.#measureBox.innerText = `${zeroAppend(Math.floor(bear), 3)}° / ${zeroAppend(Math.floor(dist*0.000539957), 3)} NM` + const bng = zeroAppend(Math.floor(bear), 3); + const reciprocal = reciprocalHeading( parseInt( bng ) ); + + this.#measureBox.innerText = `${bng}° / ${zeroAppend(Math.floor(dist*0.000539957), 3)} NM / ${reciprocal}°`; this.#measureBox.style.left = (getMap().getMousePosition().x + startXY.x) / 2 - this.#measureBox.offsetWidth / 2 + "px"; this.#measureBox.style.top = (getMap().getMousePosition().y + startXY.y) / 2 - this.#measureBox.offsetHeight / 2 + "px"; this.#measureBox.style.rotate = angle + "rad"; From e670b8ed19a390ff108d4352b5bde50fe33faf8c Mon Sep 17 00:00:00 2001 From: PeekabooSteam Date: Thu, 9 Mar 2023 17:14:30 +0000 Subject: [PATCH 2/2] Tweaked measure tool data --- client/src/panels/mouseinfopanel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/panels/mouseinfopanel.ts b/client/src/panels/mouseinfopanel.ts index eb576bea..c0767729 100644 --- a/client/src/panels/mouseinfopanel.ts +++ b/client/src/panels/mouseinfopanel.ts @@ -122,9 +122,9 @@ export class MouseInfoPanel extends Panel { angle = angle + Math.PI; const bng = zeroAppend(Math.floor(bear), 3); - const reciprocal = reciprocalHeading( parseInt( bng ) ); + const reciprocal = zeroAppend( reciprocalHeading( parseInt( bng ) ), 3 ); - this.#measureBox.innerText = `${bng}° / ${zeroAppend(Math.floor(dist*0.000539957), 3)} NM / ${reciprocal}°`; + this.#measureBox.innerText = `${bng}° | ${Math.floor(dist*0.000539957)}nm | ${reciprocal}°`; this.#measureBox.style.left = (getMap().getMousePosition().x + startXY.x) / 2 - this.#measureBox.offsetWidth / 2 + "px"; this.#measureBox.style.top = (getMap().getMousePosition().y + startXY.y) / 2 - this.#measureBox.offsetHeight / 2 + "px"; this.#measureBox.style.rotate = angle + "rad";