[apps/graph] Fix bug in values controller in willDisplayCellAtLocation

Change-Id: Ic3f166caac9d58205a9b896de2a288afe13c66d4
This commit is contained in:
Émilie Feral
2017-04-03 16:47:57 +02:00
parent c893a4611e
commit da4c28bf39
4 changed files with 19 additions and 16 deletions

View File

@@ -109,7 +109,6 @@ Button * ValuesController::buttonAtIndex(int index, ButtonRowController::Positio
}
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
willDisplayCellAtLocationWithDisplayMode(cell, i, j, Expression::FloatDisplayMode::Default);
if (cellAtLocationIsEditable(i, j)) {
return;
@@ -129,9 +128,8 @@ void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, in
}
// The cell is a value cell
EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell;
Function * function = functionAtColumn(i);
float x = m_interval.element(j-1);
Complex::convertFloatToText(function->evaluateAtAbscissa(x, myApp->localContext()), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
Complex::convertFloatToText(evaluationOfAbscissaAtColumn(x, i), buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
myValueCell->setText(buffer);
}
}
@@ -277,5 +275,11 @@ int ValuesController::maxNumberOfElements() const {
return Interval::k_maxNumberOfElements;
}
float ValuesController::evaluationOfAbscissaAtColumn(float abscissa, int columnIndex) {
Function * function = functionAtColumn(columnIndex);
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
return function->evaluateAtAbscissa(abscissa, myApp->localContext());
}
}