hrev54436 adds 1 changeset to branch 'master'
old head: 06b2ce5412620f42c1598685064f5daa3ae251e5
new head: 77912444b88aa0960fa82c4e7bb144455ac8d660
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=77912444b88a+%5E06b2ce541262
----------------------------------------------------------------------------
77912444b88a: Tracker: fix ScrollIntoView
Same problem as in BListView::ScrollToSelection.
Change-Id: I1cd26190566b1808f47475c1499298b66549f024
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2312
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ X512 <danger_mail@xxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54436
Commit: 77912444b88aa0960fa82c4e7bb144455ac8d660
URL: https://git.haiku-os.org/haiku/commit/?id=77912444b88a
Author: X512 <danger_mail@xxxxxxx>
Date: Thu Mar 5 16:32:02 2020 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Sat Jul 18 13:58:28 2020 UTC
----------------------------------------------------------------------------
1 file changed, 17 insertions(+), 7 deletions(-)
src/kits/tracker/PoseView.cpp | 24 +++++++++++++++++-------
----------------------------------------------------------------------------
diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index b7e1eac4f4..38264fb24c 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -4047,15 +4047,25 @@ BPoseView::ScrollIntoView(BRect poseRect)
if (IsDesktopWindow())
return;
- if (ViewMode() == kListMode) {
- // if we're in list view then we only care that the entire
- // pose is visible vertically, not horizontally
- poseRect.left = 0;
- poseRect.right = poseRect.left + 1;
+ BPoint oldPos = Bounds().LeftTop(), newPos = oldPos;
+
+ // In list mode, only scroll vertically
+ if (ViewMode() != kListMode) {
+ if (poseRect.left < Bounds().left
+ || poseRect.Width() > Bounds().Width())
+ newPos.x += poseRect.left - Bounds().left;
+ else if (poseRect.right > Bounds().right)
+ newPos.x += poseRect.right - Bounds().right;
}
- if (!Bounds().Contains(poseRect))
- SetScrollBarsTo(poseRect.LeftTop());
+ if (poseRect.top < Bounds().top
+ || poseRect.Height() > Bounds().Height())
+ newPos.y += poseRect.top - Bounds().top;
+ else if (poseRect.bottom > Bounds().bottom)
+ newPos.y += poseRect.bottom - Bounds().bottom;
+
+ if (newPos != oldPos)
+ SetScrollBarsTo(newPos);
}