Fix ChildrenDimension not using x
This commit is contained in:
parent
1bd0d1c796
commit
dc582d3365
1 changed files with 5 additions and 3 deletions
|
@ -50,7 +50,7 @@ export const Container: React.FC<IContainerProps> = (props: IContainerProps) =>
|
|||
const text = (props.model.properties.width ?? 0).toString();
|
||||
|
||||
let dimensionChildren: JSX.Element | null = null;
|
||||
if (props.model.children.length > 0) {
|
||||
if (props.model.children.length > 1) {
|
||||
const {
|
||||
childrenId,
|
||||
xChildrenStart,
|
||||
|
@ -108,14 +108,16 @@ function GetChildrenDimensionProps(props: IContainerProps, dimensionMargin: numb
|
|||
|
||||
const lastChild = props.model.children[props.model.children.length - 1];
|
||||
let xChildrenStart = lastChild.properties.x;
|
||||
let xChildrenEnd = lastChild.properties.x + lastChild.properties.width;
|
||||
let xChildrenEnd = lastChild.properties.x;
|
||||
|
||||
// Find the min and max
|
||||
for (let i = props.model.children.length - 2; i >= 0; i--) {
|
||||
const child = props.model.children[i];
|
||||
const left = child.properties.x;
|
||||
if (left < xChildrenStart) {
|
||||
xChildrenStart = left;
|
||||
}
|
||||
const right = child.properties.x + child.properties.width;
|
||||
const right = child.properties.x;
|
||||
if (right > xChildrenEnd) {
|
||||
xChildrenEnd = right;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue