From 246a9aa7a488911a0f883b015daa53673079cdaa Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Fri, 31 Jan 2020 15:29:05 +0100 Subject: [PATCH] [apps/shared/function_graph_controller] Clarify function selection in initCursorParameters --- apps/shared/function_graph_controller.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/shared/function_graph_controller.cpp b/apps/shared/function_graph_controller.cpp index 36327d9da..6606ca059 100644 --- a/apps/shared/function_graph_controller.cpp +++ b/apps/shared/function_graph_controller.cpp @@ -140,13 +140,15 @@ void FunctionGraphController::initCursorParameters() { Coordinate2D xy; double t; do { - Ion::Storage::Record record = functionStore()->activeRecordAtIndex(functionIndex++); + Ion::Storage::Record record = functionStore()->activeRecordAtIndex(functionIndex); ExpiringPointer firstFunction = functionStore()->modelForRecord(record); t = defaultCursorT(record); xy = firstFunction->evaluateXYAtParameter(t, context); - } while ((std::isnan(xy.x2()) || std::isinf(xy.x2())) && functionIndex < activeFunctionsCount); + } while ((std::isnan(xy.x2()) || std::isinf(xy.x2())) && ++functionIndex < activeFunctionsCount); + if (functionIndex == activeFunctionsCount) { + functionIndex = 0; + } m_cursor->moveTo(t, xy.x1(), xy.x2()); - functionIndex = (std::isnan(xy.x2()) || std::isinf(xy.x2())) ? 0 : functionIndex - 1; selectFunctionWithCursor(functionIndex); if (interactiveCurveViewRange()->yAuto()) { interactiveCurveViewRange()->panToMakePointVisible(xy.x1(), xy.x2(), cursorTopMarginRatio(), k_cursorRightMarginRatio, cursorBottomMarginRatio(), k_cursorLeftMarginRatio);