mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/probability] Forbid impossible value in parameters and calculation
parameters Change-Id: I47aae775dc031d5b78d6995ca63f49d537848cb1
This commit is contained in:
committed by
Romain Goyet
parent
f636974c0f
commit
9b2bc019e4
@@ -203,6 +203,14 @@ bool CalculationController::textFieldDidFinishEditing(TextField * textField, con
|
||||
App * probaApp = (App *)app();
|
||||
Context * globalContext = probaApp->container()->globalContext();
|
||||
float floatBody = Expression::parse(text)->approximate(*globalContext);
|
||||
if (m_calculation->type() != Calculation::Type::FiniteIntegral && m_highlightedSubviewIndex == 2) {
|
||||
if (floatBody < 0.0f) {
|
||||
floatBody = 0.0f;
|
||||
}
|
||||
if (floatBody > 1.0f) {
|
||||
floatBody = 1.0f;
|
||||
}
|
||||
}
|
||||
m_calculation->setParameterAtIndex(floatBody, m_highlightedSubviewIndex-1);
|
||||
for (int k = 0; k < m_calculation->numberOfParameters(); k++) {
|
||||
m_contentView.willDisplayEditableCellAtIndex(k);
|
||||
|
||||
Reference in New Issue
Block a user