#7344 Fix AddContainer pattern wrong order

This commit is contained in:
Eric NGUYEN 2022-10-18 15:00:19 +02:00
parent 639480678d
commit d778e85b99

View file

@ -326,6 +326,7 @@ function InitializeChildrenWithPattern(
const queue: Node[] = [rootNode]; const queue: Node[] = [rootNode];
while (queue.length > 0) { while (queue.length > 0) {
let levelSize = queue.length; let levelSize = queue.length;
const maxLevelSize = levelSize - 1;
while (levelSize-- !== 0) { while (levelSize-- !== 0) {
const node = queue.shift() as Node; const node = queue.shift() as Node;
@ -334,12 +335,13 @@ function InitializeChildrenWithPattern(
if (pattern.children === undefined) { if (pattern.children === undefined) {
// Add Container // Add Container
const containerConfig = node.containerOrPattern as IAvailableContainer; const containerConfig = node.containerOrPattern as IAvailableContainer;
const index = maxLevelSize - levelSize;
AddNewContainerToParent( AddNewContainerToParent(
containerConfig, containerConfig,
configuration, configuration,
containers, containers,
node.parent, node.parent,
0, 0, index, 0,
newCounters, newCounters,
symbols symbols
); );