[apps/shared] Allow movement from undef curve

Fix a bug preventing the cursor from moving to other curves using UP and
DOWN when the y value was undef.
To reproduce :
  - In Graph, define f(x) = 1 and g(x) = ln(x), then draw the curves
  - Press DOWN to select g
  - Press LEFT until g is not defined anymore
--> Pressing UP or DOWN won't allow you to select f

Change-Id: I79ed4a57b78ac0b8dac3f66e722e358bd4be18d9
This commit is contained in:
Gabriel Ozouf
2020-09-17 17:43:30 +02:00
committed by Émilie Feral
parent c130f8e881
commit 26bbdead7d

View File

@@ -261,6 +261,9 @@ bool InteractiveCurveViewController::isCursorVisible() {
int InteractiveCurveViewController::closestCurveIndexVertically(bool goingUp, int currentCurveIndex, Poincare::Context * context) const {
double x = m_cursor->x();
double y = m_cursor->y();
if (std::isnan(y)) {
y = goingUp ? -INFINITY : INFINITY;
}
double nextY = goingUp ? DBL_MAX : -DBL_MAX;
int nextCurveIndex = -1;
int curvesCount = numberOfCurves();