Restore InitializeDefaultChild
This commit is contained in:
parent
84f25af490
commit
4aad6b2f4c
1 changed files with 38 additions and 10 deletions
|
@ -193,8 +193,7 @@ function AddNewContainerToParent(
|
||||||
newContainer,
|
newContainer,
|
||||||
configuration,
|
configuration,
|
||||||
containerConfig,
|
containerConfig,
|
||||||
newCounters,
|
newCounters
|
||||||
symbols
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
InitializeChildrenWithPattern(
|
InitializeChildrenWithPattern(
|
||||||
|
@ -257,8 +256,7 @@ function InitializeDefaultChild(
|
||||||
newContainer: ContainerModel,
|
newContainer: ContainerModel,
|
||||||
configuration: IConfiguration,
|
configuration: IConfiguration,
|
||||||
containerConfig: IAvailableContainer,
|
containerConfig: IAvailableContainer,
|
||||||
newCounters: Record<string, number>,
|
newCounters: Record<string, number>
|
||||||
symbols: Map<string, ISymbolModel>
|
|
||||||
): void {
|
): void {
|
||||||
if (containerConfig.DefaultChildType === undefined) {
|
if (containerConfig.DefaultChildType === undefined) {
|
||||||
return;
|
return;
|
||||||
|
@ -279,15 +277,45 @@ function InitializeDefaultChild(
|
||||||
|
|
||||||
seen.add(currentConfig.Type);
|
seen.add(currentConfig.Type);
|
||||||
|
|
||||||
const newChildContainer = AddNewContainerToParent(
|
/// TODO: REFACTOR this with AddContainerToParent ///
|
||||||
currentConfig,
|
const left: number = currentConfig.Margin?.left ?? 0;
|
||||||
configuration,
|
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,
|
||||||
parent,
|
parent,
|
||||||
0, 0,
|
x,
|
||||||
newCounters,
|
y,
|
||||||
symbols
|
width,
|
||||||
|
height,
|
||||||
|
currentConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Create the container
|
||||||
|
const newChildContainer = new ContainerModel(
|
||||||
|
parent,
|
||||||
|
defaultChildProperties,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
type: currentConfig.Type
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// And push it the the parent children
|
||||||
|
parent.children.push(newChildContainer);
|
||||||
|
/// ///
|
||||||
|
|
||||||
// iterate
|
// iterate
|
||||||
depth++;
|
depth++;
|
||||||
parent = newChildContainer;
|
parent = newChildContainer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue