Fix flex not applying when moving symbols
This commit is contained in:
parent
08f98bd40f
commit
191fa9cfa2
3 changed files with 20 additions and 19 deletions
|
@ -6,7 +6,7 @@ import { GetCurrentHistory, UpdateCounters } from '../Editor';
|
|||
import { AddMethod } from '../../../Enums/AddMethod';
|
||||
import { IAvailableContainer } from '../../../Interfaces/IAvailableContainer';
|
||||
import { GetDefaultContainerProps, DEFAULTCHILDTYPE_ALLOW_CYCLIC, DEFAULTCHILDTYPE_MAX_DEPTH } from '../../../utils/default';
|
||||
import { ApplyBehaviors } from '../Behaviors/Behaviors';
|
||||
import { ApplyBehaviors, ApplyBehaviorsOnSiblings } from '../Behaviors/Behaviors';
|
||||
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import Swal from 'sweetalert2';
|
||||
import { ApplyMargin, TransformX } from '../../../utils/svg';
|
||||
|
@ -626,19 +626,3 @@ function LinkSymbol(
|
|||
|
||||
newSymbol.linkedContainers.add(containerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over the siblings of newContainer and apply the behaviors
|
||||
* @param newContainer
|
||||
* @param symbols
|
||||
* @returns
|
||||
*/
|
||||
function ApplyBehaviorsOnSiblings(newContainer: ContainerModel, symbols: Map<string, ISymbolModel>): void {
|
||||
if (newContainer.parent === null || newContainer.parent === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
newContainer.parent.children
|
||||
.filter(container => newContainer !== container)
|
||||
.forEach(container => ApplyBehaviors(container, symbols));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Dispatch, SetStateAction } from 'react';
|
||||
import { IConfiguration } from '../../../Interfaces/IConfiguration';
|
||||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { IHistoryState } from '../../../Interfaces/IHistoryState';
|
||||
|
@ -6,7 +5,7 @@ import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
|||
import { GetDefaultSymbolModel } from '../../../utils/default';
|
||||
import { FindContainerById } from '../../../utils/itertools';
|
||||
import { RestoreX } from '../../../utils/svg';
|
||||
import { ApplyBehaviors } from '../Behaviors/Behaviors';
|
||||
import { ApplyBehaviors, ApplyBehaviorsOnSiblings } from '../Behaviors/Behaviors';
|
||||
import { GetCurrentHistory, UpdateCounters } from '../Editor';
|
||||
|
||||
export function AddSymbol(
|
||||
|
@ -150,6 +149,8 @@ export function OnPropertyChange(
|
|||
}
|
||||
|
||||
ApplyBehaviors(container, newSymbols);
|
||||
|
||||
ApplyBehaviorsOnSiblings(container, newSymbols);
|
||||
});
|
||||
|
||||
history.push({
|
||||
|
|
|
@ -35,3 +35,19 @@ export function ApplyBehaviors(container: IContainerModel, symbols: Map<string,
|
|||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over the siblings of newContainer and apply the behaviors
|
||||
* @param newContainer
|
||||
* @param symbols
|
||||
* @returns
|
||||
*/
|
||||
export function ApplyBehaviorsOnSiblings(newContainer: ContainerModel, symbols: Map<string, ISymbolModel>): void {
|
||||
if (newContainer.parent === null || newContainer.parent === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
newContainer.parent.children
|
||||
.filter(container => newContainer !== container)
|
||||
.forEach(container => ApplyBehaviors(container, symbols));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue