[apps/graph] Fix graph selection when a function is undef

For instance, input f(x)=1/0 and g(x)=1, the graph tab now selects g
correctly
This commit is contained in:
Léa Saviot
2018-06-26 11:37:50 +02:00
committed by Ecco
parent 8c0aae9778
commit a166903659
3 changed files with 19 additions and 1 deletions

View File

@@ -24,6 +24,22 @@ Function * FunctionStore::activeFunctionAtIndex(int i) {
return nullptr;
}
int FunctionStore::activeFunctionStoreIndex(int i) {
assert(i>=0 && i<numberOfActiveFunctions());
int index = 0;
for (int k = 0; k < m_numberOfModels; k++) {
Function * function = modelAtIndex(k);
if (function->isActive() && function->isDefined()) {
if (i == index) {
return k;
}
index++;
}
}
assert(false);
return -1;
}
int FunctionStore::numberOfActiveFunctions() {
int result = 0;
for (int i = 0; i < m_numberOfModels; i++) {