* fixed ScrollView framework to support data rects with negative left/top

coordinate correctly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2007-06-21 22:14:44 +00:00
parent cf76d671df
commit b69827d9b5
2 changed files with 4 additions and 4 deletions
@@ -662,11 +662,11 @@ ScrollView::_UpdateScrollBars()
float hProportion = min(1.0f, (visibleBounds.Width() + 1.0f) / float hProportion = min(1.0f, (visibleBounds.Width() + 1.0f) /
(dataRect.Width() + 1.0f)); (dataRect.Width() + 1.0f));
float hMaxValue = max(dataRect.left, float hMaxValue = max(dataRect.left,
dataRect.Width() - visibleBounds.Width()); dataRect.right - visibleBounds.Width());
float vProportion = min(1.0f, (visibleBounds.Height() + 1.0f) / float vProportion = min(1.0f, (visibleBounds.Height() + 1.0f) /
(dataRect.Height() + 1.0f)); (dataRect.Height() + 1.0f));
float vMaxValue = max(dataRect.top, float vMaxValue = max(dataRect.top,
dataRect.Height() - visibleBounds.Height()); dataRect.bottom - visibleBounds.Height());
// update horizontal scroll bar // update horizontal scroll bar
if (fHScrollBar) { if (fHScrollBar) {
fHScrollBar->SetProportion(hProportion); fHScrollBar->SetProportion(hProportion);
@@ -211,8 +211,8 @@ Scrollable::ScrollSourceChanged(Scroller* /*oldSource*/,
BPoint BPoint
Scrollable::_ValidScrollOffsetFor(BPoint offset) const Scrollable::_ValidScrollOffsetFor(BPoint offset) const
{ {
float maxX = max(fDataRect.left, fDataRect.Width() - fVisibleWidth); float maxX = max(fDataRect.left, fDataRect.right - fVisibleWidth);
float maxY = max(fDataRect.top, fDataRect.Height() - fVisibleHeight); float maxY = max(fDataRect.top, fDataRect.bottom - fVisibleHeight);
// adjust the offset to be valid // adjust the offset to be valid
if (offset.x < fDataRect.left) if (offset.x < fDataRect.left)
offset.x = fDataRect.left; offset.x = fDataRect.left;