Refactor behaviors into a single function (#35)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/35
This commit is contained in:
Siklos 2022-08-18 06:11:40 -04:00
parent f34ba64f7e
commit 0e161ffce0
4 changed files with 29 additions and 13 deletions

View file

@ -7,6 +7,7 @@ import { getCurrentHistory } from './Editor';
import { AddMethod } from '../../Enums/AddMethod';
import { IAvailableContainer } from '../../Interfaces/IAvailableContainer';
import { GetDefaultContainerProps } from '../../utils/default';
import { ApplyBehaviors } from './Behaviors/Behaviors';
/**
* Select a container
@ -224,6 +225,8 @@ export function AddContainer(
}
);
ApplyBehaviors(newContainer);
// And push it the the parent children
if (index === parentClone.children.length) {
parentClone.children.push(newContainer);