input: Handle scroll events that only have amount_v120
X11, winit, and libei backends all can produce scroll events with `amount_v120()` but no `amount()`.
This commit is contained in:
parent
18ae082615
commit
861b732671
1 changed files with 8 additions and 2 deletions
|
|
@ -968,7 +968,10 @@ impl State {
|
|||
}
|
||||
} else {
|
||||
let mut frame = AxisFrame::new(event.time_msec()).source(event.source());
|
||||
if let Some(horizontal_amount) = event.amount(Axis::Horizontal) {
|
||||
let horizontal_amount = event
|
||||
.amount(Axis::Horizontal)
|
||||
.or_else(|| Some(event.amount_v120(Axis::Horizontal)? * 15.0 / 120.));
|
||||
if let Some(horizontal_amount) = horizontal_amount {
|
||||
if horizontal_amount != 0.0 {
|
||||
frame = frame
|
||||
.relative_direction(
|
||||
|
|
@ -986,7 +989,10 @@ impl State {
|
|||
frame = frame.stop(Axis::Horizontal);
|
||||
}
|
||||
}
|
||||
if let Some(vertical_amount) = event.amount(Axis::Vertical) {
|
||||
let vertical_amount = event
|
||||
.amount(Axis::Vertical)
|
||||
.or_else(|| Some(event.amount_v120(Axis::Vertical)? * 15.0 / 120.));
|
||||
if let Some(vertical_amount) = vertical_amount {
|
||||
if vertical_amount != 0.0 {
|
||||
frame = frame
|
||||
.relative_direction(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue