[apps/calculation] Fix bottom calculation margin

Scenario: enter a calculation that uses two lines, the margin on the
bottom is too big
This commit is contained in:
Léa Saviot
2020-05-26 11:03:35 +02:00
committed by EmilieNumworks
parent 5535145b51
commit c4908c2bd9
2 changed files with 4 additions and 4 deletions

View File

@@ -125,7 +125,7 @@ Layout Calculation::createApproximateOutputLayout(Context * context, bool * coul
}
}
KDCoordinate Calculation::height(Context * context, KDCoordinate verticalMarginBetweenLayouts, KDCoordinate verticalMarginAroundLayouts, bool expanded, bool forceSingleLine, LayoutsCanBeSingleLineFunction canBeSingleLine) {
KDCoordinate Calculation::height(Context * context, KDCoordinate topBottomMargin, KDCoordinate verticalMarginAroundLayouts, bool expanded, bool forceSingleLine, LayoutsCanBeSingleLineFunction canBeSingleLine) {
/* WARNING: this method must return the same result as
* Calculation::HistoryViewCell::layoutSubviews. */
@@ -225,11 +225,11 @@ KDCoordinate Calculation::height(Context * context, KDCoordinate verticalMarginB
+ std::max(static_cast<KDCoordinate>(inputHeight - inputBaseline), outputHeightBelowBaseline) // Below the baseline
+ 2 * verticalMarginAroundLayouts;
} else {
result = inputHeight + verticalMarginBetweenLayouts + outputBaseline + outputHeightBelowBaseline + 4 * verticalMarginAroundLayouts;
result = inputHeight + outputBaseline + outputHeightBelowBaseline + 4 * verticalMarginAroundLayouts;
}
// Add the top and bottom margins
result += 2 * verticalMarginBetweenLayouts;
result += 2 * topBottomMargin;
/* For all display outputs except ExactAndApproximateToggle, the selected
* height and the usual height are identical. We update both heights in

View File

@@ -85,7 +85,7 @@ public:
// Memoization of height
typedef bool (*LayoutsCanBeSingleLineFunction)(KDCoordinate inputWidth, KDCoordinate outputWidth);
KDCoordinate height(Poincare::Context * context, KDCoordinate verticalMarginBetweenLayouts, KDCoordinate verticalMarginAroundLayouts, bool expanded, bool forceSingleLine, LayoutsCanBeSingleLineFunction canbeSingleLine = [](KDCoordinate inputLayoutWidth, KDCoordinate outputLayoutWidth) { assert(false); return true; });
KDCoordinate height(Poincare::Context * context, KDCoordinate topBottomMargin, KDCoordinate verticalMarginAroundLayouts, bool expanded, bool forceSingleLine, LayoutsCanBeSingleLineFunction canbeSingleLine = [](KDCoordinate inputLayoutWidth, KDCoordinate outputLayoutWidth) { assert(false); return true; });
// Displayed output
DisplayOutput displayOutput(Poincare::Context * context);