mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/graph] Implement move cursor vertically on graph with
parametric/polar curves
This commit is contained in:
@@ -66,4 +66,13 @@ bool GraphController::moveCursorHorizontally(int direction) {
|
||||
return privateMoveCursorHorizontally(m_cursor, direction, m_graphRange, k_numberOfCursorStepsInGradUnit, record);
|
||||
}
|
||||
|
||||
int GraphController::closestCurveIndexVertically(bool goingUp, int currentSelectedCurve, Poincare::Context * context) const {
|
||||
int nbOfActiveFunctions = functionStore()-> numberOfActiveFunctions();
|
||||
if (functionStore()->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Cartesian) == nbOfActiveFunctions) {
|
||||
return FunctionGraphController::closestCurveIndexVertically(goingUp, currentSelectedCurve, context);
|
||||
}
|
||||
int nextActiveFunctionIndex = currentSelectedCurve + (goingUp ? 1 : -1);
|
||||
return nextActiveFunctionIndex >= nbOfActiveFunctions ? -1 : nextActiveFunctionIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
BannerView * bannerView() override { return &m_bannerView; }
|
||||
void reloadBannerView() override;
|
||||
bool moveCursorHorizontally(int direction) override;
|
||||
bool moveCursorVertically(int direction) override { return false; } // TODO Emilie
|
||||
int closestCurveIndexVertically(bool goingUp, int currentSelectedCurve, Poincare::Context * context) const override;
|
||||
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override { return m_graphRange; }
|
||||
GraphView * functionGraphView() override { return &m_view; }
|
||||
CurveParameterController * curveParameterController() override { return &m_curveParameterController; }
|
||||
|
||||
@@ -286,7 +286,7 @@ bool GraphController::moveCursorVertically(int direction) {
|
||||
|
||||
// Find the closest regression
|
||||
int selectedRegressionIndex = *m_selectedDotIndex == -1 ? *m_selectedSeriesIndex : -1;
|
||||
int closestRegressionSeries = InteractiveCurveViewController::closestCurveIndexVertically(direction > 0, selectedRegressionIndex, context);
|
||||
int closestRegressionSeries = closestCurveIndexVertically(direction > 0, selectedRegressionIndex, context);
|
||||
|
||||
// Find the closest dot
|
||||
int closestDotSeries = -1;
|
||||
|
||||
@@ -150,7 +150,7 @@ void FunctionGraphController::initCursorParameters() {
|
||||
bool FunctionGraphController::moveCursorVertically(int direction) {
|
||||
int currentActiveFunctionIndex = indexFunctionSelectedByCursor();
|
||||
Poincare::Context * context = textFieldDelegateApp()->localContext();
|
||||
int nextActiveFunctionIndex = InteractiveCurveViewController::closestCurveIndexVertically(direction > 0, currentActiveFunctionIndex, context);
|
||||
int nextActiveFunctionIndex = closestCurveIndexVertically(direction > 0, currentActiveFunctionIndex, context);
|
||||
if (nextActiveFunctionIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
bool isCursorVisible();
|
||||
|
||||
// Closest vertical curve helper
|
||||
int closestCurveIndexVertically(bool goingUp, int currentSelectedCurve, Poincare::Context * context) const;
|
||||
virtual int closestCurveIndexVertically(bool goingUp, int currentSelectedCurve, Poincare::Context * context) const;
|
||||
virtual bool closestCurveIndexIsSuitable(int newIndex, int currentIndex) const = 0;
|
||||
virtual int selectedCurveIndex() const = 0;
|
||||
virtual Poincare::Coordinate2D<double> xyValues(int curveIndex, double t, Poincare::Context * context) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user