From 17a8a6f74b994ed9a3ed18bdedf745018bbfd453 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 27 Jun 2009 16:39:42 +0000 Subject: [PATCH] Made ScrollTo(BRow*) more useful. Now it only scrolls, if the row isn't fully visible and it only scrolls as much as necessary. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31268 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/ColumnListView.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/ColumnListView.cpp b/src/kits/interface/ColumnListView.cpp index 0e214cd897..18ab555468 100644 --- a/src/kits/interface/ColumnListView.cpp +++ b/src/kits/interface/ColumnListView.cpp @@ -4428,8 +4428,13 @@ void OutlineView::ScrollTo(const BRow* row) { BRect rect; - if (FindRect(row, &rect)) - ScrollTo(BPoint(rect.left, rect.top)); + if (FindRect(row, &rect)) { + BRect bounds = Bounds(); + if (rect.top < bounds.top) + ScrollTo(BPoint(bounds.left, rect.top)); + else if (rect.bottom > bounds.bottom) + ScrollBy(0, rect.bottom - bounds.bottom); + } }