diff options
Diffstat (limited to 'src/canvas.rs')
-rw-r--r-- | src/canvas.rs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/canvas.rs b/src/canvas.rs index e276e097..5bb8a438 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -43,6 +43,7 @@ pub struct DisplayableData { pub temp_sensor_data: Vec<Vec<String>>, pub single_process_data: Vec<ConvertedProcessData>, // Contains single process data pub finalized_process_data_map: HashMap<u64, Vec<ConvertedProcessData>>, // What's actually displayed + pub stringified_process_data_map: HashMap<u64, Vec<(Vec<(String, Option<String>)>, bool)>>, // Represents the row and whether it is disabled pub mem_label_percent: String, pub swap_label_percent: String, pub mem_label_frac: String, @@ -67,7 +68,6 @@ pub struct Painter { widget_layout: BottomLayout, derived_widget_draw_locs: Vec<Vec<Vec<Vec<Rect>>>>, table_height_offset: u16, - requires_boundary_recalculation: bool, } impl Painter { @@ -152,7 +152,6 @@ impl Painter { widget_layout, derived_widget_draw_locs: Vec::default(), table_height_offset: if is_basic_mode { 2 } else { 4 } + table_gap, - requires_boundary_recalculation: true, } } @@ -401,25 +400,18 @@ impl Painter { // Basic mode. This basically removes all graphs but otherwise // the same info. - let cpu_height = (app_state.canvas_data.cpu_data.len() / 4) as u16 - + (if app_state.canvas_data.cpu_data.len() % 4 == 0 { - 0 - } else { - 1 - }); - - // A little hack to force the widget boundary recalculation. This is required here - // as basic mode has a height of 0 initially, which breaks things. - if self.requires_boundary_recalculation { - app_state.is_determining_widget_boundary = true; - } - self.requires_boundary_recalculation = cpu_height == 0; - let vertical_chunks = Layout::default() .direction(Direction::Vertical) .constraints( [ - Constraint::Length(cpu_height), + Constraint::Length( + (app_state.canvas_data.cpu_data.len() / 4) as u16 + + (if app_state.canvas_data.cpu_data.len() % 4 == 0 { + 0 + } else { + 1 + }), + ), Constraint::Length(1), Constraint::Length(2), Constraint::Length(2), @@ -486,7 +478,7 @@ impl Painter { self.draw_basic_table_arrows(&mut f, app_state, vertical_chunks[3], widget_id); } } else { - // Draws using the passed in (or default) layout. NOT basic so far. + // Draws using the passed in (or default) layout. if self.derived_widget_draw_locs.is_empty() || app_state.is_force_redraw { let row_draw_locs = Layout::default() .margin(0) |