Fixing scrollbar view content
This commit is contained in:
parent
000e31a14f
commit
60e4fa3b9d
2 changed files with 14 additions and 10 deletions
|
|
@ -18,10 +18,10 @@ const MAX_NAME_LENGTH: usize = 30;
|
|||
|
||||
pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut DashboardViewState) {
|
||||
let available_height = area.height as usize;
|
||||
let total_lenght = state.get_total_lenght();
|
||||
let max_scroll = state.get_total_lenght().saturating_sub(available_height);
|
||||
|
||||
if (state.scroll_state.get_position() + available_height) > total_lenght {
|
||||
state.scroll_state = state.scroll_state.position(total_lenght - available_height);
|
||||
if state.scroll_state.get_position() > max_scroll {
|
||||
state.scroll_state = state.scroll_state.position(max_scroll);
|
||||
}
|
||||
|
||||
let scroll_pos = state.scroll_state.get_position();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue