mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] When EditExpressionController becomes the first
responder, scroll to the bottom of the table (and not the last cell). Indeed, the last cell might be to big to be displayed and scroll to it might scroll to its top. This fixes the following bug: input 1/2/3/4/5/6/7/8, OK, up, down. We did not scroll to the bottom of the table.
This commit is contained in:
@@ -12,6 +12,12 @@ CalculationSelectableTableView::CalculationSelectableTableView(Responder * paren
|
||||
setDecoratorType(ScrollView::Decorator::Type::None);
|
||||
}
|
||||
|
||||
void CalculationSelectableTableView::scrollToBottom() {
|
||||
KDCoordinate contentOffsetX = contentOffset().x();
|
||||
KDCoordinate contentOffsetY = dataSource()->cumulatedHeightFromIndex(dataSource()->numberOfRows()) - maxContentHeightDisplayableWithoutScrolling();
|
||||
setContentOffset(KDPoint(contentOffsetX, contentOffsetY));
|
||||
}
|
||||
|
||||
void CalculationSelectableTableView::scrollToCell(int i, int j) {
|
||||
if (m_contentView.bounds().height() < bounds().height()) {
|
||||
setTopMargin(bounds().height() - m_contentView.bounds().height());
|
||||
@@ -21,9 +27,8 @@ void CalculationSelectableTableView::scrollToCell(int i, int j) {
|
||||
::SelectableTableView::scrollToCell(i, j);
|
||||
ScrollView::layoutSubviews();
|
||||
if (m_contentView.bounds().height() - contentOffset().y() < bounds().height()) {
|
||||
KDCoordinate contentOffsetX = contentOffset().x();
|
||||
KDCoordinate contentOffsetY = dataSource()->cumulatedHeightFromIndex(dataSource()->numberOfRows()) - maxContentHeightDisplayableWithoutScrolling();
|
||||
setContentOffset(KDPoint(contentOffsetX, contentOffsetY));
|
||||
// Avoid empty space at the end of the table
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user