Make debug view scrollable
This commit is contained in:
@ -32,3 +32,26 @@ void DebugViewView::updateFieldValues() {
|
||||
el.updateFieldValues();
|
||||
}
|
||||
}
|
||||
|
||||
void DebugViewView::scrollUp() {
|
||||
if (scrollIndex == 0) {
|
||||
updateScrollIndex(list.getNumberOfItems() - 1);
|
||||
} else {
|
||||
updateScrollIndex(scrollIndex - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void DebugViewView::scrollDown() {
|
||||
updateScrollIndex((scrollIndex + 1) % list.getNumberOfItems());
|
||||
}
|
||||
|
||||
void DebugViewView::updateScrollIndex(size_t index) {
|
||||
scrollIndex = index;
|
||||
if (scrollIndex == 0) {
|
||||
// Just animating to 0 looks very broken when scrolling forwards. Animating
|
||||
// to numItems looks good in both directions.
|
||||
list.animateToItem(list.getNumberOfItems(), 2);
|
||||
} else {
|
||||
list.animateToItem(scrollIndex, 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user