Center a popup rectangle within `area` using absolute width and height (in terminal columns/rows).
(width: u16, height: u16, area: Rect)
| 502 | /// Center a popup rectangle within `area` using absolute width and height (in |
| 503 | /// terminal columns/rows). |
| 504 | pub fn centered_rect(width: u16, height: u16, area: Rect) -> Rect { |
| 505 | let vert = Layout::default() |
| 506 | .direction(Direction::Vertical) |
| 507 | .constraints([ |
| 508 | Constraint::Length((area.height.saturating_sub(height)) / 2), |
| 509 | Constraint::Length(height), |
| 510 | Constraint::Min(0), |
| 511 | ]) |
| 512 | .split(area); |
| 513 | let horiz = Layout::default() |
| 514 | .direction(Direction::Horizontal) |
| 515 | .constraints([ |
| 516 | Constraint::Length((area.width.saturating_sub(width)) / 2), |
| 517 | Constraint::Length(width), |
| 518 | Constraint::Min(0), |
| 519 | ]) |
| 520 | .split(vert[1]); |
| 521 | horiz[1] |
| 522 | } |
| 523 | |
| 524 | // --------------------------------------------------------------------------- |
| 525 | // Shared setting-edit overlay (used by both global and sandbox settings panes) |
no outgoing calls
no test coverage detected