BMenu: scroll marked item into view when menu has scrollers attached.

Signed-off-by: Axel Dörfler <[email protected]>
This commit is contained in:
Jessica Hamilton
2013-05-03 21:10:51 +02:00
committed by Axel Dörfler
parent 4e78098e7c
commit 4898c615d6
3 changed files with 26 additions and 0 deletions
+14
View File
@@ -2871,6 +2871,20 @@ BMenu::_UpdateWindowViewSize(const bool &move)
}
window->AttachScrollers();
BMenuItem* selectedItem = FindMarked();
if (selectedItem != NULL && fLayout == B_ITEMS_IN_COLUMN) {
// scroll to the selected item
if (Supermenu() == NULL) {
window->TryScrollTo(selectedItem->Frame().top);
} else {
BPoint point = selectedItem->Frame().LeftTop();
BPoint superpoint = Superitem()->Frame().LeftTop();
Supermenu()->ConvertToScreen(&superpoint);
ConvertToScreen(&point);
window->TryScrollTo(point.y - superpoint.y);
}
}
}
} else {
_CacheFontInfo();