diff --git a/apps/graph/graph/banner_view.h b/apps/graph/graph/banner_view.h index 8f8989b26..d53702c2a 100644 --- a/apps/graph/graph/banner_view.h +++ b/apps/graph/graph/banner_view.h @@ -16,6 +16,7 @@ public: BufferTextView * aView() { return &m_aView; } BufferTextView * bView() { return &m_bView; } void setNumberOfSubviews(int numberOfSubviews) { m_numberOfSubviews = numberOfSubviews; } + static constexpr int k_numberOfSubviews = Shared::XYBannerView::k_numberOfSubviews + 4; private: int numberOfSubviews() const override { return m_numberOfSubviews; } View * subviewAtIndex(int index) override; diff --git a/apps/graph/graph/calculation_graph_controller.cpp b/apps/graph/graph/calculation_graph_controller.cpp index 847bbc8b9..e72b21167 100644 --- a/apps/graph/graph/calculation_graph_controller.cpp +++ b/apps/graph/graph/calculation_graph_controller.cpp @@ -28,6 +28,7 @@ void CalculationGraphController::viewWillAppear() { m_isActive = true; m_cursor->moveTo(pointOfInterest.abscissa, pointOfInterest.value); m_graphRange->panToMakePointVisible(m_cursor->x(), m_cursor->y(), cursorTopMarginRatio(), k_cursorRightMarginRatio, cursorBottomMarginRatio(), k_cursorLeftMarginRatio); + m_bannerView->setNumberOfSubviews(Shared::XYBannerView::k_numberOfSubviews); reloadBannerView(); } m_graphView->setOkView(nullptr); @@ -40,7 +41,6 @@ void CalculationGraphController::setRecord(Ion::Storage::Record record) { } void CalculationGraphController::reloadBannerView() { - m_bannerView->setNumberOfSubviews(2); reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), CartesianFunction::Symbol()); } diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index c544b235b..23e5e2e23 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -28,6 +28,7 @@ I18n::Message GraphController::emptyMessage() { void GraphController::viewWillAppear() { m_view.drawTangent(false); m_view.setCursorView(&m_cursorView); + m_bannerView.setNumberOfSubviews(Shared::XYBannerView::k_numberOfSubviews + m_displayDerivativeInBanner); FunctionGraphController::viewWillAppear(); selectFunctionWithCursor(indexFunctionSelectedByCursor()); // update the color of the cursor } @@ -69,7 +70,6 @@ BannerView * GraphController::bannerView() { void GraphController::reloadBannerView() { FunctionGraphController::reloadBannerView(); - m_bannerView.setNumberOfSubviews(2+m_displayDerivativeInBanner); if (functionStore()->numberOfActiveFunctions() == 0 || !m_displayDerivativeInBanner) { return; } diff --git a/apps/graph/graph/intersection_graph_controller.cpp b/apps/graph/graph/intersection_graph_controller.cpp index 1994430b8..074944f4a 100644 --- a/apps/graph/graph/intersection_graph_controller.cpp +++ b/apps/graph/graph/intersection_graph_controller.cpp @@ -17,8 +17,7 @@ const char * IntersectionGraphController::title() { } void IntersectionGraphController::reloadBannerView() { - m_bannerView->setNumberOfSubviews(2); - reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore(), CartesianFunction::Symbol()); + CalculationGraphController::reloadBannerView(); constexpr size_t bufferSize = FunctionBannerDelegate::k_maxNumberOfCharacters+Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits); char buffer[bufferSize]; const char * space = " "; diff --git a/apps/graph/graph/tangent_graph_controller.cpp b/apps/graph/graph/tangent_graph_controller.cpp index ed93596f8..fe0280cde 100644 --- a/apps/graph/graph/tangent_graph_controller.cpp +++ b/apps/graph/graph/tangent_graph_controller.cpp @@ -25,6 +25,7 @@ void TangentGraphController::viewWillAppear() { m_graphView->drawTangent(true); m_graphView->setOkView(nullptr); m_graphView->selectMainView(true); + m_bannerView->setNumberOfSubviews(BannerView::k_numberOfSubviews); reloadBannerView(); m_graphView->reload(); } @@ -35,7 +36,6 @@ void TangentGraphController::setRecord(Ion::Storage::Record record) { } void TangentGraphController::reloadBannerView() { - m_bannerView->setNumberOfSubviews(6); if (m_record.isNull()) { return; }