Skip to main content

Module popup

Module popup 

Source
Expand description

A thin popup abstraction layered on top of the menu system.

The framework already ships a full popup implementation inside super::menu: PopupMenu/PopupMenuState handle overlay painting, hit testing, keyboard navigation, submenu cascades, and dismiss-on-outside. What that system deliberately does not offer is arbitrary anchor placement — its popups always open left-aligned and extend straight up or down from a bar or a click point.

This module fills exactly that gap, and nothing more:

  • RectAlign / Align2 / Align — parent/child anchor placement math (egui’s RectAlign), with named presets and a pixel gap. Pure functions, unit-tested against production code.
  • Popup — a content-agnostic controller owning open-state, anchor, placement, gap, and PopupCloseBehavior. A host widget supplies the content and painting.

For nested-menu content, reuse PopupMenu rather than growing this module — its submenu mechanism is the intended way to nest.

Re-exports§

pub use align::clamp_rect;
pub use align::Align;
pub use align::Align2;
pub use align::RectAlign;
pub use behavior::Popup;
pub use behavior::PopupClickOutcome;
pub use behavior::PopupCloseBehavior;

Modules§

align
Anchor-relative placement math for popups — this framework’s answer to egui’s RectAlign.
behavior
Open-state and close-behavior controller for anchored popups.