mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-15 16:00:38 +08:00
lib: Add spacer border to imUI widgets
This commit is contained in:
@@ -185,6 +185,7 @@ impl Context {
|
||||
|
||||
pub enum Borders {
|
||||
None,
|
||||
Spacer { top: usize, left: usize },
|
||||
All,
|
||||
Top,
|
||||
Sides,
|
||||
@@ -1236,6 +1237,14 @@ pub mod widget {
|
||||
if let Some(border) = borders {
|
||||
match border {
|
||||
Borders::None => area,
|
||||
Borders::Spacer { top, left } => {
|
||||
let areas = Layout::horizontal([Constraint::Fill(1)])
|
||||
.vertical_margin(top as u16)
|
||||
.horizontal_margin(left as u16)
|
||||
.split(area);
|
||||
|
||||
areas[0]
|
||||
}
|
||||
Borders::All => {
|
||||
let block = Block::default()
|
||||
.border_style(style)
|
||||
|
||||
Reference in New Issue
Block a user