MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / centered

Function centered

crates/opencode-tui/src/ui/layout.rs:19–37  ·  view source on GitHub ↗
(area: Rect, width: u16, height: u16)

Source from the content-addressed store, hash-verified

17}
18
19pub fn centered(area: Rect, width: u16, height: u16) -> Rect {
20 let popup_layout = Layout::default()
21 .direction(Direction::Vertical)
22 .constraints([
23 Constraint::Percentage((100 - height as u16) / 2),
24 Constraint::Length(height),
25 Constraint::Percentage((100 - height as u16) / 2),
26 ])
27 .split(area);
28
29 Layout::default()
30 .direction(Direction::Horizontal)
31 .constraints([
32 Constraint::Percentage((100 - width as u16) / 2),
33 Constraint::Length(width),
34 Constraint::Percentage((100 - width as u16) / 2),
35 ])
36 .split(popup_layout[1])[1]
37}
38
39pub fn footer(area: Rect, height: u16) -> Rect {
40 let layout = Layout::default()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected