mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] The heights (common and expanded) of calculation cells are
computed when the calculation is added to the store and don't change afterwards. Otherwise, if their heights change when scrolling (due to a modification of the display output type - ExactOnly, ApproximateOnly...), it generates crashes.
This commit is contained in:
committed by
LeaNumworks
parent
c2db00cc88
commit
df74c2c551
@@ -120,12 +120,15 @@ Layout Calculation::createApproximateOutputLayout(Context * context, bool * coul
|
||||
}
|
||||
}
|
||||
|
||||
void Calculation::setMemoizedHeight(bool expanded, KDCoordinate height) {
|
||||
if (expanded) {
|
||||
m_expandedHeight = height;
|
||||
} else {
|
||||
m_height = height;
|
||||
}
|
||||
KDCoordinate Calculation::height(bool expanded) {
|
||||
KDCoordinate h = expanded ? m_expandedHeight : m_height;
|
||||
assert(h >= 0);
|
||||
return h;
|
||||
}
|
||||
|
||||
void Calculation::setHeights(KDCoordinate height, KDCoordinate expandedHeight) {
|
||||
m_height = height;
|
||||
m_expandedHeight = expandedHeight;
|
||||
}
|
||||
|
||||
Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
|
||||
@@ -184,9 +187,9 @@ Calculation::DisplayOutput Calculation::displayOutput(Context * context) {
|
||||
}
|
||||
|
||||
void Calculation::forceDisplayOutput(DisplayOutput d) {
|
||||
// Heights haven't been computed yet
|
||||
assert(m_height == -1 && m_expandedHeight == -1);
|
||||
m_displayOutput = d;
|
||||
// Reset heights memoization as it might have changed when we modify the display output
|
||||
resetHeightMemoization();
|
||||
}
|
||||
|
||||
bool Calculation::shouldOnlyDisplayExactOutput() {
|
||||
@@ -284,9 +287,4 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
|
||||
return AdditionalInformationType::None;
|
||||
}
|
||||
|
||||
void Calculation::resetHeightMemoization() {
|
||||
m_height = -1;
|
||||
m_expandedHeight = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user