[graph] Fix bug when initializing the selected function on graph

This commit is contained in:
Émilie Feral
2018-07-06 13:30:13 +02:00
committed by EmilieNumworks
parent 34198945f2
commit d36c0c8746
3 changed files with 4 additions and 12 deletions

View File

@@ -89,8 +89,8 @@ void GraphController::initCursorParameters() {
y = firstFunction->evaluateAtAbscissa(x, myApp->localContext());
} while (std::isnan(y) && functionIndex < functionStore()->numberOfActiveFunctions());
m_cursor->moveTo(x, y);
int functionSelected = functionStore()->activeFunctionStoreIndex(functionIndex-1);
selectFunctionWithCursor(functionSelected < 0 ? 0 : functionSelected);
functionIndex = std::isnan(y) ? 0 : functionIndex - 1;
selectFunctionWithCursor(functionIndex);
interactiveCurveViewRange()->panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
}