Revert "Restore InitializeDefaultChild"

This reverts commit 4aad6b2f4c.
This commit is contained in:
Siklos 2022-09-15 09:31:34 +02:00
parent 4aad6b2f4c
commit 012c826461

View file

@ -193,7 +193,8 @@ function AddNewContainerToParent(
newContainer,
configuration,
containerConfig,
newCounters
newCounters,
symbols
);
} else {
InitializeChildrenWithPattern(
@ -256,7 +257,8 @@ function InitializeDefaultChild(
newContainer: ContainerModel,
configuration: IConfiguration,
containerConfig: IAvailableContainer,
newCounters: Record<string, number>
newCounters: Record<string, number>,
symbols: Map<string, ISymbolModel>
): void {
if (containerConfig.DefaultChildType === undefined) {
return;
@ -277,45 +279,15 @@ function InitializeDefaultChild(
seen.add(currentConfig.Type);
/// TODO: REFACTOR this with AddContainerToParent ///
const left: number = currentConfig.Margin?.left ?? 0;
const bottom: number = currentConfig.Margin?.bottom ?? 0;
const top: number = currentConfig.Margin?.top ?? 0;
const right: number = currentConfig.Margin?.right ?? 0;
let x = currentConfig.X ?? 0;
let y = currentConfig.Y ?? 0;
let width = currentConfig.Width ?? currentConfig.MaxWidth ?? currentConfig.MinWidth ?? parent.properties.width;
let height = currentConfig.Height ?? parent.properties.height;
({ x, y, width, height } = ApplyMargin(x, y, width, height, left, bottom, top, right));
UpdateCounters(newCounters, currentConfig.Type);
const count = newCounters[currentConfig.Type];
const defaultChildProperties = GetDefaultContainerProps(
currentConfig.Type,
count,
const newChildContainer = AddNewContainerToParent(
currentConfig,
configuration,
parent,
x,
y,
width,
height,
currentConfig
0, 0,
newCounters,
symbols
);
// Create the container
const newChildContainer = new ContainerModel(
parent,
defaultChildProperties,
[],
{
type: currentConfig.Type
}
);
// And push it the the parent children
parent.children.push(newChildContainer);
/// ///
// iterate
depth++;
parent = newChildContainer;