Subscribes to active-basemap-key changes. Returns an unsubscribe function.
Exists because the UI cannot learn about activation any other way at boot:
setBaseLayer defers until the map is idle (style + sources still in flight),
and both boot call sites pass silent: true, which suppresses the public
geoleaf:basemap:change event. The UI therefore rendered its buttons, ran
refreshUI() against a still-null key, and never re-synced — leaving no
button highlighted until the user clicked one.
Hooking _setActiveKey rather than the event keeps this path-agnostic: it
fires for the sync raster, WMTS and vector (setStyle) paths alike, and
regardless of silent. State owns no UI import, so no cycle is created.
Subscribes to active-basemap-key changes. Returns an unsubscribe function.
Exists because the UI cannot learn about activation any other way at boot:
setBaseLayerdefers until the map is idle (style + sources still in flight), and both boot call sites passsilent: true, which suppresses the publicgeoleaf:basemap:changeevent. The UI therefore rendered its buttons, ranrefreshUI()against a still-null key, and never re-synced — leaving no button highlighted until the user clicked one.Hooking
_setActiveKeyrather than the event keeps this path-agnostic: it fires for the sync raster, WMTS and vector (setStyle) paths alike, and regardless ofsilent. State owns no UI import, so no cycle is created.