From 0c9bcb2da29021a2eb6ff461e802dbcceccaa7c0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 2 May 2018 12:52:04 +0200 Subject: Limit scroll speed. Was too high on laptop --- src/MessageBoard.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/MessageBoard.cpp b/src/MessageBoard.cpp index 9dbeb71..1c8c4ad 100644 --- a/src/MessageBoard.cpp +++ b/src/MessageBoard.cpp @@ -32,6 +32,7 @@ namespace dchat const float LINE_SIDE_PADDING = 20.0f; const float LINE_HEIGHT = 1.0f; const float USERNAME_TIMESTAMP_SIDE_PADDING = 10.0f; + const double SCROLL_MAX_SPEED = 20.0; const LineColor LINE_COLOR { @@ -121,6 +122,10 @@ namespace dchat else if(event.type == sf::Event::MouseWheelScrolled && event.mouseWheelScroll.wheel == sf::Mouse::Wheel::VerticalWheel) { scrollSpeed += (event.mouseWheelScroll.delta * 5.0); + if(scrollSpeed > SCROLL_MAX_SPEED) + scrollSpeed = SCROLL_MAX_SPEED; + else if(scrollSpeed < -SCROLL_MAX_SPEED) + scrollSpeed = -SCROLL_MAX_SPEED; } if(selectingText && !leftMouseButtonPressed) -- cgit v1.2.3