/// Help function to create a centered rectangle with absolute dimensions
Help function to create a centered rectangle with absolute dimensions
Help function to create a centered rectangle with absolute dimensions
pub fn centered_rect_absolute(width: u16, height: u16, r: Rect) -> Rect {
    let vertical_pad = r.height.saturating_sub(height) / 2;
    let popup_layout = Layout::default()
        .direction(Direction::Vertical)
        .constraints(
            [
                Constraint::Length(vertical_pad),
                Constraint::Length(height.min(r.height)),
                Constraint::Min(1),
            ]
            .as_ref(),
        )
        .split(r);
    let horizontal_pad = r.width.saturating_sub(width) / 2;
    Layout::default()
        .direction(Direction::Horizontal)
        .constraints(
            [
                Constraint::Length(horizontal_pad),
                Constraint::Length(width.min(r.width)),
                Constraint::Min(1),
            ]
            .as_ref(),
        )
        .split(popup_layout[1])[1]
}
pub fn centered_rect_absolute ( width : u16 , height : u16 , r : Rect ) -> Rect { let vertical_pad = r . height . saturating_sub ( height ) / 2 ; let popup_layout = Layout :: default ( ) . direction ( Direction :: Vertical ) . constraints ( [ Constraint :: Length ( vertical_pad ) , Constraint :: Length ( height . min ( r . height ) ) , Constraint :: Min ( 1 ) , ] . as_ref ( ) , ) . split ( r ) ; let horizontal_pad = r . width . saturating_sub ( width ) / 2 ; Layout :: default ( ) . direction ( Direction :: Horizontal ) . constraints ( [ Constraint :: Length ( horizontal_pad ) , Constraint :: Length ( width . min ( r . width ) ) , Constraint :: Min ( 1 ) , ] . as_ref ( ) , ) . split ( popup_layout [ 1 ] ) [ 1 ] }
Help function to create a centered rectangle with absolute dimensions
Help function to create a centered rectangle with absolute dimensions
width
u16
height
u16
r
Rect