pub fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
  let popup_layout = Layout::default()
    .direction(Direction::Vertical)
    .constraints(
      [
        Constraint::Percentage((100 - percent_y) / 2),
        Constraint::Percentage(percent_y),
        Constraint::Percentage((100 - percent_y) / 2),
      ]
      .as_ref(),
    )
    .split(r);

  Layout::default()
    .direction(Direction::Horizontal)
    .constraints(
      [
        Constraint::Percentage((100 - percent_x) / 2),
        Constraint::Percentage(percent_x),
        Constraint::Percentage((100 - percent_x) / 2),
      ]
      .as_ref(),
    )
    .split(popup_layout[1])[1]
}
/// helper function to create a centered rect using up
/// certain percentage of the available rect `r`
helper function to create a centered rect using up
certain percentage of the available rect `r`
helper function to create a centered rect using up certain percentage of the available rect ` r `
pub fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
  let popup_layout = Layout::default()
    .direction(Direction::Vertical)
    .constraints(
      [
        Constraint::Percentage((100 - percent_y) / 2),
        Constraint::Percentage(percent_y),
        Constraint::Percentage((100 - percent_y) / 2),
      ]
      .as_ref(),
    )
    .split(r);
  Layout::default()
    .direction(Direction::Horizontal)
    .constraints(
      [
        Constraint::Percentage((100 - percent_x) / 2),
        Constraint::Percentage(percent_x),
        Constraint::Percentage((100 - percent_x) / 2),
      ]
      .as_ref(),
    )
    .split(popup_layout[1])[1]
}
pub fn centered_rect ( percent_x : u16 , percent_y : u16 , r : Rect ) -> Rect { let popup_layout = Layout :: default ( ) . direction ( Direction :: Vertical ) . constraints ( [ Constraint :: Percentage ( ( 100 - percent_y ) / 2 ) , Constraint :: Percentage ( percent_y ) , Constraint :: Percentage ( ( 100 - percent_y ) / 2 ) , ] . as_ref ( ) , ) . split ( r ) ; Layout :: default ( ) . direction ( Direction :: Horizontal ) . constraints ( [ Constraint :: Percentage ( ( 100 - percent_x ) / 2 ) , Constraint :: Percentage ( percent_x ) , Constraint :: Percentage ( ( 100 - percent_x ) / 2 ) , ] . as_ref ( ) , ) . split ( popup_layout [ 1 ] ) [ 1 ] }
helper function to create a centered rect using up
certain percentage of the available rect `r`
helper function to create a centered rect using up certain percentage of the available rect ` r `
percent_x
u16
percent_y
u16
r
Rect
percent_x
u16
percent_y
u16
r
Rect