Implement anchor and fix bugs with rigid body (#27)
All checks were successful
continuous-integration/drone/push Build is passing

Co-authored-by: Eric NGUYEN <enguyen@techform.fr>
Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/27
This commit is contained in:
Siklos 2022-08-12 11:47:21 -04:00
parent c81a6fe44b
commit 704dab7307
12 changed files with 202 additions and 97 deletions

View file

@ -4,6 +4,7 @@ import { IConfiguration } from '../../Interfaces/IConfiguration';
import { ContainerModel, IContainerModel } from '../../Interfaces/IContainerModel';
import { findContainerById } from '../../utils/itertools';
import { getCurrentHistory } from './Editor';
import IProperties from '../../Interfaces/IProperties';
/**
* Select a container
@ -203,20 +204,23 @@ export function AddContainer(
}
}
const defaultProperties: IProperties = {
id: `${type}-${count}`,
parentId: parentClone.properties.id,
x,
y: 0,
width: properties.Width,
height: parentClone.properties.height,
isRigidBody: false,
isAnchor: false,
XPositionReference: properties.XPositionReference,
...properties.Style
};
// Create the container
const newContainer = new ContainerModel(
parentClone,
{
id: `${type}-${count}`,
parentId: parentClone.properties.id,
x,
y: 0,
width: properties?.Width,
height: parentClone.properties.height,
isRigidBody: false,
XPositionReference: properties.XPositionReference,
...properties.Style
},
defaultProperties,
[],
{
type