Reverse scroll direction on winit

This commit is contained in:
Ottatop 2023-09-10 05:02:29 -05:00
parent aaf2921363
commit 7f5d9e431c
2 changed files with 13 additions and 1 deletions

View file

@ -423,10 +423,14 @@ impl State {
.amount(Axis::Horizontal)
.unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap_or(0.0) * 3.0);
let vertical_amount = event
let mut vertical_amount = event
.amount(Axis::Vertical)
.unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap_or(0.0) * 3.0);
if self.backend.is_winit() {
vertical_amount = -vertical_amount;
}
let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal);
let vertical_amount_discrete = event.amount_discrete(Axis::Vertical);

View file

@ -87,6 +87,14 @@ impl Backend {
Backend::Udev(udev) => udev.early_import(surface),
}
}
/// Returns `true` if the backend is [`Winit`].
///
/// [`Winit`]: Backend::Winit
#[must_use]
pub fn is_winit(&self) -> bool {
matches!(self, Self::Winit(..))
}
}
/// The main state of the application.