mirror of
https://github.com/isledecomp/isle.pizza.git
synced 2026-05-02 18:53:57 +00:00
17 lines
541 B
JavaScript
17 lines
541 B
JavaScript
// Svelte action: prevents the game engine from hiding overlay elements.
|
|
// The engine sets display:none on DOM elements — this observer forces them back.
|
|
export function keepVisible(node) {
|
|
const observer = new MutationObserver(() => {
|
|
if (node.style.display === 'none') {
|
|
node.style.setProperty('display', 'block', 'important');
|
|
}
|
|
});
|
|
observer.observe(node, { attributes: true, attributeFilter: ['style'] });
|
|
|
|
return {
|
|
destroy() {
|
|
observer.disconnect();
|
|
}
|
|
};
|
|
}
|