feat(ui): centralize retained window lifecycle

This commit is contained in:
Erik 2026-07-10 21:31:18 +02:00
parent 4bb37e302e
commit 6e9e10367f
12 changed files with 778 additions and 57 deletions

View file

@ -120,7 +120,25 @@ public abstract class UiElement
}
// ── State flags ─────────────────────────────────────────────────────
public bool Visible { get; set; } = true;
private bool _visible = true;
public bool Visible
{
get => _visible;
set
{
if (_visible == value) return;
// A top-level visibility transition is also an ownership boundary:
// focus/capture/modal state must be released before the subtree becomes
// unreachable to input. UiRoot filters these notifications through the
// registered-window manager, while ordinary child visibility changes
// remain cheap and behavior-neutral.
UiRoot? root = FindRoot();
root?.OnElementVisibilityChanging(this, value);
_visible = value;
root?.OnElementVisibilityChanged(this, value);
}
}
private bool _enabled = true;
public bool Enabled
{