[apps/shared] Correct cursor initialisation in graph view in graph and

regression

Change-Id: I76bc1960f9633de825ae0efa49b9e057cd092f57
This commit is contained in:
Émilie Feral
2017-02-22 14:03:58 +01:00
parent d46afd1343
commit 7df76d91d9
4 changed files with 15 additions and 3 deletions

View File

@@ -45,6 +45,11 @@ void GraphController::viewWillAppear() {
App * graphApp = (Graph::App *)app();
m_view.setContext(graphApp->localContext());
}
Expression::AngleUnit newAngleUnitVersion = Preferences::sharedPreferences()->angleUnit();
if (m_angleUnitVersion != newAngleUnitVersion) {
m_angleUnitVersion = newAngleUnitVersion;
initCursorParameters();
}
InteractiveCurveViewController::viewWillAppear();
}

View File

@@ -50,6 +50,7 @@ private:
CurveParameterController m_curveParameterController;
CartesianFunctionStore * m_functionStore;
int m_indexFunctionSelectedByCursor;
Poincare::Expression::AngleUnit m_angleUnitVersion;
};
}

View File

@@ -103,7 +103,10 @@ void InteractiveCurveViewController::didBecomeFirstResponder() {
if (m_modelVersion != newModelVersion) {
m_modelVersion = newModelVersion;
initRangeParameters();
/* Warning: init cursor parameter before reloading banner view. Indeed,
* reloading banner view needs an updated cursor to load the right data. */
initCursorParameters();
centerCursorVertically();
reloadBannerView();
curveView()->reload();
}
@@ -146,9 +149,6 @@ Responder * InteractiveCurveViewController::defaultController() {
void InteractiveCurveViewController::viewWillAppear() {
curveView()->selectMainView(true);
headerViewController()->setSelectedButton(-1);
/* Warning: init cursor parameter before reloading banner view. Indeed,
* reloading banner view needs an updated cursor to load the right data. */
initCursorParameters();
reloadBannerView();
curveView()->reload();
}
@@ -161,4 +161,9 @@ StackViewController * InteractiveCurveViewController::stackController() const{
return (StackViewController *)(parentResponder()->parentResponder()->parentResponder());
}
void InteractiveCurveViewController::centerCursorVertically() {
if (!interactiveCurveViewRange()->yAuto()) {
interactiveCurveViewRange()->centerAxisAround(CurveViewRange::Axis::Y, m_cursor.y());
}
}
}

View File

@@ -35,6 +35,7 @@ protected:
virtual bool handleEnter() = 0;
Responder * tabController() const;
StackViewController * stackController() const;
void centerCursorVertically();
virtual void reloadBannerView() = 0;
virtual void initRangeParameters() = 0;
virtual void initCursorParameters() = 0;