mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
The top-center bar is now GlobeActions.vue. The shell publishes whether a clear is under way and answers the clear and share buttons through the globe actions store, instead of binding listeners and writing attributes on the buttons. A shell disposed mid-clear resets the busy state, so the next shell's bar is not left busy. bindClearLayersControl stays exported and is deprecated.
34 lines
940 B
JavaScript
34 lines
940 B
JavaScript
import { t } from '../i18n/index.js';
|
|
|
|
/**
|
|
* Keep the clear action focusable while busy; the caller owns its
|
|
* transaction. The globe actions view renders the button from the globe
|
|
* actions store now; this stays exported from `./ui/layers` for hosts that
|
|
* imported it.
|
|
* @deprecated
|
|
*/
|
|
export function bindClearLayersControl(button, clear) {
|
|
let destroyed = false;
|
|
const click = () => {
|
|
if (!destroyed) void clear();
|
|
};
|
|
button?.addEventListener('click', click);
|
|
return {
|
|
setBusy(busy) {
|
|
if (destroyed || !button) return;
|
|
button.setAttribute('aria-disabled', String(busy));
|
|
button.setAttribute('aria-busy', String(busy));
|
|
button.setAttribute(
|
|
'aria-label',
|
|
busy
|
|
? t('Clearing selected data layers')
|
|
: t('Clear selected data layers'),
|
|
);
|
|
},
|
|
destroy() {
|
|
destroyed = true;
|
|
button?.removeEventListener('click', click);
|
|
},
|
|
};
|
|
}
|