From c77659c99554e01dcef7f066c31db9b6b53e0efe Mon Sep 17 00:00:00 2001 From: peter1138 <peter1138@openttd.org> Date: Sun, 28 Apr 2019 01:24:58 +0100 Subject: [PATCH] Fix: Clicking on scrollbar 'thumb' moved position up instantly. (#7549) --- src/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.cpp b/src/window.cpp index faae96187c..52f6d4785c 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);