[apps/sequence/sequence] Do not memoize nameLayout

Fixes the following bug:
In the graph tab of the Sequence app, compute the sum of the terms of
a sequence from 1 to 9 and then from 1 to 10. The Layout is memoized
after the first time and mispositioned the second time since it is
not recomputed.
This commit is contained in:
Ruben Dashyan
2020-03-02 14:54:37 +01:00
committed by LeaNumworks
parent c1215063ee
commit fccd72b757
2 changed files with 7 additions and 11 deletions

View File

@@ -28,7 +28,6 @@ void Sequence::tidy() {
m_firstInitialCondition.tidyName();
m_secondInitialCondition.tidy();
m_secondInitialCondition.tidyName();
m_nameLayout = Layout();
}
Sequence::Type Sequence::type() const {
@@ -81,13 +80,10 @@ void Sequence::setInitialRank(int rank) {
}
Poincare::Layout Sequence::nameLayout() {
if (m_nameLayout.isUninitialized()) {
m_nameLayout = HorizontalLayout::Builder(
CodePointLayout::Builder(fullName()[0], KDFont::SmallFont),
VerticalOffsetLayout::Builder(CodePointLayout::Builder(symbol(), KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Subscript)
);
}
return m_nameLayout;
return HorizontalLayout::Builder(
CodePointLayout::Builder(fullName()[0], KDFont::SmallFont),
VerticalOffsetLayout::Builder(CodePointLayout::Builder(symbol(), KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Subscript)
);
}
bool Sequence::isDefined() {