From 7d36634303984c5df5af23f35a3bf9aa67b79d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 28 Aug 2019 09:38:08 +0200 Subject: [PATCH] [apps/graph] Fix CurveParamCtrlr relayouting bug Scenario: f(x) = 1, g(theta) = 2, go to Graph. Press ok on the polar curve, then Back, then OK on the cartesian curve : the menu is drawn as if the curve was still polar. --- apps/graph/graph/curve_parameter_controller.cpp | 7 +++++++ apps/graph/graph/curve_parameter_controller.h | 1 + 2 files changed, 8 insertions(+) diff --git a/apps/graph/graph/curve_parameter_controller.cpp b/apps/graph/graph/curve_parameter_controller.cpp index 4b67ba179..5bdc1cbb8 100644 --- a/apps/graph/graph/curve_parameter_controller.cpp +++ b/apps/graph/graph/curve_parameter_controller.cpp @@ -76,6 +76,13 @@ int CurveParameterController::reusableCellCount() { return 1 + (shouldDisplayCalculationAndDerivative() ? 2 : 0); } +void CurveParameterController::viewDidDisappear() { + /* Deselect the table properly because it needs to be relayouted the next time + * it appears: the number of rows might change according to the plot type. */ + m_selectableTableView.deselectTable(false); + m_selectableTableView.setFrame(KDRectZero); +} + bool CurveParameterController::shouldDisplayCalculationAndDerivative() const { Shared::ExpiringPointer f = App::app()->functionStore()->modelForRecord(m_record); return f->plotType() == CartesianFunction::PlotType::Cartesian; diff --git a/apps/graph/graph/curve_parameter_controller.h b/apps/graph/graph/curve_parameter_controller.h index a1abc63e9..fd7086dfe 100644 --- a/apps/graph/graph/curve_parameter_controller.h +++ b/apps/graph/graph/curve_parameter_controller.h @@ -18,6 +18,7 @@ public: HighlightCell * reusableCell(int index) override; int reusableCellCount() override; void willDisplayCellForIndex(HighlightCell * cell, int index) override; + void viewDidDisappear() override; private: bool shouldDisplayCalculationAndDerivative() const; int cellIndex(int visibleCellIndex) const;