summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-04-28 01:24:58 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-05-02 22:16:26 +0100
commit82989ef076a5e375954bcec65a81ea4fc902ebb3 (patch)
tree273e4aa328c3935adf610f77e9bb106b272c6974
parent8fc2b48db70b89e57d055e4686e49b583574d927 (diff)
downloadopenttd-82989ef076a5e375954bcec65a81ea4fc902ebb3.tar.xz
Fix: Clicking on scrollbar 'thumb' moved position up instantly.
-rw-r--r--src/window.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 1b73aadf3..9786459db 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2414,7 +2414,7 @@ static void HandleScrollbarScrolling(Window *w)
}
/* Find the item we want to move to and make sure it's inside bounds. */
- int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity()));
+ int pos = min(RoundDivSU(max(0, i + _scrollbar_start_pos) * sb->GetCount(), _scrollbar_size), max(0, sb->GetCount() - sb->GetCapacity()));
if (rtl) pos = max(0, sb->GetCount() - sb->GetCapacity() - pos);
if (pos != sb->GetPosition()) {
sb->SetPosition(pos);