mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[sequence] Add a pop-up when the user tries to set the first term
index to a value above 1000
This commit is contained in:
committed by
LeaNumworks
parent
3a29f086a0
commit
8541c2cb7e
@@ -121,15 +121,16 @@ bool ListParameterController::textFieldShouldFinishEditing(TextField * textField
|
||||
}
|
||||
|
||||
bool ListParameterController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
static float maxFirstIndex = std::pow(10.0, Sequence::k_initialRankNumberOfDigits);
|
||||
AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container();
|
||||
Context * globalContext = appsContainer->globalContext();
|
||||
double floatBody = Expression::approximateToScalar<double>(text, *globalContext);
|
||||
float floatBody = Expression::approximateToScalar<float>(text, *globalContext);
|
||||
int index = std::round(floatBody);
|
||||
if (std::isnan(floatBody) || std::isinf(floatBody)) {
|
||||
app()->displayWarning(I18n::Message::UndefinedValue);
|
||||
return false;
|
||||
}
|
||||
if (index < 0) {
|
||||
if (index < 0 || floatBody >= maxFirstIndex) {
|
||||
app()->displayWarning(I18n::Message::ForbiddenValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user