mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The transit, ALPR, vessel, CCTV and flight/military context fixes each wrapped 359.5° to north with an inline Math.round(x) % 360. They now call roundHeadingDegrees in src/data/headingDegrees.js, which also wraps negative and multi-turn bearings. normalizeHeading moves there with it, and cockpitMath re-exports it so existing imports keep working. It now adds a turn only to a negative remainder, so a bearing just under half a degree keeps its precision. The awareness, Local ADS-B, cockpit wind, cockpit heading and Street Level readouts use the same helper. The Cockpit's TRACK ACQUIRED signal rounded without wrapping and could read COURSE 360°; it now uses formatHeadingReadout, which shows --- for a track that is not finite.
12 lines
347 B
JavaScript
12 lines
347 B
JavaScript
import { roundHeadingDegrees } from '../../data/headingDegrees.js';
|
|
|
|
/**
|
|
* Format a compass direction for the awareness overlay.
|
|
* @param {number} degrees
|
|
* @returns {string}
|
|
*/
|
|
export function formatAwarenessDirection(degrees) {
|
|
if (!Number.isFinite(degrees)) return '—';
|
|
return String(roundHeadingDegrees(degrees)).padStart(3, '0');
|
|
}
|