rendering

This commit is contained in:
Kent Overstreet 2026-04-05 23:04:10 -04:00
parent 36d698a3e1
commit 49cd6d6ab6
8 changed files with 178 additions and 157 deletions

View file

@ -26,9 +26,11 @@ impl ScreenView for ThalamusScreen {
fn label(&self) -> &'static str { "thalamus" }
fn tick(&mut self, frame: &mut Frame, area: Rect,
key: Option<KeyEvent>, app: &mut App) -> Option<ScreenAction> {
events: &[ratatui::crossterm::event::Event], app: &mut App) {
// Handle keys
if let Some(key) = key {
for event in events {
if let ratatui::crossterm::event::Event::Key(key) = event {
if key.kind != ratatui::crossterm::event::KeyEventKind::Press { continue; }
match key.code {
KeyCode::Up => { self.sampling_selected = self.sampling_selected.saturating_sub(1); }
KeyCode::Down => { self.sampling_selected = (self.sampling_selected + 1).min(2); }
@ -36,17 +38,15 @@ impl ScreenView for ThalamusScreen {
let delta = match self.sampling_selected {
0 => 0.05, 1 => 0.05, 2 => 5.0, _ => 0.0,
};
return Some(ScreenAction::Hotkey(HotkeyAction::AdjustSampling(self.sampling_selected, delta)));
}
KeyCode::Left => {
let delta = match self.sampling_selected {
0 => -0.05, 1 => -0.05, 2 => -5.0, _ => 0.0,
};
return Some(ScreenAction::Hotkey(HotkeyAction::AdjustSampling(self.sampling_selected, delta)));
}
KeyCode::Esc => return Some(ScreenAction::Switch(0)),
_ => {}
}
}
}
// Draw
@ -131,6 +131,5 @@ impl ScreenView for ThalamusScreen {
.scroll((self.scroll, 0));
frame.render_widget(para, area);
None
}
}