Fix x position when inserting container

This commit is contained in:
Siklos 2022-08-09 11:36:58 +02:00
parent 4c10b0f8d7
commit 581f1ca77e

View file

@ -248,9 +248,11 @@ class Editor extends React.Component<IEditorProps> {
} }
let x = 0; let x = 0;
const lastChild: IContainerModel | undefined = parentClone.children.at(-1); if (index !== 0) {
if (lastChild !== undefined) { const lastChild: IContainerModel | undefined = parentClone.children.at(index - 1);
x = lastChild.properties.x + Number(lastChild.properties.width); if (lastChild !== undefined) {
x = lastChild.properties.x + Number(lastChild.properties.width);
}
} }
// Create the container // Create the container