mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[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:
@@ -81,7 +81,6 @@ bool GraphController::moveCursorHorizontally(int direction) {
|
||||
|
||||
void GraphController::initCursorParameters() {
|
||||
double x = (interactiveCurveViewRange()->xMin()+interactiveCurveViewRange()->xMax())/2.0f;
|
||||
selectFunctionWithCursor(0);
|
||||
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
|
||||
int functionIndex = 0;
|
||||
double y = 0;
|
||||
@@ -90,6 +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);
|
||||
interactiveCurveViewRange()->panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user