Skip to main content

hold

Function hold 

Source
pub fn hold<R>(
    ctx: &Context,
    spec: &OverlaySpec,
    open: &mut bool,
    anchor: Option<Rect>,
    rect: Rect,
    draw: impl FnOnce() -> R,
) -> Option<R>
Expand description

Holds an overlay its owner draws itself (a flyout laid out against the workbench rather than placed by crate::placement) in the stack, under the stack’s rules: Escape and a click outside rect and anchor close it, the focus going back where it was. Call it each pass while *open, with where the overlay is drawn this pass and draw drawing it (egui popups opened from inside are part of it); it sets *open to false and returns None, without drawing, once the overlay closed.