Fix x position when inserting container
This commit is contained in:
parent
4c10b0f8d7
commit
581f1ca77e
1 changed files with 5 additions and 3 deletions
|
@ -248,10 +248,12 @@ class Editor extends React.Component<IEditorProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let x = 0;
|
let x = 0;
|
||||||
const lastChild: IContainerModel | undefined = parentClone.children.at(-1);
|
if (index !== 0) {
|
||||||
|
const lastChild: IContainerModel | undefined = parentClone.children.at(index - 1);
|
||||||
if (lastChild !== undefined) {
|
if (lastChild !== undefined) {
|
||||||
x = lastChild.properties.x + Number(lastChild.properties.width);
|
x = lastChild.properties.x + Number(lastChild.properties.width);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the container
|
// Create the container
|
||||||
const newContainer = new ContainerModel(
|
const newContainer = new ContainerModel(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue