ui/map/MapStyleManager¶
Classes¶
MapStyleManager¶
Defined in: ui/map/MapStyleManager.ts:32
MapStyleManager - basemap style selection, persistence, and offline fallback, extracted from MapDisplay.
Owns the saved-style storage key, the settings-modal style selector wiring, and the one-shot fallback to the bundled offline style when the remote basemap is unreachable.
Constructors¶
Constructor¶
Defined in: ui/map/MapStyleManager.ts:49
Parameters¶
getMap¶
() => Map$1 | null
onBeforeStyleChange?¶
() => void
Returns¶
Methods¶
resolveInitialStyle()¶
Defined in: ui/map/MapStyleManager.ts:60
Resolve the style the map should start with: the user's saved choice when present, the default basemap otherwise.
Returns¶
string
getCurrentStyle()¶
Defined in: ui/map/MapStyleManager.ts:68
The style URL currently applied (or being applied).
Returns¶
string
changeStyle()¶
Defined in: ui/map/MapStyleManager.ts:76
Change the map style
Parameters¶
styleUrl¶
string
URL of the new map style
Returns¶
void
armFirstLoadFallback()¶
Defined in: ui/map/MapStyleManager.ts:126
Make the first-load offline fallback deterministic. Call once right after the map is constructed, when the initial style may be remote.
The 'error'-event fallback in handleMapError only fires if the style fetch rejects; on an air-gapped network it often just hangs for minutes, leaving a blank basemap. So probe the same style document with our own timeout, and if the probe fails while the map still has no loaded style, swap to the bundled offline basemap immediately. If the style loads first — or the user picks another style meanwhile — the probe result is ignored.
Returns¶
void
handleMapError()¶
Defined in: ui/map/MapStyleManager.ts:166
Route a MapLibre 'error' event: fall back to the offline basemap on network failures, suppress known non-critical errors, log the rest.
Parameters¶
e¶
MapErrorEvent
Returns¶
void
setupStyleSelector()¶
Defined in: ui/map/MapStyleManager.ts:248
Set up map style selector event handlers This connects the HTML select element to the map style changing logic
Returns¶
void
hideMapStyleMessage()¶
Defined in: ui/map/MapStyleManager.ts:462
Hide the map style message overlay
Returns¶
void