Wires the basemap-switcher listeners, once per lifecycle.
Binds three things: a delegated click on [data-gl-baselayer], a debounced resize, and
a subscription to the active-key state. Guarded by a flag, so repeated calls are no-ops
until destroyUI clears it.
⚠️ The handlers are kept in refs rather than inlined becausedestroyUI resets that
flag: with anonymous listeners, a destroy/re-init cycle would re-add them and fire
setBaseLayer once per past cycle. The state subscription is what keeps a button
highlighted at boot — setBaseLayer defers until the map is idle, and that late
activation is silent, so nothing else would mark the control.
Wires the basemap-switcher listeners, once per lifecycle.
Binds three things: a delegated
clickon[data-gl-baselayer], a debouncedresize, and a subscription to the active-key state. Guarded by a flag, so repeated calls are no-ops until destroyUI clears it.⚠️ The handlers are kept in refs rather than inlined because
destroyUIresets that flag: with anonymous listeners, a destroy/re-init cycle would re-add them and firesetBaseLayeronce per past cycle. The state subscription is what keeps a button highlighted at boot —setBaseLayerdefers until the map is idle, and that late activation is silent, so nothing else would mark the control.