mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] ValuesController: reload memoized cell when abscissa is
edited
This commit is contained in:
committed by
LeaNumworks
parent
60ad096956
commit
f995fb0fc2
@@ -224,6 +224,23 @@ double ValuesController::dataAtLocation(int columnIndex, int rowIndex) {
|
||||
return intervalAtColumn(columnIndex)->element(rowIndex-1);
|
||||
}
|
||||
|
||||
void ValuesController::didChangeRow(int row) {
|
||||
/* Update the row memoization if it exists */
|
||||
// Conversion of coordinates from absolute table to values table
|
||||
int valuesRow = valuesRowForAbsoluteRow(row);
|
||||
if (m_firstMemoizedRow > valuesRow || valuesRow >= m_firstMemoizedRow + k_maxNumberOfRows) {
|
||||
// The changed row is out of the memoized table
|
||||
return;
|
||||
}
|
||||
|
||||
int memoizedRow = valuesRow - m_firstMemoizedRow;
|
||||
int maxI = numberOfValuesColumns() - m_firstMemoizedColumn;
|
||||
int nbOfMemoizedColumns = numberOfMemoizedColumn();
|
||||
for (int i = 0; i < minInt(nbOfMemoizedColumns, maxI); i++) {
|
||||
fillMemoizedBuffer(absoluteColumnForValuesColumn(m_firstMemoizedColumn + i), row, nbOfMemoizedColumns*memoizedRow+i);
|
||||
}
|
||||
}
|
||||
|
||||
int ValuesController::numberOfElementsInColumn(int columnIndex) const {
|
||||
return const_cast<ValuesController *>(this)->intervalAtColumn(columnIndex)->numberOfElements();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user