refactor(engine): name HUD popover Z-layers; replace raw arithmetic (M-24)

ZIndex(Z_HUD + 4) and ZIndex(Z_HUD + 5) across four sites in
hud_plugin.rs were magic-number expressions. Define named constants in
ui_theme:

  Z_HUD_POPOVER_BACKDROP = Z_HUD + 4  (fullscreen dismiss backdrop)
  Z_HUD_POPOVER          = Z_HUD + 5  (popover panel)

The score-delta floater (Z_HUD + 10) now uses the existing Z_HUD_TOP
constant, whose doc is updated to mention transient annotations.
Both new constants are added to the monotonic z-hierarchy test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-17 21:35:35 -07:00
parent c8878d6e8b
commit 4aafc0a53d
2 changed files with 19 additions and 9 deletions
+9 -2
View File
@@ -401,8 +401,13 @@ pub const Z_BACKGROUND: i32 = -10;
pub const Z_PILE_MARKER: i32 = -1;
/// Base layer for HUD readouts (top-left).
pub const Z_HUD: i32 = 50;
/// Action bar + popovers — above HUD readouts so dropdowns can overlap.
pub const Z_HUD_TOP: i32 = 60;
/// Fullscreen transparent dismiss-backdrop spawned behind a HUD popover so
/// tapping outside it light-dismisses the panel without blocking other input.
pub const Z_HUD_POPOVER_BACKDROP: i32 = Z_HUD + 4;
/// HUD popovers (Modes dropdown, etc.) — above the dismiss backdrop.
pub const Z_HUD_POPOVER: i32 = Z_HUD + 5;
/// Transient HUD annotations (score-delta floaters) — above popovers.
pub const Z_HUD_TOP: i32 = Z_HUD + 10;
pub const Z_MODAL_SCRIM: i32 = 200;
pub const Z_MODAL_PANEL: i32 = 210;
/// Pause overlay outranks normal modals — pausing should always be on top.
@@ -648,6 +653,8 @@ mod tests {
Z_BACKGROUND,
Z_PILE_MARKER,
Z_HUD,
Z_HUD_POPOVER_BACKDROP,
Z_HUD_POPOVER,
Z_HUD_TOP,
Z_MODAL_SCRIM,
Z_MODAL_PANEL,