From beac710e0e58d4530c2cb00893203bfb706a2e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 2 Sep 2019 15:29:14 +0200 Subject: [PATCH] [apps/graph] Do not restrain the cursor to the domain of definition in the Graph --- apps/graph/graph/graph_controller_helper.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/graph/graph/graph_controller_helper.cpp b/apps/graph/graph/graph_controller_helper.cpp index 6d276e3d4..ecfc78f18 100644 --- a/apps/graph/graph/graph_controller_helper.cpp +++ b/apps/graph/graph/graph_controller_helper.cpp @@ -9,9 +9,6 @@ using namespace Poincare; namespace Graph { -static inline float minFloat(float x, float y) { return x < y ? x : y; } -static inline float maxFloat(float x, float y) { return x > y ? x : y; } - bool GraphControllerHelper::privateMoveCursorHorizontally(Shared::CurveViewCursor * cursor, int direction, Shared::InteractiveCurveViewRange * range, int numberOfStepsInGradUnit, Ion::Storage::Record record) { ExpiringPointer function = App::app()->functionStore()->modelForRecord(record); double tCursorPosition = cursor->t(); @@ -20,18 +17,12 @@ bool GraphControllerHelper::privateMoveCursorHorizontally(Shared::CurveViewCurso double tMax = function->tMax(); double dir = (direction > 0 ? 1.0 : -1.0); CartesianFunction::PlotType type = function->plotType(); - if ((dir > 0 && t >= tMax) || (dir < 0 && t <= tMin)) { - // Stay inside the definition domain - assert((t == tMax) || (t == tMin)); - return true; - } if (type == CartesianFunction::PlotType::Cartesian) { t+= dir * range->xGridUnit()/numberOfStepsInGradUnit; } else { assert(type == CartesianFunction::PlotType::Polar || type == CartesianFunction::PlotType::Parametric); t += dir * (tMax-tMin)/k_definitionDomainDivisor; } - t = maxFloat(minFloat(t, tMax), tMin); // Stay inside the definition domain Coordinate2D xy = function->evaluateXYAtParameter(t, App::app()->localContext()); cursor->moveTo(t, xy.x1(), xy.x2()); return true;