1
0
Fork 0
mirror of https://github.com/alemidev/scope-tui.git synced 2024-11-23 14:14:48 +01:00

fix: constraints use relative percentages

This commit is contained in:
əlemi 2023-01-02 01:33:28 +01:00
parent e56052c789
commit df273dd011
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -262,15 +262,15 @@ pub fn run_app<T : Backend>(args: Args, terminal: &mut Terminal<T>) -> Result<()
Cell::from(format!("TUI {}", if app.cfg.vectorscope { "Vectorscope" } else { "Oscilloscope" })).style(Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)), Cell::from(format!("TUI {}", if app.cfg.vectorscope { "Vectorscope" } else { "Oscilloscope" })).style(Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)),
Cell::from(format!("{}{} mode", if app.cfg.triggering { "triggered " } else { "" }, if app.scatter() { "scatter" } else { "line" })), Cell::from(format!("{}{} mode", if app.cfg.triggering { "triggered " } else { "" }, if app.scatter() { "scatter" } else { "line" })),
Cell::from(format!("range +-{}", app.cfg.scale)), Cell::from(format!("range +-{}", app.cfg.scale)),
Cell::from(format!("{} smpl", samples as u32)), Cell::from(format!("{}smpl", samples as u32)),
Cell::from(format!("{:.1} kHz", args.sample_rate as f32 / 1000.0)), Cell::from(format!("{:.1}kHz", args.sample_rate as f32 / 1000.0)),
Cell::from(format!("{} fps", framerate)), Cell::from(format!("{}fps", framerate)),
] ]
) )
] ]
) )
.style(Style::default().fg(Color::Cyan)) .style(Style::default().fg(Color::Cyan))
.widths(&[Constraint::Length(50), Constraint::Length(25), Constraint::Length(15), Constraint::Length(10), Constraint::Length(10), Constraint::Length(10)]); .widths(&[Constraint::Percentage(40), Constraint::Percentage(20), Constraint::Percentage(20), Constraint::Percentage(7), Constraint::Percentage(7), Constraint::Percentage(6)]);
f.render_widget(heading, Rect { x: size.x, y: size.y, width: size.width, height:1 }); f.render_widget(heading, Rect { x: size.x, y: size.y, width: size.width, height:1 });
size.height -= 1; size.height -= 1;
size.y += 1; size.y += 1;