mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps/graph] Block navigation to definition domain
This commit is contained in:
committed by
EmilieNumworks
parent
bd5a247858
commit
936b624fb9
@@ -10,6 +10,9 @@ using namespace Poincare;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
static inline double minDouble(double x, double y) { return x < y ? x : y; }
|
||||
static inline double maxDouble(double x, double y) { return x > y ? x : y; }
|
||||
|
||||
bool GraphControllerHelper::privateMoveCursorHorizontally(Shared::CurveViewCursor * cursor, int direction, Shared::InteractiveCurveViewRange * range, int numberOfStepsInGradUnit, Ion::Storage::Record record) {
|
||||
ExpiringPointer<ContinuousFunction> function = App::app()->functionStore()->modelForRecord(record);
|
||||
double tCursorPosition = cursor->t();
|
||||
@@ -19,11 +22,12 @@ bool GraphControllerHelper::privateMoveCursorHorizontally(Shared::CurveViewCurso
|
||||
double dir = (direction > 0 ? 1.0 : -1.0);
|
||||
ContinuousFunction::PlotType type = function->plotType();
|
||||
if (type == ContinuousFunction::PlotType::Cartesian) {
|
||||
t+= dir * range->xGridUnit()/numberOfStepsInGradUnit;
|
||||
t += dir * range->xGridUnit()/numberOfStepsInGradUnit;
|
||||
} else {
|
||||
assert(type == ContinuousFunction::PlotType::Polar || type == ContinuousFunction::PlotType::Parametric);
|
||||
t += dir * (tMax-tMin)/k_definitionDomainDivisor;
|
||||
}
|
||||
t = maxDouble(tMin, minDouble(tMax, t));
|
||||
Coordinate2D<double> xy = function->evaluateXYAtParameter(t, App::app()->localContext());
|
||||
cursor->moveTo(t, xy.x1(), xy.x2());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user