[escher/layout_field] Reset the scroll when clearing the layout

Scenario: Go to the graph app, create f(x) = 1 then create g(x) -> there
is a weird big margin in the edition field
This commit is contained in:
Léa Saviot
2020-05-07 17:56:11 +02:00
committed by EmilieNumworks
parent 73c55f0437
commit 016f87c266
2 changed files with 6 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ public:
Poincare::Context * context() const;
bool isEditing() const override { return m_contentView.isEditing(); }
void setEditing(bool isEditing) override;
void clearLayout() { m_contentView.clearLayout(); }
void clearLayout();
void scrollToCursor() {
scrollToBaselinedRect(m_contentView.cursorRect(), m_contentView.cursor()->baselineWithoutSelection());
}

View File

@@ -294,6 +294,11 @@ void LayoutField::setEditing(bool isEditing) {
}
}
void LayoutField::clearLayout() {
m_contentView.clearLayout(); // Replace the layout with an empty horizontal layout
reloadScroll(); // Put the scroll to offset 0
}
Context * LayoutField::context() const {
return (m_delegate != nullptr) ? m_delegate->context() : nullptr;
}