feat: rudimentary keyboard scrolling
I want smooth scrolling :(
This commit is contained in:
parent
4a292a5834
commit
5f85338c72
1 changed files with 26 additions and 0 deletions
|
|
@ -142,6 +142,31 @@ impl State {
|
|||
);
|
||||
}
|
||||
|
||||
keyboard::Key::Character("j")
|
||||
| keyboard::Key::Named(
|
||||
keyboard::key::Named::ArrowDown | keyboard::key::Named::PageDown,
|
||||
) => {
|
||||
return widget::operation::scroll_by(
|
||||
"main",
|
||||
widget::operation::AbsoluteOffset {
|
||||
x: 0.,
|
||||
y: if modifiers.shift() { 100. } else { 30. },
|
||||
},
|
||||
);
|
||||
}
|
||||
keyboard::Key::Character("k")
|
||||
| keyboard::Key::Named(
|
||||
keyboard::key::Named::ArrowUp | keyboard::key::Named::PageUp,
|
||||
) => {
|
||||
return widget::operation::scroll_by(
|
||||
"main",
|
||||
widget::operation::AbsoluteOffset {
|
||||
x: 0.,
|
||||
y: if modifiers.shift() { -100. } else { -30. },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
keyboard::Key::Character("=" | "+") => {
|
||||
self.columns = (self.columns + 1).clamp(1, 10)
|
||||
}
|
||||
|
|
@ -190,6 +215,7 @@ impl State {
|
|||
}))
|
||||
.columns(self.columns),
|
||||
)
|
||||
.id("main")
|
||||
.height(Length::Fill)
|
||||
.into(),
|
||||
self.error.as_ref().map_or_else(
|
||||
|
|
|
|||
Loading…
Reference in a new issue