diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-02 12:52:04 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-05-02 12:52:10 +0200 |
commit | 0c9bcb2da29021a2eb6ff461e802dbcceccaa7c0 (patch) | |
tree | 988725832bf9abeb259433645ab473eb9cb23c1f /src | |
parent | a3f6eafbae51bb98220a05bb5b63d551268c05a1 (diff) |
Limit scroll speed. Was too high on laptop
Diffstat (limited to 'src')
-rw-r--r-- | src/MessageBoard.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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) |