Fix behaviors not apply on sibling when deleting a container + Fix container not able to move because sort is done after

This commit is contained in:
Eric NGUYEN 2022-09-21 16:46:42 +02:00
parent d875e33f93
commit 4bb92e219d
2 changed files with 41 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import { IHistoryState } from '../../../Interfaces/IHistoryState';
import { ContainerModel, IContainerModel } from '../../../Interfaces/IContainerModel';
import { FindContainerById, MakeIterator } from '../../../utils/itertools';
import { GetCurrentHistory } from '../Editor';
import { ApplyBehaviors, ApplyBehaviorsOnSiblingsChildren } from '../Behaviors/Behaviors';
import { ApplyBehaviors, ApplyBehaviorsOnSiblings, ApplyBehaviorsOnSiblingsChildren } from '../Behaviors/Behaviors';
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
import Swal from 'sweetalert2';
import { PropertyType } from '../../../Enums/PropertyType';
@ -79,7 +79,7 @@ export function DeleteContainer(
throw new Error('[DeleteContainer] Could not find container among parent\'s children');
}
ApplyBehaviorsOnSiblingsChildren(container, current.symbols);
ApplyBehaviorsOnSiblings(container, current.symbols);
// Select the previous container
// or select the one above
@ -240,14 +240,15 @@ function SetContainer(
container.properties.linkedSymbolId,
symbols
);
// sort the children list by their position
SortChildren(container.parent);
// Apply special behaviors: rigid, flex, symbol, anchor
ApplyBehaviors(container, symbols);
// Apply special behaviors on siblings
ApplyBehaviorsOnSiblingsChildren(container, symbols);
// sort the children list by their position
SortChildren(container.parent);
}
/**