Rename applyBehaviors
This commit is contained in:
parent
e831f95d20
commit
c1139216c2
4 changed files with 8 additions and 5 deletions
|
@ -8,7 +8,7 @@ import { RecalculatePhysics } from './RigidBodyBehaviors';
|
||||||
* @param container Container to recalculate its positions
|
* @param container Container to recalculate its positions
|
||||||
* @returns Updated container
|
* @returns Updated container
|
||||||
*/
|
*/
|
||||||
export function applyBehaviors(container: IContainerModel): IContainerModel {
|
export function ApplyBehaviors(container: IContainerModel): IContainerModel {
|
||||||
if (container.properties.isAnchor) {
|
if (container.properties.isAnchor) {
|
||||||
ImposePosition(container);
|
ImposePosition(container);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { getCurrentHistory } from './Editor';
|
||||||
import { AddMethod } from '../../Enums/AddMethod';
|
import { AddMethod } from '../../Enums/AddMethod';
|
||||||
import { IAvailableContainer } from '../../Interfaces/IAvailableContainer';
|
import { IAvailableContainer } from '../../Interfaces/IAvailableContainer';
|
||||||
import { GetDefaultContainerProps } from '../../utils/default';
|
import { GetDefaultContainerProps } from '../../utils/default';
|
||||||
|
import { ApplyBehaviors } from './Behaviors/Behaviors';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a container
|
* Select a container
|
||||||
|
@ -224,6 +225,8 @@ export function AddContainer(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ApplyBehaviors(newContainer);
|
||||||
|
|
||||||
// And push it the the parent children
|
// And push it the the parent children
|
||||||
if (index === parentClone.children.length) {
|
if (index === parentClone.children.length) {
|
||||||
parentClone.children.push(newContainer);
|
parentClone.children.push(newContainer);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { IHistoryState } from '../../Interfaces/IHistoryState';
|
||||||
import { findContainerById } from '../../utils/itertools';
|
import { findContainerById } from '../../utils/itertools';
|
||||||
import { getCurrentHistory } from './Editor';
|
import { getCurrentHistory } from './Editor';
|
||||||
import { restoreX } from '../SVG/Elements/Container';
|
import { restoreX } from '../SVG/Elements/Container';
|
||||||
import { applyBehaviors } from './Behaviors/Behaviors';
|
import { ApplyBehaviors } from './Behaviors/Behaviors';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handled the property change event in the properties form
|
* Handled the property change event in the properties form
|
||||||
|
@ -42,7 +42,7 @@ export function OnPropertyChange(
|
||||||
(container.properties as any)[key] = value;
|
(container.properties as any)[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyBehaviors(container);
|
ApplyBehaviors(container);
|
||||||
|
|
||||||
history.push({
|
history.push({
|
||||||
LastAction: `Change ${key} of ${container.properties.id}`,
|
LastAction: `Change ${key} of ${container.properties.id}`,
|
||||||
|
@ -110,7 +110,7 @@ export function OnPropertiesSubmit(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the behaviors
|
// Apply the behaviors
|
||||||
applyBehaviors(container);
|
ApplyBehaviors(container);
|
||||||
|
|
||||||
history.push({
|
history.push({
|
||||||
LastAction: `Change properties of ${container.properties.id}`,
|
LastAction: `Change properties of ${container.properties.id}`,
|
||||||
|
|
|
@ -59,7 +59,7 @@ export const GetDefaultContainerProps = (
|
||||||
y,
|
y,
|
||||||
width: containerConfig.Width ?? containerConfig.MinWidth ?? parent.properties.width,
|
width: containerConfig.Width ?? containerConfig.MinWidth ?? parent.properties.width,
|
||||||
height: containerConfig.Height ?? parent.properties.height,
|
height: containerConfig.Height ?? parent.properties.height,
|
||||||
isRigidBody: false,
|
isRigidBody: false, // set this to true to replicate Florian's project
|
||||||
isAnchor: false,
|
isAnchor: false,
|
||||||
XPositionReference: containerConfig.XPositionReference ?? XPositionReference.Left,
|
XPositionReference: containerConfig.XPositionReference ?? XPositionReference.Left,
|
||||||
minWidth: containerConfig.MinWidth ?? 0,
|
minWidth: containerConfig.MinWidth ?? 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue