@jsvision/ui / syncOverlayVisible
Function: syncOverlayVisible()
syncOverlayVisible(
overlay):void
Defined in: ui/src/app/application.ts:375
Show the shared popup overlay while it hosts any popup, and hide it once empty.
The single full-screen overlay is shared by every popup client (menu popups, dropdown popups). Its visibility is derived from whether it currently has any child, so two clients cannot fight over an explicit visible/hidden flag — it stays visible while any popup is mounted and hides only when the last one is removed. Call it after adding to or removing from the overlay. The child list and the visible flag are plain (non-reactive) values, so the update is done imperatively, including the invalidate() that schedules the repaint.
Parameters
overlay
The shared popup overlay group.
Returns
void
Example
import { Group, syncOverlayVisible } from '@jsvision/ui';
const overlay = new Group();
const myPopup = new Group();
overlay.add(myPopup);
syncOverlayVisible(overlay); // overlay becomes visible
overlay.remove(myPopup);
syncOverlayVisible(overlay); // overlay hides again now that it is empty