mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[poincare] More beautiful separation of exponential and root indexes
Exponent Layout (VerticalOffsetLayout of Superscript type) now add a margin to their layout only when they are next to a layout that has an upper left index. Change-Id: I670e8aefc7c6bcace8f61bbe4a4b6cea0936d96c
This commit is contained in:
@@ -125,6 +125,7 @@ public:
|
||||
virtual bool isRightBracket() const { return false; }
|
||||
virtual bool isEmpty() const { return false; }
|
||||
virtual bool isMatrix() const { return false; }
|
||||
virtual bool hasUpperLeftIndex() const { return false; }
|
||||
virtual char XNTChar() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
/* Expression Engine */
|
||||
int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override;
|
||||
|
||||
bool hasUpperLeftIndex() const override { return numberOfChildren() > 1; }
|
||||
protected:
|
||||
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
|
||||
KDSize computeSize() override;
|
||||
|
||||
@@ -246,7 +246,12 @@ KDSize VerticalOffsetLayout::computeSize() {
|
||||
KDSize indiceSize = indiceLayout()->size();
|
||||
KDCoordinate width = indiceSize.width();
|
||||
if (m_type == Type::Superscript) {
|
||||
width += 5;
|
||||
assert(m_parent != nullptr);
|
||||
assert(m_parent->isHorizontal());
|
||||
int indexInParent = m_parent->indexOfChild(this);
|
||||
if (indexInParent < m_parent-> numberOfChildren() - 1 && m_parent->editableChild(indexInParent + 1)->hasUpperLeftIndex()) {
|
||||
width += 5;
|
||||
}
|
||||
}
|
||||
KDCoordinate height = 0;
|
||||
if (m_type == Type::Subscript) {
|
||||
|
||||
Reference in New Issue
Block a user