Default action of AddContainer will now be append
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Siklos 2022-08-05 11:57:03 +02:00
parent 35bb95f206
commit cf1a3a7eec

View file

@ -212,13 +212,19 @@ class Editor extends React.Component<IEditorProps> {
throw new Error('[OnPropertyChange] Container model was not found among children of the main container!'); throw new Error('[OnPropertyChange] Container model was not found among children of the main container!');
} }
let x = 0;
const lastChild: IContainerModel | undefined = parent.children.at(-1);
if (lastChild !== undefined) {
x = lastChild.properties.x + Number(lastChild.properties.width);
}
// Create the container // Create the container
const newContainer = new ContainerModel( const newContainer = new ContainerModel(
parent, parent,
{ {
id: `${type}-${count}`, id: `${type}-${count}`,
parentId: parent.properties.id, parentId: parent.properties.id,
x: 0, x,
y: 0, y: 0,
width: properties?.Width, width: properties?.Width,
height: parent.properties.height, height: parent.properties.height,