mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 19:34:01 +00:00
chore: drop unused exports from modules QA harnesses load
QA harnesses import some modules in the page by path, for example
import('/src/data/radio.js'). Those calls name exactly which bindings
they use, and every other export of these modules has no importer:
- src/data/radio.js: 20 aliases of radio layer methods and two
re-exported altitude constants. The radio layer keeps the methods.
- src/layers/transit/movement.js: tuning constants and course helpers
used only inside the module lose `export`; FIX_HISTORY_MAX,
DISPLAY_LAG_MIN_MS, DISPLAY_LAG_RESET_MS, FIX_NOISE_M, STOPPED_FIXES
and courseBetween, which nothing reads, are deleted.
- src/overlays/worldOverlay.js, src/splitFlap.js,
src/data/contactPlayback.js and src/voice/cloudVoiceAuth.js: helpers
and constants used only locally lose `export`.
This commit is contained in:
1 parent
86f271a78f
commit
46f7b74c8c
6 files changed
+15
-73
No files matched your search
@@ -181,7 +181,7 @@ export function trimTrack(track, nowMs, keep = track.capacity) {
|
|||||||
for (const id of track.epochs.keys())
|
for (const id of track.epochs.keys())
|
||||||
if (!used.has(id)) track.epochs.delete(id);
|
if (!used.has(id)) track.epochs.delete(id);
|
||||||
}
|
}
|
||||||
export function validFix(fix) {
|
function validFix(fix) {
|
||||||
return (
|
return (
|
||||||
Number.isFinite(fix?.t) &&
|
Number.isFinite(fix?.t) &&
|
||||||
fix.t >= 0 &&
|
fix.t >= 0 &&
|
||||||
|
|||||||
@@ -49,34 +49,12 @@ export const buildRadioTunerBand = layer.buildRadioTunerBand;
|
|||||||
export const radioTuningStaticShouldPlay = layer.radioTuningStaticShouldPlay;
|
export const radioTuningStaticShouldPlay = layer.radioTuningStaticShouldPlay;
|
||||||
export const getRadioAcceptedCatalogSnapshot =
|
export const getRadioAcceptedCatalogSnapshot =
|
||||||
layer.getRadioAcceptedCatalogSnapshot;
|
layer.getRadioAcceptedCatalogSnapshot;
|
||||||
export const radioStationResolutionMatches =
|
|
||||||
layer.radioStationResolutionMatches;
|
|
||||||
export const getRadioUIState = layer.getRadioUIState;
|
export const getRadioUIState = layer.getRadioUIState;
|
||||||
export const subscribeToRadio = layer.subscribeToRadio;
|
|
||||||
export const subscribeToRadioPlaybackControls =
|
|
||||||
layer.subscribeToRadioPlaybackControls;
|
|
||||||
export const getRadioTunerStations = layer.getRadioTunerStations;
|
|
||||||
export const beginRadioTuning = layer.beginRadioTuning;
|
|
||||||
export const setRadioTuningStatic = layer.setRadioTuningStatic;
|
|
||||||
export const radioCameraNavigationAllowed = layer.radioCameraNavigationAllowed;
|
export const radioCameraNavigationAllowed = layer.radioCameraNavigationAllowed;
|
||||||
export const previewRadioTuningStation = layer.previewRadioTuningStation;
|
|
||||||
export const endRadioTuning = layer.endRadioTuning;
|
|
||||||
export const cancelRadioTuning = layer.cancelRadioTuning;
|
|
||||||
export const commitRadioTuningStation = layer.commitRadioTuningStation;
|
|
||||||
export const playSelectedRadio = layer.playSelectedRadio;
|
|
||||||
export const confirmRadioPlayback = layer.confirmRadioPlayback;
|
export const confirmRadioPlayback = layer.confirmRadioPlayback;
|
||||||
export const playPreparedRadioForVoice = layer.playPreparedRadioForVoice;
|
|
||||||
export const stopRadioPlayback = layer.stopRadioPlayback;
|
|
||||||
export const toggleRadioPlayback = layer.toggleRadioPlayback;
|
|
||||||
export const pauseRadioPlayback = layer.pauseRadioPlayback;
|
|
||||||
export const setRadioVolume = layer.setRadioVolume;
|
export const setRadioVolume = layer.setRadioVolume;
|
||||||
export const setRadioParams = layer.setRadioParams;
|
export const setRadioParams = layer.setRadioParams;
|
||||||
export const getRadioParams = layer.getRadioParams;
|
|
||||||
export const setRadioVoiceDucking = layer.setRadioVoiceDucking;
|
export const setRadioVoiceDucking = layer.setRadioVoiceDucking;
|
||||||
export const selectRadioStation = layer.selectRadioStation;
|
|
||||||
export const cycleRadioStation = layer.cycleRadioStation;
|
|
||||||
export const selectRequestedRadioStation = layer.selectRequestedRadioStation;
|
|
||||||
export const setRadioFilter = layer.setRadioFilter;
|
|
||||||
export const retainRadioClusterIdentitiesForStations =
|
export const retainRadioClusterIdentitiesForStations =
|
||||||
layer.retainRadioClusterIdentitiesForStations;
|
layer.retainRadioClusterIdentitiesForStations;
|
||||||
export {
|
export {
|
||||||
@@ -86,10 +64,8 @@ export {
|
|||||||
RADIO_SINGLETON_MID_LIMIT,
|
RADIO_SINGLETON_MID_LIMIT,
|
||||||
RADIO_SINGLETON_NEAR_LIMIT,
|
RADIO_SINGLETON_NEAR_LIMIT,
|
||||||
RADIO_GLOBE_INTERACTION_MAX_DISTANCE_M,
|
RADIO_GLOBE_INTERACTION_MAX_DISTANCE_M,
|
||||||
RADIO_GLOBE_RECENTER_MAX_HEIGHT_M,
|
|
||||||
RADIO_OVERLAY_SOURCE_OPTIONS,
|
RADIO_OVERLAY_SOURCE_OPTIONS,
|
||||||
DEFAULT_RADIO_FILTER,
|
DEFAULT_RADIO_FILTER,
|
||||||
GLOBAL_RADIO_ALTITUDE_M,
|
|
||||||
} from '../layers/radio/index.js';
|
} from '../layers/radio/index.js';
|
||||||
export default layer;
|
export default layer;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,7 @@ import {
|
|||||||
correctHeight,
|
correctHeight,
|
||||||
setTimeOffsetMs,
|
setTimeOffsetMs,
|
||||||
} from '../../data/contactPlayback.js';
|
} from '../../data/contactPlayback.js';
|
||||||
export const FIX_HISTORY_MAX = 128;
|
const MODE_MAX_SPEED_MPS = Object.freeze({
|
||||||
export const DISPLAY_LAG_MIN_MS = 25_000;
|
|
||||||
export const DISPLAY_LAG_RESET_MS = 90_000;
|
|
||||||
export const MODE_MAX_SPEED_MPS = Object.freeze({
|
|
||||||
bus: 36, // ~130 km/h — a coach on a motorway
|
bus: 36, // ~130 km/h — a coach on a motorway
|
||||||
tram: 28, // ~100 km/h — interurban light rail
|
tram: 28, // ~100 km/h — interurban light rail
|
||||||
subway: 42, // ~150 km/h
|
subway: 42, // ~150 km/h
|
||||||
@@ -32,22 +29,19 @@ export const MODE_MAX_SPEED_MPS = Object.freeze({
|
|||||||
* @param {boolean} [inferred] Whether the mode came from a feed default.
|
* @param {boolean} [inferred] Whether the mode came from a feed default.
|
||||||
* @returns {number} m/s
|
* @returns {number} m/s
|
||||||
*/
|
*/
|
||||||
export function speedCeilingMps(mode, inferred = false) {
|
function speedCeilingMps(mode, inferred = false) {
|
||||||
if (inferred) return MODE_MAX_SPEED_MPS.unknown;
|
if (inferred) return MODE_MAX_SPEED_MPS.unknown;
|
||||||
return MODE_MAX_SPEED_MPS[mode] ?? MODE_MAX_SPEED_MPS.unknown;
|
return MODE_MAX_SPEED_MPS[mode] ?? MODE_MAX_SPEED_MPS.unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Position deadband is disabled: even a short reported crawl is played. */
|
|
||||||
export const FIX_NOISE_M = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displacement (m) a glide must cover before its direction is worth believing.
|
* Displacement (m) a glide must cover before its direction is worth believing.
|
||||||
* Below this the course derived from it is noise; the last good one is held.
|
* Below this the course derived from it is noise; the last good one is held.
|
||||||
*/
|
*/
|
||||||
export const COURSE_MIN_TRAVEL_M = 12;
|
const COURSE_MIN_TRAVEL_M = 12;
|
||||||
|
|
||||||
/** Maximum display-course change per second (deg). A bus is not a gyroscope. */
|
/** Maximum display-course change per second (deg). A bus is not a gyroscope. */
|
||||||
export const COURSE_MAX_RATE_DEG_PER_S = 120;
|
const COURSE_MAX_RATE_DEG_PER_S = 120;
|
||||||
/**
|
/**
|
||||||
* Longest stretch of elapsed time (s) one evaluation may spend. The limiter
|
* Longest stretch of elapsed time (s) one evaluation may spend. The limiter
|
||||||
* used to bank the time since the course last CHANGED, so a vehicle that held
|
* used to bank the time since the course last CHANGED, so a vehicle that held
|
||||||
@@ -56,15 +50,7 @@ export const COURSE_MAX_RATE_DEG_PER_S = 120;
|
|||||||
* EVALUATED, and capped here so that even a first look after a long idle
|
* EVALUATED, and capped here so that even a first look after a long idle
|
||||||
* sweeps visibly instead of snapping.
|
* sweeps visibly instead of snapping.
|
||||||
*/
|
*/
|
||||||
export const COURSE_STEP_MAX_S = 0.25;
|
const COURSE_STEP_MAX_S = 0.25;
|
||||||
|
|
||||||
/**
|
|
||||||
* Consecutive fixes at the same place before a vehicle is called STOPPED.
|
|
||||||
* One is not enough: a fifteen-second gap between identical fixes is also what
|
|
||||||
* a vehicle waiting at a light looks like, and so is a feed that repeated
|
|
||||||
* itself.
|
|
||||||
*/
|
|
||||||
export const STOPPED_FIXES = 2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How long after its newest fix a vehicle stops being described as travelling.
|
* How long after its newest fix a vehicle stops being described as travelling.
|
||||||
@@ -75,7 +61,7 @@ export const STOPPED_FIXES = 2;
|
|||||||
* otherwise is the same overreach as reading STOPPED off a stale status. Ninety
|
* otherwise is the same overreach as reading STOPPED off a stale status. Ninety
|
||||||
* seconds matches the threshold at which a whole feed reads as gone quiet.
|
* seconds matches the threshold at which a whole feed reads as gone quiet.
|
||||||
*/
|
*/
|
||||||
export const MOTION_UNKNOWN_AFTER_MS = 90_000;
|
const MOTION_UNKNOWN_AFTER_MS = 90_000;
|
||||||
|
|
||||||
const EARTH_M_PER_DEG = 111_320;
|
const EARTH_M_PER_DEG = 111_320;
|
||||||
|
|
||||||
@@ -94,29 +80,13 @@ export function fixDistanceM(a, b) {
|
|||||||
return Math.hypot(dLat, dLon);
|
return Math.hypot(dLat, dLon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Course in degrees clockwise from north, from one point to another.
|
|
||||||
* @param {{lat:number, lon:number}} from
|
|
||||||
* @param {{lat:number, lon:number}} to
|
|
||||||
* @returns {number} 0-360
|
|
||||||
*/
|
|
||||||
export function courseBetween(from, to) {
|
|
||||||
const dLat = (to.lat - from.lat) * EARTH_M_PER_DEG;
|
|
||||||
const dLon =
|
|
||||||
(to.lon - from.lon) *
|
|
||||||
EARTH_M_PER_DEG *
|
|
||||||
Math.cos((from.lat * Math.PI) / 180);
|
|
||||||
const deg = (Math.atan2(dLon, dLat) * 180) / Math.PI;
|
|
||||||
return (deg + 360) % 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortest signed difference between two courses, in degrees (-180, 180].
|
* Shortest signed difference between two courses, in degrees (-180, 180].
|
||||||
* @param {number} from
|
* @param {number} from
|
||||||
* @param {number} to
|
* @param {number} to
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export function courseDelta(from, to) {
|
function courseDelta(from, to) {
|
||||||
let delta = ((to - from + 540) % 360) - 180;
|
let delta = ((to - from + 540) % 360) - 180;
|
||||||
if (delta === -180) delta = 180;
|
if (delta === -180) delta = 180;
|
||||||
return delta;
|
return delta;
|
||||||
@@ -259,7 +229,7 @@ export function attachFloorToPlace(entry, fix, heightM) {
|
|||||||
correctHeight(entry.track, scratch.seq, heightM);
|
correctHeight(entry.track, scratch.seq, heightM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function displayCourse(entry, nowMs) {
|
function displayCourse(entry, nowMs) {
|
||||||
if (!entry) return null;
|
if (!entry) return null;
|
||||||
const target = Number.isFinite(entry.sample?.segmentCourseDeg)
|
const target = Number.isFinite(entry.sample?.segmentCourseDeg)
|
||||||
? entry.sample.segmentCourseDeg
|
? entry.sample.segmentCourseDeg
|
||||||
|
|||||||
@@ -1155,11 +1155,7 @@ export function isOverlayPointVisible(
|
|||||||
* Return true when a rectangle intersects any cached UI exclusion box.
|
* Return true when a rectangle intersects any cached UI exclusion box.
|
||||||
* `count` lets pooled buffers expose a live prefix without truncating.
|
* `count` lets pooled buffers expose a live prefix without truncating.
|
||||||
*/
|
*/
|
||||||
export function overlayRectIntersectsAny(
|
function overlayRectIntersectsAny(rect, exclusions, count = exclusions.length) {
|
||||||
rect,
|
|
||||||
exclusions,
|
|
||||||
count = exclusions.length,
|
|
||||||
) {
|
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
const other = exclusions[i];
|
const other = exclusions[i];
|
||||||
if (
|
if (
|
||||||
@@ -1177,7 +1173,7 @@ export function overlayRectIntersectsAny(
|
|||||||
* Like `overlayRectIntersectsAny`, but only against exclusions that composite
|
* Like `overlayRectIntersectsAny`, but only against exclusions that composite
|
||||||
* BELOW the host — the ones a placement may never overlap at any cost.
|
* BELOW the host — the ones a placement may never overlap at any cost.
|
||||||
*/
|
*/
|
||||||
export function overlayRectIntersectsAnyHard(
|
function overlayRectIntersectsAnyHard(
|
||||||
rect,
|
rect,
|
||||||
exclusions,
|
exclusions,
|
||||||
count = exclusions.length,
|
count = exclusions.length,
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ export const FLAP_STAGGER_MS = 26;
|
|||||||
*/
|
*/
|
||||||
export const FLAP_MAX_TOTAL_MS = 620;
|
export const FLAP_MAX_TOTAL_MS = 620;
|
||||||
/** Slack after the last character lands before the cells are stripped. */
|
/** Slack after the last character lands before the cells are stripped. */
|
||||||
export const FLAP_SETTLE_SLACK_MS = 60;
|
const FLAP_SETTLE_SLACK_MS = 60;
|
||||||
/**
|
/**
|
||||||
* Fraction of a character's flip at which the outgoing glyph has rotated
|
* Fraction of a character's flip at which the outgoing glyph has rotated
|
||||||
* away and the incoming one takes over as what the eye reads. MUST track the
|
* away and the incoming one takes over as what the eye reads. MUST track the
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const CLOUD_VOICE_AUTH_MODES = Object.freeze(['api-key', 'oauth']);
|
const CLOUD_VOICE_AUTH_MODES = Object.freeze(['api-key', 'oauth']);
|
||||||
export const DEFAULT_CLOUD_VOICE_AUTH_MODE = 'api-key';
|
const DEFAULT_CLOUD_VOICE_AUTH_MODE = 'api-key';
|
||||||
export const CLOUD_VOICE_AUTH_STORAGE_KEY = 'godsEyeView.voice.cloudAuth';
|
export const CLOUD_VOICE_AUTH_STORAGE_KEY = 'godsEyeView.voice.cloudAuth';
|
||||||
|
|
||||||
function storageRef(storage) {
|
function storageRef(storage) {
|
||||||
@@ -11,7 +11,7 @@ function storageRef(storage) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeCloudVoiceAuthMode(mode) {
|
function normalizeCloudVoiceAuthMode(mode) {
|
||||||
const normalized = String(mode || '')
|
const normalized = String(mode || '')
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
|
|||||||
Reference in new issue
Block a user