mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 14:50:44 +01:00
[expression_editor] The user can input text.
Change-Id: I6456ee23e3caf3a42899d0734e1bef1f53f68b8d
This commit is contained in:
@@ -4,7 +4,8 @@ namespace ExpressionEditor {
|
||||
|
||||
Controller::Controller(Responder * parentResponder, Poincare::ExpressionLayout * expressionLayout) :
|
||||
ViewController(parentResponder),
|
||||
m_view(parentResponder, expressionLayout, &m_cursor)
|
||||
m_view(parentResponder, expressionLayout, &m_cursor),
|
||||
m_expressionLayout(expressionLayout)
|
||||
{
|
||||
m_cursor.setPointedExpressionLayout(expressionLayout->editableChild(0));
|
||||
}
|
||||
@@ -33,6 +34,11 @@ bool Controller::handleEvent(Ion::Events::Event event) {
|
||||
{
|
||||
returnValue = true;
|
||||
}
|
||||
else if (event.hasText() && m_expressionLayout->insertLayoutForTextAtCursor(event.text(), &m_cursor)) {
|
||||
returnValue = true;
|
||||
m_expressionLayout->invalidAllSizesAndPositions();
|
||||
m_view.layoutSubviews();
|
||||
}
|
||||
m_view.cursorPositionChanged();
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
private:
|
||||
ExpressionEditorView m_view;
|
||||
Poincare::ExpressionLayout * m_expressionLayout;
|
||||
Poincare::ExpressionLayoutCursor m_cursor;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ void ExpressionEditorView::layoutSubviews() {
|
||||
k_margin,
|
||||
bounds().width() - 2 * k_margin,
|
||||
bounds().height() - 2 * k_margin));
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
|
||||
KDSize ExpressionEditorView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -14,7 +14,7 @@ KDSize ScrollableExpressionViewWithCursor::minimalSizeForOptimalDisplay() const
|
||||
}
|
||||
|
||||
void ScrollableExpressionViewWithCursor::scrollToCursor() {
|
||||
scrollToContentRect(m_expressionViewWithCursor.cursorRect());
|
||||
scrollToContentRect(m_expressionViewWithCursor.cursorRect(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user