diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index 430b53e64..3419df864 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -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(); } diff --git a/apps/graph/graph/graph_controller.h b/apps/graph/graph/graph_controller.h index 3c050acf4..a37d70e59 100644 --- a/apps/graph/graph/graph_controller.h +++ b/apps/graph/graph/graph_controller.h @@ -50,6 +50,7 @@ private: CurveParameterController m_curveParameterController; CartesianFunctionStore * m_functionStore; int m_indexFunctionSelectedByCursor; + Poincare::Expression::AngleUnit m_angleUnitVersion; }; } diff --git a/apps/shared/interactive_curve_view_controller.cpp b/apps/shared/interactive_curve_view_controller.cpp index 3e6021704..07448a750 100644 --- a/apps/shared/interactive_curve_view_controller.cpp +++ b/apps/shared/interactive_curve_view_controller.cpp @@ -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()); + } +} } diff --git a/apps/shared/interactive_curve_view_controller.h b/apps/shared/interactive_curve_view_controller.h index df2b084f1..863401382 100644 --- a/apps/shared/interactive_curve_view_controller.h +++ b/apps/shared/interactive_curve_view_controller.h @@ -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;