-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move calc_centered_dialog_rect to widget module
- Loading branch information
1 parent
9b88aa5
commit 6bba16b
Showing
7 changed files
with
33 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod bar; | ||
mod common; | ||
mod copy_detail_dialog; | ||
mod dialog; | ||
mod divider; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use ratatui::layout::{Constraint, Layout, Rect}; | ||
|
||
pub fn calc_centered_dialog_rect(r: Rect, dialog_width: u16, dialog_height: u16) -> Rect { | ||
let vertical_pad = (r.height - dialog_height) / 2; | ||
let vertical_layout = Layout::vertical(Constraint::from_lengths([ | ||
vertical_pad, | ||
dialog_height, | ||
vertical_pad, | ||
])) | ||
.split(r); | ||
|
||
let horizontal_pad = (r.width - dialog_width) / 2; | ||
Layout::horizontal(Constraint::from_lengths([ | ||
horizontal_pad, | ||
dialog_width, | ||
horizontal_pad, | ||
])) | ||
.split(vertical_layout[1])[1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters