From 6d4ab8b00e7483ed9a9d3af0ae4a22bb04a9917a Mon Sep 17 00:00:00 2001 From: Alexandre Deckner Date: Tue, 10 Jun 2008 00:53:16 +0000 Subject: [PATCH] - The bug in Tracker (previous commit) uncovered a bug in BScrollBar's thumb positioning. The + 1.0 was well intented and produced the right effect unless fMax-fMin was too close to 1.0. It could leave a unusable gap on the right (or down) of the thumb. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25897 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/ScrollBar.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 817e080805..69d86d6604 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -1171,9 +1171,12 @@ BScrollBar::_UpdateThumbFrame() thumbSize = floorf(thumbSize + 0.5); thumbSize--; - // the thumb can be scrolled within the remaining area "maxSize - thumbSize" - float offset = floorf(((fValue - fMin) / (fMax - fMin + 1.0)) - * (maxSize - thumbSize)); + // the thumb can be scrolled within the remaining area "maxSize - thumbSize - 1.0" + float offset = 0.0; + if (fMax > fMin) { + offset = floorf(((fValue - fMin) / (fMax - fMin)) + * (maxSize - thumbSize - 1.0)); + } if (_DoubleArrows()) { offset += buttonSize * 2;