Implement Scroll action in text::editor

This commit is contained in:
Héctor Ramón Jiménez 2023-09-19 01:18:06 +02:00
parent 36e867de69
commit 4e757a26d0
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 19 additions and 0 deletions

View file

@ -521,6 +521,18 @@ impl Update {
}
_ => None,
},
mouse::Event::WheelScrolled { delta } => {
action(Action::Scroll {
lines: match delta {
mouse::ScrollDelta::Lines { y, .. } => {
-y as i32 * 4
}
mouse::ScrollDelta::Pixels { y, .. } => {
-y.signum() as i32
}
},
})
}
_ => None,
},
Event::Keyboard(event) => match event {