[poincare] Fix Layout::replaceWithJuxtapositionOf

This commit is contained in:
Léa Saviot
2019-04-10 16:07:32 +02:00
committed by Émilie Feral
parent 057939dd3f
commit 22b7853dfa

View File

@@ -99,7 +99,7 @@ void Layout::replaceWithJuxtapositionOf(Layout leftChild, Layout rightChild, Lay
* replaceWith. */
HorizontalLayout horizontalLayoutR = HorizontalLayout::Builder();
p.replaceChild(*this, horizontalLayoutR, cursor);
horizontalLayoutR.addOrMergeChildAtIndex(leftChild, 0, false);
horizontalLayoutR.addOrMergeChildAtIndex(leftChild, 0, true);
if (putCursorInTheMiddle) {
if (!horizontalLayoutR.isEmpty()) {
cursor->setLayout(horizontalLayoutR.childAtIndex(horizontalLayoutR.numberOfChildren()-1));
@@ -109,7 +109,7 @@ void Layout::replaceWithJuxtapositionOf(Layout leftChild, Layout rightChild, Lay
cursor->setPosition(LayoutCursor::Position::Left);
}
}
horizontalLayoutR.addOrMergeChildAtIndex(rightChild, 1, false);
horizontalLayoutR.addOrMergeChildAtIndex(rightChild, horizontalLayoutR.numberOfChildren(), true);
return;
}
/* The parent is an Horizontal layout, so directly add the two juxtaposition