ui/map/MapDisplay¶
Classes¶
MapDisplay¶
Defined in: ui/map/MapDisplay.ts:31
MapDisplay - Core map functionality
Handles MapLibre GL map initialization, base map management, and map style selection. This is the foundation for the radar display, providing the canvas for aircraft and other visualizations.
Constructors¶
Constructor¶
Defined in: ui/map/MapDisplay.ts:69
Constructor
Parameters¶
containerId?¶
string = 'map'
The ID of the HTML element to contain the map
Returns¶
Methods¶
initialize()¶
Defined in: ui/map/MapDisplay.ts:83
Initialize the map Creates and configures the MapLibre GL map instance
Returns¶
void
changeMapStyle()¶
Defined in: ui/map/MapDisplay.ts:301
Change the map style (delegates to MapStyleManager)
Parameters¶
styleUrl¶
string
URL of the new map style
Returns¶
void
setupStyleSelector()¶
Defined in: ui/map/MapDisplay.ts:308
Wire the settings-modal style selector (delegates to MapStyleManager)
Returns¶
void
toggleProjection()¶
Defined in: ui/map/MapDisplay.ts:318
Toggle map projection between mercator and globe
Returns¶
void
getProjection()¶
Defined in: ui/map/MapDisplay.ts:341
Get the current projection type
Returns¶
"mercator" | "globe"
getMap()¶
Defined in: ui/map/MapDisplay.ts:348
Get the MapLibre GL map instance
Returns¶
Map$1 | null
getMapTheme()¶
Defined in: ui/map/MapDisplay.ts:359
Classify the active basemap as 'light' or 'dark' so overlays (e.g. the navdata renderer) can pick a palette that reads well against it. The known dark styles are the bundled offline-dark style, Dark Matter, and the OpenFreeMap dark/fiord styles; everything else (Positron, Bright, Liberty, MapTiler, custom URLs) uses the light palette.
Returns¶
"light" | "dark"
isInitialized()¶
Defined in: ui/map/MapDisplay.ts:370
Check if map is initialized
Returns¶
boolean
resize()¶
Defined in: ui/map/MapDisplay.ts:387
Resize the map to its container, without flashing.
MapLibre's resize() reassigns the canvas width/height attributes, and a canvas assignment clears the drawing buffer even when the value is unchanged. A bare map.resize() therefore leaves a blank (background colored) canvas until MapLibre's next scheduled render frame — visible as an intermittent white flash. Following resize() with the synchronous redraw() repaints in the same frame, which is exactly what MapLibre's own container ResizeObserver does internally. Every manual resync (panel/layout changes, style swaps, DPR changes) must go through this method rather than calling map.resize() directly.
Returns¶
void
getCenter()¶
Defined in: ui/map/MapDisplay.ts:428
Get the map center
Returns¶
[number, number]
setCenter()¶
Defined in: ui/map/MapDisplay.ts:437
Set the map center
Parameters¶
lng¶
number
lat¶
number
zoom?¶
number
Returns¶
void
getZoom()¶
Defined in: ui/map/MapDisplay.ts:451
Get the current zoom level
Returns¶
number
setZoom()¶
Defined in: ui/map/MapDisplay.ts:459
Set the zoom level
Parameters¶
zoom¶
number
Returns¶
void
zoomIn()¶
Defined in: ui/map/MapDisplay.ts:467
Zoom in by one level
Returns¶
void
zoomOut()¶
Defined in: ui/map/MapDisplay.ts:475
Zoom out by one level
Returns¶
void
panTo()¶
Defined in: ui/map/MapDisplay.ts:483
Pan to a specific location (animated)
Parameters¶
lat¶
number
lon¶
number
Returns¶
void
getCurrentBounds()¶
Defined in: ui/map/MapDisplay.ts:492
Get current map bounds Returns [west, south, east, north] for MCRE commands
Returns¶
number[] | null
fitBounds()¶
Defined in: ui/map/MapDisplay.ts:505
Fit the map to bounds
Parameters¶
bounds¶
[[number, number], [number, number]]
options?¶
FitBoundsOptions
Returns¶
void
onStyleChange()¶
Defined in: ui/map/MapDisplay.ts:514
Set a callback to be invoked when the map style changes
Parameters¶
callback¶
() => void
Function to call when style loads
Returns¶
void
onBeforeStyleChange()¶
Defined in: ui/map/MapDisplay.ts:524
Set a callback to be invoked right before every style swap starts (map.setStyle is about to be called), so listeners can tear down layers they attached to the outgoing style's sources first.
Parameters¶
callback¶
() => void
Function to call before the style change
Returns¶
void
setMapLoadCallback()¶
Defined in: ui/map/MapDisplay.ts:532
Set a callback to be invoked when the map finishes loading
Parameters¶
callback¶
() => void
Function to call when map loads
Returns¶
void
destroy()¶
Defined in: ui/map/MapDisplay.ts:544
Destroy the map and clean up resources
Returns¶
void