Merged PR 226: Implement associated container and default X, Y position for Symbol

Implement associated container and default X, Y position for Symbol

Related work items: #7537, #7540
This commit is contained in:
Eric Nguyen 2022-11-07 08:59:25 +00:00
parent 0a664752e9
commit 4ff2e0b7fb
9 changed files with 136 additions and 48 deletions

View file

@ -282,11 +282,12 @@ function SetContainer(
AssignProperty(container, key, value, type);
// link the symbol if it exists
const oldSymbol = symbols.get(oldSymbolId);
const newSymbol = symbols.get(container.properties.linkedSymbolId);
LinkSymbol(
container.properties.id,
oldSymbolId,
container.properties.linkedSymbolId,
symbols
oldSymbol,
newSymbol
);
// Apply special behaviors: rigid, flex, symbol, anchor
@ -357,15 +358,11 @@ function AssignProperty(container: ContainerModel, key: string, value: string |
* @param symbols Current list of symbols
* @returns
*/
function LinkSymbol(
export function LinkSymbol(
containerId: string,
oldSymbolId: string,
newSymbolId: string,
symbols: Map<string, ISymbolModel>
oldSymbol: ISymbolModel | undefined,
newSymbol: ISymbolModel | undefined
): void {
const oldSymbol = symbols.get(oldSymbolId);
const newSymbol = symbols.get(newSymbolId);
if (newSymbol === undefined) {
if (oldSymbol !== undefined) {
oldSymbol.linkedContainers.delete(containerId);