mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/sequence] SequenceTitleCell reload
SequenceTitleCell::reloadCell now triggers a layoutSubviews, causing the
vertical alignment to be recomputed. This solves issues regarding the
alignment of a sequence's name and definition, such as :
- typing u_n = v_n ; v_n would be displayed above u_n
- typing u_n = (1/3)/2 then changing to u_n = 1/(2/3) without erasing
the formula first. u_n would no longer be aligned with the = sign.
Change-Id: I4a771d96ea79e42e2f4822e93f9f1cbbcf867610
This commit is contained in:
committed by
Émilie Feral
parent
e03bb7432e
commit
43fc937469
@@ -43,6 +43,16 @@ void SequenceTitleCell::setColor(KDColor color) {
|
||||
m_titleTextView.setTextColor(color);
|
||||
}
|
||||
|
||||
void SequenceTitleCell::reloadCell() {
|
||||
/* When creating a new sequence, the layout has not yet been initialized, but
|
||||
* it is needed in layoutSubview to compute the vertical alignment. */
|
||||
if (TreeNode::IsValidIdentifier(layout().identifier())) {
|
||||
layoutSubviews();
|
||||
}
|
||||
m_titleTextView.reloadCell();
|
||||
FunctionTitleCell::reloadCell();
|
||||
}
|
||||
|
||||
int SequenceTitleCell::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
@@ -53,6 +63,7 @@ View * SequenceTitleCell::subviewAtIndex(int index) {
|
||||
}
|
||||
|
||||
void SequenceTitleCell::layoutSubviews(bool force) {
|
||||
assert(TreeNode::IsValidIdentifier(layout().identifier()));
|
||||
if (m_orientation == Orientation::VerticalIndicator) {
|
||||
m_titleTextView.setAlignment(k_verticalOrientationHorizontalAlignment, verticalAlignment());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
Poincare::Layout layout() const override {
|
||||
return m_titleTextView.layout();
|
||||
}
|
||||
void reloadCell() override;
|
||||
private:
|
||||
static constexpr float k_horizontalOrientationAlignment = 0.5f;
|
||||
static constexpr float k_verticalOrientationHorizontalAlignment = 0.9f;
|
||||
|
||||
Reference in New Issue
Block a user