From fd2a5629f1194a8f9d5d7c278278f088cfd7a60b Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 27 Dec 2023 13:00:55 -0500 Subject: [PATCH] BListView: Contain scroll within scroll area horizontally ... but extending vertically above and below the list view. https://www.haiku-os.org/legacy-docs/bebook/BListView_Overview.html "BListView provides an autoscroll feature: There's an invisible area about 25 pixels high both above and below the list view; if the user clicks inside the list view and then drags into this autoscroll area, the contents of the list will scroll in the direction of the mouse." Instead of 25px scroll vertically without limit because scrolling speeds up as you move the mouse cursor further away. Change-Id: I52296beb2b0173fc5c909255163e8725e99c2b6c Reviewed-on: https://review.haiku-os.org/c/haiku/+/7244 Reviewed-by: waddlesplash Tested-by: Commit checker robot --- src/kits/interface/ListView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 0ec45f0957..ab79b46991 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -742,6 +742,10 @@ BListView::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) if (buttons == 0 || index == -1) return BView::MouseMoved(where, code, dragMessage); + // don't scroll if mouse is left or right of the view + if (where.x < Bounds().left || where.x > Bounds().right) + return BView::MouseMoved(where, code, dragMessage); + // scroll to item under mouse while button is pressed ScrollTo(index);