mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
cleanup
This commit is contained in:
parent
603fd75703
commit
6df98ada7f
3 changed files with 5 additions and 4 deletions
|
|
@ -53,7 +53,7 @@ impl DrawableComponent for SelectBranchComponent {
|
|||
f.size(),
|
||||
);
|
||||
let area =
|
||||
ui::rect_inside(&MIN_SIZE, &f.size().into(), area);
|
||||
ui::rect_inside(MIN_SIZE, f.size().into(), area);
|
||||
let area = area.intersection(rect);
|
||||
|
||||
let scroll_threshold = area.height / 3;
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ impl DrawableComponent for TextInputComponent {
|
|||
InputType::Multiline => {
|
||||
let area = ui::centered_rect(60, 20, f.size());
|
||||
ui::rect_inside(
|
||||
&Size::new(10, 3),
|
||||
&f.size().into(),
|
||||
Size::new(10, 3),
|
||||
f.size().into(),
|
||||
area,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ pub const fn calc_scroll_top(
|
|||
}
|
||||
|
||||
/// ui component size representation
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Size {
|
||||
pub width: u16,
|
||||
pub height: u16,
|
||||
|
|
@ -72,7 +73,7 @@ pub fn centered_rect(
|
|||
}
|
||||
|
||||
/// makes sure Rect `r` at least stays as big as min and not bigger than max
|
||||
pub fn rect_inside(min: &Size, max: &Size, r: Rect) -> Rect {
|
||||
pub fn rect_inside(min: Size, max: Size, r: Rect) -> Rect {
|
||||
let new_width = r.width.max(min.width).min(max.width);
|
||||
let new_height = r.height.max(min.height).min(max.height);
|
||||
let diff_width = new_width.saturating_sub(r.width);
|
||||
|
|
|
|||
Loading…
Reference in a new issue