Function draw_confirm_dialog

Source
pub fn draw_confirm_dialog(
    full: Rect,
    texts: ConfirmDialogTexts<'_>,
    style: ConfirmDialogStyle,
    text: &mut TextSystem,
) -> (Vec<DrawCmd>, ConfirmDialogLayout)
Expand description

Draws a fixed confirmation panel centered in full.

The panel remains 520×220 logical pixels even when full is smaller, so it may extend outside the viewport. The function returns ten commands in paint order (scrim, surfaces, then four text commands) plus button hit geometry. Text is unwrapped and the function performs shaping allocations/cache access.

§Examples

use ailloli_ui_core::Rect;
use ailloli_ui_text::TextSystem;
use ailloli_ui_widgets::overlay::modal::{draw_confirm_dialog, ConfirmDialogStyle, ConfirmDialogTexts};
let mut text_system = TextSystem::new();
let texts = ConfirmDialogTexts { title: "Continue?", body: "Review the action", deny_label: "No", allow_label: "Yes" };
let (commands, layout) = draw_confirm_dialog(Rect::new(0.0, 0.0, 800.0, 600.0), texts, ConfirmDialogStyle::default(), &mut text_system);
assert_eq!(commands.len(), 10);
assert_eq!((layout.panel.w, layout.panel.h), (520.0, 220.0));