From 624eca2f42460c3ee173d51e67f4cad28a037dd9 Mon Sep 17 00:00:00 2001 From: TnS-hun Date: Sun, 16 Jul 2023 17:49:29 +0200 Subject: [PATCH] emulator: turn pages by mouse wheel --- crates/emulator/src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/emulator/src/main.rs b/crates/emulator/src/main.rs index 6afa982f..19fd2f23 100644 --- a/crates/emulator/src/main.rs +++ b/crates/emulator/src/main.rs @@ -376,6 +376,17 @@ fn main() -> Result<(), Error> { _ => (), } }, + SdlEvent::MouseWheel { mut y, direction, .. } => { + if direction == sdl2::mouse::MouseWheelDirection::Flipped { + y = -y; + } + + if y > 0 { + tx.send(Event::Page(plato_core::geom::CycleDir::Previous)).ok(); + } else if y < 0 { + tx.send(Event::Page(plato_core::geom::CycleDir::Next)).ok(); + } + }, _ => { if let Some(dev_evt) = device_event(sdl_evt) { ty.send(dev_evt).ok();