From ad700830ce60bf11b5f37218d50d44ac849abc5f Mon Sep 17 00:00:00 2001 From: Timon Date: Mon, 12 Jun 2023 20:01:08 +0200 Subject: [PATCH] Add scroll_right and scroll_left functions --- src/structs/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/structs/input.rs b/src/structs/input.rs index 6e9e98f..9b64627 100644 --- a/src/structs/input.rs +++ b/src/structs/input.rs @@ -164,6 +164,16 @@ impl ButtonState { self.state > 0 } + /// Returns whether there is a horizontal scroll to the right. + pub fn scroll_right(&self) -> bool { + self.state > 0 + } + + /// Returns whether there is a horizontal scroll to the left. + pub fn scroll_left(&self) -> bool { + self.state < 0 + } + /// Returns the raw state. pub fn state(&self) -> i32 { self.state