From 0630ae55c70abcfd5427a9ba4ae47ac4a122e6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 2 Oct 2019 11:48:03 +0200 Subject: [PATCH] [apps/escher] Force expressionField relayout when size changed Scenario: in Calculations and in Graph, edit the layout field by adding many parentheses. When the layout field has maximal height but the parentheses are bigger than it, ther is a margin that appears at the bottom, because we did not relayout the layout field to optimize redrawing. We need to force the relayout, otherwise as the layout field stays we the same frame, the relayouting is not properly done. --- apps/calculation/edit_expression_controller.cpp | 7 +++++++ escher/src/input_view_controller.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/apps/calculation/edit_expression_controller.cpp b/apps/calculation/edit_expression_controller.cpp index d72b7fc20..7b60010a2 100644 --- a/apps/calculation/edit_expression_controller.cpp +++ b/apps/calculation/edit_expression_controller.cpp @@ -98,6 +98,13 @@ void EditExpressionController::layoutFieldDidChangeSize(::LayoutField * layoutFi if (!m_inputViewHeightIsMaximal || !newInputViewHeightIsMaximal) { m_inputViewHeightIsMaximal = newInputViewHeightIsMaximal; reloadView(); + } else { + /* The input view is already at maximal size so we do not need to relayout + * the view underneath, but the view inside the input view might still need + * to be relayouted. + * We force the relayout because the frame stays the same but we need to + * propagate a relayout to the content of the field scroll view. */ + m_contentView.expressionField()->layoutSubviews(true); } } diff --git a/escher/src/input_view_controller.cpp b/escher/src/input_view_controller.cpp index 766ad58ae..669c7e60c 100644 --- a/escher/src/input_view_controller.cpp +++ b/escher/src/input_view_controller.cpp @@ -92,6 +92,13 @@ void InputViewController::layoutFieldDidChangeSize(LayoutField * layoutField) { if (!m_inputViewHeightIsMaximal || !newInputViewHeightIsMaximal) { m_inputViewHeightIsMaximal = newInputViewHeightIsMaximal; reloadModalViewController(); + } else { + /* The input view is already at maximal size so we do not need to relayout + * the view underneath, but the view inside the input view might still need + * to be relayouted. + * We force the relayout because the frame stays the same but we need to + * propagate a relayout to the content of the field scroll view. */ + m_expressionFieldController.expressionField()->layoutSubviews(true); } }