[graph] Values tab: select the right cell of the values table when

displaying/undisplaying the derivative column
This commit is contained in:
Émilie Feral
2019-03-12 15:45:58 +01:00
committed by LeaNumworks
parent 2a34f955ca
commit e40e626eec
2 changed files with 6 additions and 4 deletions

View File

@@ -19,7 +19,9 @@ bool StorageFunctionParameterController::handleEvent(Ion::Events::Event event) {
switch (selectedRow()) {
case 0:
{
function()->setDisplayDerivative(!function()->displayDerivative());
bool isDisplayingDerivative = function()->displayDerivative();
function()->setDisplayDerivative(!isDisplayingDerivative);
m_valuesController->selectCellAtLocation(isDisplayingDerivative ? m_selectedFunctionColumn : m_selectedFunctionColumn + 1, m_valuesController->selectedRow());
m_selectableTableView.reloadData();
return true;
}
@@ -57,9 +59,7 @@ int StorageFunctionParameterController::reusableCellCount() {
void StorageFunctionParameterController::viewWillAppear() {
StorageValuesFunctionParameterController::viewWillAppear();
if (function()->displayDerivative()) {
m_valuesController->selectCellAtLocation(m_valuesController->selectedColumn()+1, m_valuesController->selectedRow());
}
m_selectedFunctionColumn = m_valuesController->selectedColumn();
}
void StorageFunctionParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {

View File

@@ -27,6 +27,8 @@ private:
#endif
MessageTableCellWithSwitch m_displayDerivativeColumn;
StorageValuesController * m_valuesController;
// Index of the column corresponding to the function in the values controller
int m_selectedFunctionColumn;
};
}