[apps] Graph/Sequence: the function selected by the cursor has to be

save in the Snapshot to avoid weird selection when rebulding the app
This commit is contained in:
Émilie Feral
2018-01-25 13:39:11 +01:00
committed by EmilieNumworks
parent c9b86d0c86
commit 95f0efaf9f
10 changed files with 40 additions and 24 deletions

View File

@@ -6,8 +6,8 @@ using namespace Poincare;
namespace Graph {
GraphController::GraphController(Responder * parentResponder, CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, uint32_t * modelVersion, uint32_t * rangeVersion, Expression::AngleUnit * angleUnitVersion, ButtonRowController * header) :
FunctionGraphController(parentResponder, header, curveViewRange, &m_view, cursor, modelVersion, rangeVersion, angleUnitVersion),
GraphController::GraphController(Responder * parentResponder, CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Expression::AngleUnit * angleUnitVersion, ButtonRowController * header) :
FunctionGraphController(parentResponder, header, curveViewRange, &m_view, cursor, indexFunctionSelectedByCursor, modelVersion, rangeVersion, angleUnitVersion),
m_bannerView(),
m_view(functionStore, curveViewRange, m_cursor, &m_bannerView, &m_cursorView),
m_graphRange(curveViewRange),
@@ -48,20 +48,20 @@ void GraphController::reloadBannerView() {
if (m_functionStore->numberOfActiveFunctions() == 0 || !m_displayDerivativeInBanner) {
return;
}
CartesianFunction * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor);
CartesianFunction * f = m_functionStore->activeFunctionAtIndex(indexFunctionSelectedByCursor());
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
reloadDerivativeInBannerViewForCursorOnFunction(m_cursor, f, myApp);
}
bool GraphController::moveCursorHorizontally(int direction) {
CartesianFunction * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor);
CartesianFunction * f = m_functionStore->activeFunctionAtIndex(indexFunctionSelectedByCursor());
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
return privateMoveCursorHorizontally(m_cursor, direction, m_graphRange, k_numberOfCursorStepsInGradUnit, f, myApp, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
}
void GraphController::initCursorParameters() {
double x = (interactiveCurveViewRange()->xMin()+interactiveCurveViewRange()->xMax())/2.0f;
m_indexFunctionSelectedByCursor = 0;
selectFunctionWithCursor(0);
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
int functionIndex = 0;
double y = 0;