mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] Clean Expression and Layout builders
Before: Opposite(Opposite(Rational(1))) misleadingly created the expression "-1"; now, Opposite::Builder(Opposite::Builder(Rational(1))) creates "--1"
This commit is contained in:
committed by
LeaNumworks
parent
b3d15d7e7f
commit
ac6f23684d
@@ -231,7 +231,7 @@ bool VerticalOffsetLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode
|
||||
// Add the Left parenthesis
|
||||
int idxInParent = parentRef.indexOfChild(thisRef);
|
||||
int leftParenthesisIndex = idxInParent;
|
||||
LeftParenthesisLayout leftParenthesis = LeftParenthesisLayout();
|
||||
LeftParenthesisLayout leftParenthesis = LeftParenthesisLayout::Builder();
|
||||
int numberOfOpenParenthesis = 0;
|
||||
while (leftParenthesisIndex > 0
|
||||
&& parentRef.childAtIndex(leftParenthesisIndex-1).isCollapsable(&numberOfOpenParenthesis, true))
|
||||
@@ -242,7 +242,7 @@ bool VerticalOffsetLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode
|
||||
idxInParent = parentRef.indexOfChild(thisRef);
|
||||
|
||||
// Add the Right parenthesis
|
||||
RightParenthesisLayout rightParenthesis = RightParenthesisLayout();
|
||||
RightParenthesisLayout rightParenthesis = RightParenthesisLayout::Builder();
|
||||
if (cursor->position() == LayoutCursor::Position::Right) {
|
||||
parentRef.addChildAtIndex(rightParenthesis, idxInParent + 1, parentRef.numberOfChildren(), nullptr);
|
||||
} else {
|
||||
@@ -266,11 +266,4 @@ LayoutNode * VerticalOffsetLayoutNode::baseLayout() {
|
||||
return parentNode->childAtIndex(idxInParent - 1);
|
||||
}
|
||||
|
||||
VerticalOffsetLayout::VerticalOffsetLayout(Layout l, VerticalOffsetLayoutNode::Type type) :
|
||||
Layout(TreePool::sharedPool()->createTreeNode<VerticalOffsetLayoutNode>())
|
||||
{
|
||||
static_cast<VerticalOffsetLayoutNode *>(node())->setType(type);
|
||||
replaceChildAtIndexInPlace(0,l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user