Fix scrollbar handling when removing rows in BCLV.
- If removing a row results in there no longer being any rows whatsoever visible, force a scroll back into the visible range. Fixes #8287.
This commit is contained in:
parent
af2f75a016
commit
ed15f1b8fb
@ -4090,6 +4090,16 @@ OutlineView::RemoveRow(BRow* row)
|
|||||||
fItemsHeight -= subTreeHeight;
|
fItemsHeight -= subTreeHeight;
|
||||||
|
|
||||||
FixScrollBar(false);
|
FixScrollBar(false);
|
||||||
|
int32 indent = 0;
|
||||||
|
float top = 0.0;
|
||||||
|
if (FindRow(fVisibleRect.top, &indent, &top) == NULL && ScrollBar(B_VERTICAL) != NULL) {
|
||||||
|
// after removing this row, no rows are actually visible any more,
|
||||||
|
// force a scroll to make them visible again
|
||||||
|
if (fItemsHeight > fVisibleRect.Height())
|
||||||
|
ScrollBy(0.0, fItemsHeight - fVisibleRect.Height() - Bounds().top);
|
||||||
|
else
|
||||||
|
ScrollBy(0.0, -Bounds().top);
|
||||||
|
}
|
||||||
if (parentRow != NULL) {
|
if (parentRow != NULL) {
|
||||||
parentRow->fChildList->RemoveItem(row);
|
parentRow->fChildList->RemoveItem(row);
|
||||||
if (parentRow->fChildList->CountItems() == 0) {
|
if (parentRow->fChildList->CountItems() == 0) {
|
||||||
@ -4294,7 +4304,7 @@ OutlineView::FixScrollBar(bool scrollToFit)
|
|||||||
float maxScrollBarValue = fItemsHeight - fVisibleRect.Height();
|
float maxScrollBarValue = fItemsHeight - fVisibleRect.Height();
|
||||||
vScrollBar->SetProportion(fVisibleRect.Height() / fItemsHeight);
|
vScrollBar->SetProportion(fVisibleRect.Height() / fItemsHeight);
|
||||||
|
|
||||||
// If the user is scrolled down too far when makes the range smaller, the list
|
// If the user is scrolled down too far when making the range smaller, the list
|
||||||
// will jump suddenly, which is undesirable. In this case, don't fix the scroll
|
// will jump suddenly, which is undesirable. In this case, don't fix the scroll
|
||||||
// bar here. In ScrollTo, it checks to see if this has occured, and will
|
// bar here. In ScrollTo, it checks to see if this has occured, and will
|
||||||
// fix the scroll bars sneakily if the user has scrolled up far enough.
|
// fix the scroll bars sneakily if the user has scrolled up far enough.
|
||||||
|
Loading…
Reference in New Issue
Block a user