mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 13:50:28 +01:00
[escher/expression_field] Detect whether view's height did change by memoizing the height
Such changes used to be detected only when the height was equal to the maximal allowed value, by detecting whether the height shifted from or to that maximal value. For that purpose, a boolean was memoized in InputViewController and in Calculation::EditExpressionController.
This commit is contained in:
committed by
Léa Saviot
parent
40d75ffefa
commit
7fce83d1dd
@@ -42,8 +42,7 @@ EditExpressionController::EditExpressionController(Responder * parentResponder,
|
||||
ViewController(parentResponder),
|
||||
m_historyController(historyController),
|
||||
m_calculationStore(calculationStore),
|
||||
m_contentView(this, (TableView *)m_historyController->view(), inputEventHandlerDelegate, this, this),
|
||||
m_inputViewHeightIsMaximal(false)
|
||||
m_contentView(this, (TableView *)m_historyController->view(), inputEventHandlerDelegate, this, this)
|
||||
{
|
||||
m_cacheBuffer[0] = 0;
|
||||
}
|
||||
@@ -90,11 +89,9 @@ bool EditExpressionController::layoutFieldDidAbortEditing(::LayoutField * layout
|
||||
}
|
||||
|
||||
void EditExpressionController::layoutFieldDidChangeSize(::LayoutField * layoutField) {
|
||||
/* Reload the view only if the ExpressionField height actually changes, i.e.
|
||||
* not if the height is already maximal and stays maximal. */
|
||||
bool newInputViewHeightIsMaximal = m_contentView.expressionField()->heightIsMaximal();
|
||||
if (!m_inputViewHeightIsMaximal || !newInputViewHeightIsMaximal) {
|
||||
m_inputViewHeightIsMaximal = newInputViewHeightIsMaximal;
|
||||
if (m_contentView.expressionField()->inputViewHeightDidChange()) {
|
||||
/* Reload the whole view only if the ExpressionField's height did actually
|
||||
* change. */
|
||||
reloadView();
|
||||
} else {
|
||||
/* The input view is already at maximal size so we do not need to relayout
|
||||
|
||||
Reference in New Issue
Block a user