feat: mouse hori scrolls

This commit is contained in:
JEEVITHA KANNAN K S 2024-11-04 12:36:14 +05:30
parent a6e948f1c9
commit 654cd615cf
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
2 changed files with 10 additions and 2 deletions

View File

@ -268,6 +268,8 @@ impl FloatContent for FloatingText {
match event.kind { match event.kind {
MouseEventKind::ScrollDown => self.scroll_down(), MouseEventKind::ScrollDown => self.scroll_down(),
MouseEventKind::ScrollUp => self.scroll_up(), MouseEventKind::ScrollUp => self.scroll_up(),
MouseEventKind::ScrollLeft => self.scroll_left(),
MouseEventKind::ScrollRight => self.scroll_right(),
_ => {} _ => {}
} }
false false

View File

@ -424,18 +424,24 @@ impl AppState {
match &mut self.focus { match &mut self.focus {
Focus::TabList => match event.kind { Focus::TabList => match event.kind {
MouseEventKind::ScrollDown => { MouseEventKind::ScrollDown => {
if self.current_tab.selected().unwrap() != self.tabs.len() - 1 {
self.current_tab.select_next(); self.current_tab.select_next();
}
self.refresh_tab(); self.refresh_tab();
} }
MouseEventKind::ScrollUp => { MouseEventKind::ScrollUp => {
self.current_tab.select_next(); if self.current_tab.selected().unwrap() != 0 {
self.current_tab.select_previous();
}
self.refresh_tab(); self.refresh_tab();
} }
MouseEventKind::ScrollRight => self.focus = Focus::List,
_ => {} _ => {}
}, },
Focus::List => match event.kind { Focus::List => match event.kind {
MouseEventKind::ScrollDown => self.selection.select_next(), MouseEventKind::ScrollDown => self.selection.select_next(),
MouseEventKind::ScrollUp => self.selection.select_previous(), MouseEventKind::ScrollUp => self.selection.select_previous(),
MouseEventKind::ScrollLeft => self.focus = Focus::TabList,
_ => {} _ => {}
}, },
Focus::FloatingWindow(float) => { Focus::FloatingWindow(float) => {